RFM12B signal strength meter using emonGLCD

I just discovered that Martin Roberts designed a very nice RF scanner and signal strength meter (SSM) using an emonGLCD. With one very simple hardware modification (you will loose the ability to use the LDR though), you can get the emonGLCD to work as a RF scanner ! All instructions are here. I followed them and within minutes, I got my RF scanner working !

GLCD SSM 640x480

The softwaremake the scanner easy to use and configure using the three emonGLCD push-buttons. You can configure the following parameters

  • Trigger level : minimum signal level required to trigger the display
  • Trigger position : position on the display of the signal that caused the trigger
  • Base level : minimum signal level which can be displayed (-80 or -100dBm)
  • Glitch detector : with this on short signal pulses which could be missed by a normal scan will show up
  • Timebase : period of a complete scan across the screen (16ms-16s)

Here are screenshots at  respectively 16ms, 32ms, 128ms and 16s :

GLCD SSM ScreenShots

Very nice !

My first Impee : a cheap Wifi temperature sensor

I received my Imp a few weeks ago along with a Sparkfun breakout board.

Configuring it to connect to your wifi network is very simple but you need to use either an iPhone or an Android phone.The Imp app just asks for you wifi detail, then makes the phone screen blink sending the configuration thru a sensor on the edge of the Imp. Simple and clever. You’ll find all information on Imp website here.

The hardware part

I also got

  • a very cheap LM35DZ temperature sensor
  • a 3.7V / 850mAh Li-Ion battery
  • an Adafruit Li-Ion battery charger

and hooked all this up together.

Impee

I connected LM35DZ data pin on pin 9.

To power the imp, you have 2 main choices :

  • USB
  • Battery
  • other external power

In order to choose battery or USB power, you need to solder a break away header and use a jumper. Please note this is not provided with the breakout board.

Imp Breakout Power

The software part

Ok, now we got to program this thing to measure temperature and sending it to some emoncms site for instance.

Actually, there are 2 things you need to program. the Imp itself : the “device”. But there is not much you can do with it. Typically, you can’t send an http request. You need to send the data to an Electric Imp web service : the “agent”. The agent can do many more things… like sending an http requests to emoncms.

So first, the device program

Then the agent program

Easy, isn’t it ?.

The results

Worked on battery (850mAh 3.7V) for 15 days. Here are temperature and voltage graph from emoncms :

Impee-Emoncms

Conclusion

I liked the easy of use of the gizmo : solder a temp sensor, type 10 lines of program, and here we go ! Also, I like the fact that you can send data to the “agent” to do potential heavy processing on server side thus saving power on the device (you can also send message from the agent to the device.)

I do not like depending on a Cloud based service that might not be always available. Not that I do not wish Electric Imp to be sucessfull and have a long life… but… you know… I just would like to have the option to host the agent myself.

Connecting Atlas Scientific temperature sensor to the BeagleBone Black

For the beaglePool, I needed a waterproof temp sensor which I found at AtlasScientific, along with pH and ORP circuit. And I quite had hard time figuring out how all this works.

Important : Things are moving quite fast is Beaglebone “young” world and you can install several different distros on it. This article applies to Beaglebone Black running Ubuntu with a 3.8 kernel. See this post for more information on how I installed Ubuntu.

The simple part : Adapting output voltage

AtlasScientific sensor is an analog sensor which ranges from -20°C up to 133°C matching 0 to 3V. But Beaglebone Black analog input only support up to 1.8V. So first thing to do is to build a simple voltage divider with 2 resistors. I chose 1% tolerance resistor for better accuracy.

VoltDivider

Enabling Analog input on BeagleBone

There are a lot of ressources on the web but thing are changing fast in quite young Beaglebone’s world.

By default, analog inputs are not enabled. You need to configure the system to enable them. Doing so can be done easily (once you know how to do it…) by using Device Tree and Device Tree Overlays.

If you want to configure it manually you can issue this command

You can check this has been taken in account cat’ing slots file :

The last line show iio overlay has been loaded.

But, this configuration is not kept after a reboot. If you want to set it up once for all and have analog inputs enabled at next reboot, you need to modify uEnv.txt file located in /boot/uboot

Here, it is cape-bone-iio which has been added. The 2 other entries are here to enable UARTs which I am using for another purpose (ORP and pH sensor).

Important : This configuration apply to Beaglebone Black running Ubuntu. The file uEnv.txt may be different for Angström.

Connecting probe to Beaglebone Black

BBB Atlas Scientific Temp

Not much to say really…

  • Sensor is powered through 3.3V pin (P9.3)
  • Data line is connected to one end of the 10kΩ resistor
  • Pin P9.36 (AIN5) is connected in the middle of the voltage divider, between 10kΩ and 15kΩ resistor so that voltage remains below 1.8V
  • the other end of 15kΩ is connected to ADC Ground (P9.34)

