Wireless Programming with Low Power (SOLVED)

Started by pipegf88, June 07, 2015, 09:46:25 PM

pipegf88

Hey everyone, I am new to this forum. I see that the messages are kind of old, but they have been really helpful to achieve this goal.

I read many posts from you guys, and used many pieces of the codes that the people posted.

I don't know if someone did this already, but I never found it.

My goal was to achieve a Wireless Programming from two Moteinos with RFM69W and flash, Gateway to Node, but trying to lower the current consumption in the Node as much as possible. I saw many people suggesting the radio.sleep() function, but the Wireless programming example in the library needed the Node to have the radio prepared all the time for the incoming .HEX file. Felix suggested to periodically wake up the radio and put it in RX mode for a little while or to have the node ask whether there's anything important for it at the gateway. I kind of used a little bit of both.

The idea was establishing a bidirectional communication, so that the Node will wake up every 8 seconds, turn radio on, tell the Gateway he is awake and waits around 60ms for a instruction package. This package will tell the Node if the Gateway wants to send .HEX file to program or if the Gateway needs the sensor values. About the sensor part, I just didn't want the Node to do analog readings, turning sensor On, wasting energy, if the data is not needed that often. The Node reads battery voltage and moisture readings from a Vegetronix  VH400 soil probe. Both of the readings needed a power trigger to be done, that way, saving power.Radio and flash are put to sleep to for the 8 seconds. So, if no actions are needed the Node goes back to sleep.

For the wireless programming, I had to do a little change in the python script, so that I can use the same sketches of the Gateway and Node to program wirelessly and then resume the data send/receive without disconnecting or re programming the moteinos.

I attach the code in this post. I am not a very good programmer, so any suggestions will be appreciated.

Thanks, and I hope this can help some other people.

Felix

Thanks for sharing this, it's all valuable code.
Also see this other related discussion: https://lowpowerlab.com/forum/index.php/topic,1136.0.html

joelucid

With the given setup you spend around 60ms x 16mA + 5ms x 80mA every 8 seconds on radio use alone. That's an average load of 170uA which will eat your average Alkaline 9V battery in around 140 days. That same battery would last you 30 years using the listen technique Felix referred to --- if batteries had no self-discharge.

pipegf88

Thanks for the suggestions. I have read about the listen mode, but I can't find the code or the way you do it, can you help me with this?

About the power consumption, I guess I can just eliminate the for loop and just try to receive radio once...

Thank you!

joelucid

There is a listen.h / listen.cpp attached to the thread in https://lowpowerlab.com/forum/index.php/topic,1136.0.html. This is just code I hacked together quickly but you could look at it as starting point.