On the first prototype of the WSTL18, I've placed three pads for uart connection. Rx at the bottom, Tx in the middle, and ground at the top.
But how will the microcontroller know when the cable has been connected so it can listen for commands?
My first thought was to have the uart receive interrupt enabled, so the computer on the other end can just begin sending commands at any time. The problem with that is that uart is not allowed at "power save" mode, which is the lowest power consumption mode that will allow the real time counter to run. So that's out of the window because any higher power mode will kill the battery.
A second thought was that each time the mcu wakes up, which is every eight seconds clocked by the real time counter, it can send out a character over the uart and see if someone will respond. This means that the uart module has to be powered on every eight seconds, which will also reduce battery life, though not as much as the original option.
Finally, I decided to use a fourth pad that will make pin PC3 of the AVR available. The pin will be an input with the AVR's internal pull-up enabled. The uart cable connector will have to short this pin to ground. Every eight seconds, the mcu will check pin PC3, and if it is low it will mean a uart cable is connected. The mcu will then send a "ready" character, and the computer on the other end will have a 10ms timeout to send a preset command, such as "begin logging" or "dump all logs", etc.
This means I'll have to add one more pad connected to PC3 on my next prototype, but for the moment that's available for prototyping on the marked header around the logger's perimeter.
Any thoughts or experience on ultra-low power cable-connected detection please comment below!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.