Reading output and convert to °C

Once properly configured, you can read value of ADC’s output using a pseudo file (here analog input 5) :

1076 it the raw ADC value, that is a value between 0 and 4096 (12 bits ADC.) So to get value in mV you’ll need to convert this value :

But… what we need it temperature (in °C), not mV…

Given probe Datasheet :

  • 0 is -20°C
  • 3V is 133°C but remember… we scaled it down to 1.8V

So :

  • 1 “step” => (133+20)°C/4096 ~ 0.0373°C/mV
  • 1076 => 1076*0.0373°C-20°C = 20,1348°C

Good ! Seems to work 🙂

Important

It seems that there other pseudo files with Linux kernel < 3.8. You counf find those files in /sys/devices/ocp.*/helper.*/AIN* :

Output of those files were directly mV :

Also, when overlay is loaded after boot time from the shell, I can see /sys/devices/ocp.*/helper.*/AIN* files. When load at boot time using uEnv.txt, they just don’t exists while /sys/bus/iio/devices/iio\:device0/in_voltage*_raw does.

Don’t ask me why… Anyway, those pseudo files seem deprecated.

References I used (thanks !)

Running Ubuntu on Beaglebone Black

Replacing Angstrom with Ubuntu

I quite struggled with Angstrom :

  • could not install most of needed perl modules
  • could not get sftp to work
  • lot of stuff I am not using running by default (and not sure how to remove it)

Not saying Angström is not a good distro. It is good for discovery and just runs out of the box. It is jus a bit raw for me and I am not used to it.

I finally decided to move to Ubuntu, a linux distribution I know a bit more and which has a wider supporting community.

I found all required information to install Ubuntu here : http://elinux.org/BeagleBoardUbuntu. If I do a short summary :

  • Download the eMMC Ubuntu image here : BBB-eMMC-flasher-ubuntu-13.04-2013-10-08.img.xz
  • Unzip it and dump it to an uSD card (2Gb is ok) using WinDiskImage on windows (or dd on linux)
  • Insert SD card into the BBB
  • Power it on
  • Wait for the 4 leds to be solid (can be long, more that 30 minutes…)
  • Remove power
  • Remove SD card
  • Power again : you’re running on Ubuntu !

Electric Imp : The Cloud Wifi IoT Gizmo

Just a quick news because I just discovered a  product that seems quite nice : the Electric Imp.

electric-imp-logo-trim

It is a typical Internet of Thinks gizmo which allows adding Wifi and internet connectivity in a quite simple way (it seems…) with a small foot print (and standard, like an SD card although it is NOT an SD card and it WON’T work as an SD card) at a quite low price.

Imp

It is easy to configure using a smartphone. The dedicated app is making the screen blink to send the configuration data to the Imp.

Just ordered it from Snootlab… can’t wait to test it !

WiFridge : the software

Arduino’s code

It can be found here on github. I won’t post it here. I hope comment in the code are sufficient to understand what I did. I will just describe main principles here.

Reading sensors

I used those libraries :

  • For 1-Wire, PJRC library which can be found here.
  • For DHT temp & humidity sensor, Adafruit library which can be found here.

WiFly

The goal is to send sensors data to an emoncms web site so that it can be historized and graphed. For that matter I built 2 web emoncms websites :

  • one on the internet on a shared hosting
  • one on a small and cheap Raspberry Pi

I know of 2 libraries for this WiFly module :

  • the one based on sparkun Sparkfun WiFly shield which can be found here
  • another one called WiflyHQ which can be found here

I first tried Sparkun lib but I could not get a stable web connection. It would eventually failed to connect to the destination web server after a random period of time. So I had a try for WiflyHQ. In the end, I still have stability problems but I find it easier to use as it kind of replicates all RN-XV functions whereas Sparkfun one tends to “hide” the bits and bytes but making it a bit more cryptic to me.

Also, samples in WiflyHQ makes use of a software serial port by default  whereas Wireless shield is using the hardware serial from the Arduino which is getting complex as you can’t really use the serial port for debugging without a risk of disturbing the Wifly module (see Hardware post here.)

Because of WiFly connection instability (it may be my code though wich is not… optimal…), I tried to use watchdog library to reboot both wifly and arduino in case something went wrong by entering an infinite loop which will eventually restart the arduino.. Not that efficient though… I still have some case where everything is stuck, not sending any data, but not rebooting… Or the wifly wont just properly reboot.

So I used the leds the try to grab some diagnostics information… but it does not really helped. It seems that the wifly will not get out of command mode from time to time. No idea why…

What’s next

Because of this instability, I want to try the quite new CC3000 wifi shield from Adafruit ! Just received it. I will migrate my code to work with that promising shield 🙂