OLEDMote display of sensor values

Started by Stark, January 06, 2015, 05:40:35 PM

Felix

Yes the BMP180 is a great sensor. I am making a new little board with that and Si7021 sensors for weather measurements. They are very accurate sensors and are simple to read and very low power.

Clemens

Quote from: TomWS on January 08, 2015, 08:50:22 AM
char txbuf[60];
float temp, pressure;   // I'm using float because it's easier to manage and you won't have a significant loss of precision

   temp=readYourTempSensor();
   pressure=readYourPressureSensor();
   byte len = sprintf(txbuf, "T:%3.1f, P:%5.1f", temp, pressure);  // sprintf does the magic but you might have to set some IDE flags to get floating point support...
   radio.sendWithRetry(GATEWAYID, txbuf,len);


sprintf with float %x.xf seems still not to work in the latest Arduino IDE (no luck with 1.5.5), see also http://dereenigne.org/arduino/arduino-float-to-string

TomWS

Quote from: Clemens on January 12, 2015, 06:23:03 AM
Quote from: TomWS on January 08, 2015, 08:50:22 AM
char txbuf[60];
float temp, pressure;   // I'm using float because it's easier to manage and you won't have a significant loss of precision

   temp=readYourTempSensor();
   pressure=readYourPressureSensor();
   byte len = sprintf(txbuf, "T:%3.1f, P:%5.1f", temp, pressure);  // sprintf does the magic but you might have to set some IDE flags to get floating point support...
   radio.sendWithRetry(GATEWAYID, txbuf,len);


sprintf with float %x.xf seems still not to work in the latest Arduino IDE (no luck with 1.5.5), see also http://dereenigne.org/arduino/arduino-float-to-string
This is controlled by a compiler option built into the IDE and controlled by some setup file.   The intent is to keep the _printf() functions small for these small processors.  If you have a function to format the floating point data then you don't need to change the flag.   

Thanks for the feedback,
Tom

Felix

Unfortunately not all the sprintf directives work in arduino world and that is somewhat expected. For floats I always use dtostrf() for instance:

dtostrf(batteryVolts, 3,2, BATstr); //then BATstr will contain the float which I can dump into another char buffer with %s


See how this is used in this sketch.

Stark

Quote from: Felix on January 12, 2015, 08:58:59 AM
...For floats I always use dtostrf()

dtostrf was my saviour to get a char variable for the OLED.

I now have hourly temperature readings from my garage displaying on my OLEDMote.  8)

A weather shield sounds great, I look forward to this developing Felix.

Going off topic slightly, the BMP180 indeed looks to be very low current, is it worth powering on and off say by a digital pin?

Whilst talking low power, I guess there may some options on the OLEDMote as well such as clearing the screen on a delay from receiving. I noted a sleep function in the U8glib library too?

Felix

The coming weathershield will be powering the sensors at all times. It's a good idea to keep them powered to keep the readings consistent.
Yes you can clear the screen after some delay, and use the button to activate the history of received messages. I didn't notice the sleep function in u8g...