Dash: Deep Sleep & Serial Communications


#1

New to dash/arduino programming but coming up to speed. Have programmed and deployed a dash temperature sending setup in the woods and got it to work for 3 days with a 720mAh battery (in 9-20˚ temps). Part of that was making sure I powered down the HologramCloud and go into deep sleep between readings, which are every 15 minutes.

Something that wasn’t originally obvious when setting up and debugging the sketch is that when you go into deepSleep the serial connection goes away. What I’m not sure of is how long it takes to come back: is that dependent on the mac driver waking up, noticing it and restoring the device? Is there any call (like HologramCloud.getConnectionStatus()) where you could block until it’s available again?

At one point this weekend something (mac/driver) started changing the /ldev entry pretty much every time I did a new build. Normally it would be /dev/cu.usbmodem14621 but that wasn’t showing up and a newly numbered entry would have to be selected in the IDE’s port setup each time. Anyone see that?

Thanks!


#2

Going into deep sleep turns off the processor, and disconnects the USB connection. The USB connection is also reset anytime the processor is reset, including during programming. How the device is enumerated and port assignment is completely controlled by the host OS. In macos I’ve noticed that the cu.usbmodem# is assigned based on physical USB port. If I have the Dash connected through a hub the # will roll about every iteration. But if I have it connected to a port directly, it sticks with the same #.

I am working on a function that will return true/false if the USB serial port is open, so you’ll be able to block if you want until your terminal is up and running. A very useful thing for debug. That will be included in the next Arduino package release, so keep an eye on the forum for that.


#3

Thanks for the clarification. Sure enough I started using a hub recently.

That would be handy to have. I’ve tried putting in a delay but that didn’t cut it. Also wasn’t sure if the port needs to be set up again (i.e. SerialUSB.begin(9600):wink:


#4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.