Computing stuff tied to the physical world

Back on track – now the hard part

Now that all mistakes in the PCB have been fixed and the circuit is working, we get this:

DSC 5046

Note the four oddly-placed components!

And indeed, the 1-blips code is working again, as can be verified through the very faint dimming “blips” of the red LED every 3 seconds.

What we have is an energy harvesting circuit, slowly “pumping up” voltage on the two 100 µF reservoir caps, and the µC kicking into action when there is roughly 2V to power it up.

But that’s really child’s play compared to the second challenge up ahead of us: getting the RFM69 to send out a wireless packet. The reason for this is that the LPC810 µC only draws about 2..3 mA when running, whereas the RFM69 will need some 15..25 mA to enable the transmitter section, depending on the desired RF output power level.

We’re going to have to go through a number of successive stages:

  1. build up the minimal reservoir charge at which point the µC is powered up
  2. go to sleep – to let the charge build up further!
  3. power up the radio module via the I/O pin on the LPC810
  4. go to sleep – to recover some charge!
  5. send SPI commands to initialise the RFM69 and put it into sleep mode
  6. go to sleep – to recover some charge, again!
  7. enable the RFM69 transmitter and make it send out one packet
  8. rinse and repeat, from step 6

The reason for this sequence is that everything uses up charge when running. We have to constantly go back to a low power mode (as low as possible) to let the incoming charge build up our supply voltage again.

Stage 2 keeps the µC off a bit longer, until we’re pretty sure the supply is “plentiful”.

Stage 4 allows the RFM69 to get through its initial start-up sequence, before which it won’t respond to SPI commands. This is mostly about starting up the RFM69’s on-board crystal. According to the data sheet, this phase needs to be given at least 10 milliseconds.

Stage 6 is the main way for the circuit to recover energy. It should be long enough to allow the supply voltage to rise to its maximum value (about 3.5V with currently-chosen values). We’re going to need all the energy we can muster to turn on the radio, get it into transmit mode, send out the packet, and get it back into sleep mode. Luckily, this process can be completely automated on the RFM69 – the µC can set it up, and go to sleep, since the RFM69 can do everything by itself once a packet is placed in its FIFO – all the way to going back to sleep, in fact.

There are numerous failure modes, no doubt – but the main one is probably just running out of juice, causing the supply voltage to collapse and the NPN transistor to shut off again. In this case, the circuit will eventually come back alive in exactly the same way as when powered up for the first time. Else, it’ll cycle through stages 6, 7, and 8.

It’ll be an interesting exploration to see how all the above can be implemented – robustly!

[Back to article index]