Advice needed for LoRa
I am pretty new with the Pycom devices and I need some advice.
I already did this project with an Arduino on WiFI and that worked well.
With the Pytrack is the plan to monitor a led on the external pins. The duration of the blink time indicates a failure.
This failure needs to be solved but I want to send a message that this failure has occurred.
The transmission from this message I want to transmit over LoRa (Europe) with my Lopy.
Battery capacity is there enough so deepsleep is not nessecary. If I use deepsleep, I would use the accelerometer for waking up the Lopy.
I want advice how I should code the monitor length of the indication light and the transmit action.
Should I use LoRa nvram save in the first cycle.
And then with an if else statement define the length of the message in combination with nvram restore followed by a s.send(xxx)?
Or is there a better tool to use for this?
There are 7 or 8 different blink lengths.
On the Arduino I used PulseLn and a Switch case, but I couldn`t found anything in the Pycom docs.
Let me know.
With kind regards, Han
@han I think you're mixing up several different topics:
- monitoring that LED (or rather the signal that drives that LED, I suppose?)
- sleep issues
For the monitoring part, it depends on the lengths you are considering. You could probably simply use interrupts to detect when the signal goes up or low, and compute the time difference to find the length of the pulse.
What kind of battery are you using? An active LoPy draws about 50 mA even when doing nothing, so even a 5000 mAh battery would only last 4 days without deep sleep.
Light sleep would help you save a bit, but you would still be talking about days or weeks, not months, unless you really have a very large battery, or have an external power supply.
If you don't use deep sleep you don't need to nvram_save/restore.
If you do go to deep sleep, you'll need to wake on pin to wake up when the LED lights up, but you may have issues measuring the first pulse, so I hope it is repeated...