Upgrading Yùn from OpenWRT to Linino

[Important Edit : I just realized that the tutorial I found was not genuine Arduino web site http://adruino.cc. I stumbled upon http://arduino.org instead. So if you bought a “Genuino” Yùn, it should have OpenWRT-Yun installed, not linino. Nevertheless, you stil can install linino. But if you want to stick to “Genuino” software, keep OpenWRT-Yun. I do apologize for the mix up…]

[Edit 2 : As you may know, there is an ongoing battle Arduino (LLC) VS Arduino (SRL). All this confusion comes from here. You will find an quite interresting article on hackaday. Now I now why arduino.org Yùns are using Linino… both companies belong to the same guy.]

WARNING : I did test this on my Yùn. It may not work on yours. Be aware that you may loose your warranty. And worse, you may brick your Yùn, especially if bootloader flashing fails. You do this at your own risks. Please, don’t blame me if you brick your Yùn ! 

I bought my Yùn a while ago and did not find time to test it. In the meantime, in seems the prefered OS has changed  and now newest Yùn are fitted with Linino OS instead of “raw” OpenWRT. This caused me a bit of trouble because Arduino.cc’s Yùn getting starting guide is now assuming you have Linino installed… not OpenWRT.

I first tried a “sysupgrade” as described here [edit: this points to arduino.org, not arduino.cc]. But it failed… My Yùn was not booting any more :-(.

I should have RTFM ! It is clearly stated :

If you already have an old Arduino Yun board and you want to upgrade your board to LininoIO, you must first upgrade your on-board OS from OpenWrt-Yun to LininoOS

Ok… now what ? If it happens to you, you can follow this procedure : Reflashing the OpenWrt-Yun image on the Yún. But, as stated in the title : it reflashed OpenWRT, not Linino. And as stated in the procedure :

WARNING
Following this guide will VOID the WARRANTY of your Yún

So, again, you do it at your own risks.

Anyway… back to square 1 : I have a running Yùn using the reflashing procedure but still loaded with OpenWRT, not Linino.

So, reading the reflashing guide; it says you MUST upgrade first to Linino… points to Linino’s latest image… but does not say how to upgrade. By chance, it it quite simple : you follow the very same procedure but using the Linino images :

And it worked : I now have a Yùn running Linino.

Two last tips :

  • In the first place, I struggled entering the bootloader, typing frenetically on enter… : in the Arduino’s serial monitor, don’t forget to choose “Newline” in the dropdown list beside baud rate. It’ll also help entring the commands to reflash the Yùn
  • After upgrading to Linino, the serial console shows garbage, although baud rate is properly set top 115200. As I understand it, It is due to incorrect baud communication setting between the microprocessor and the microcontroller. To solve this, just enter  “~1” (without the quotes) in sthe serial console and you should see clear text

Hope this will help

WiDo : a WiFi connected arduino

After presenting WeIO, here is WiDo from DFRobot, yet another Open Source IoT node.

wido

Image from http://www.dfrobot.com

It is basically an Arduino Leonardo which includes a WG1300 WiFi chip. Apparently, this can be used with Adafruit’s CC3000 Arduino library which should make it quite straightforward to use.

What’s the difference between an Arduino + a CC3000 shield then ? The price ! At less that $30, it makes a quite cheap IoT plateform !

Ordered some… (DHL shipping is free until the end of september) but no more in stock. So I don’t know when I will receive them 🙁

 

Getting XBee to work with Arduino SoftSerial

But… what is XBee…

Yes… you’re right, first things first. XBees are small wireless modules which implement, depending on the model, several RF protocols, the “major” one being ZigBee (thus the name !) You can find details here on Digi’s website.

XBee & Uno

Take care, there are several modules. I’ll be using XBee ZB Series 2 modules. You’ll find an XBee RF modules comparison here. As there are quite a few sites describing XBees , I won’t get into details in this post but rather refer to Sparkfun’s XBee buying guide which is covering XBee, ZigBee and Bumblebee 🙂

XBee & SoftwareSerial

Using XBee module with an Arduino is quite well documented… but examples often use the hardware UART making it not simple to program or debug because the UART is shared by the Arduino IDE and XBee chip.

So I thought I use SofwareSerial instead just as I did for one of my Wifridge version.

I used an XBee breakout board from www.droids.it I bought from Lextronic. It is handy as you can use it with 2.52mm pitch headers (XBee won’t fit directly into a breadboard !) and it has 2 operation LEDs.

Connection is quite straightforward :

  • 3.3V on Vin
  • GND on… GND
  • Tx on pin 7
  • Rx on pin 8

Rx and Tx pins can easily be changed in the program anyway.

Then, upload an AT firmware onto XBee module, upload this program onto the Arduino… and you should get something like that on your Serial Monitor into Arduino IDE :

You now have an XBee module talking to an Arduino using Software Serial port, leaving the hardware one for debugging and programming !

 

New WiFridge based on Adafruit CC3000 Wifi shield

Because I could no get a stable WiFridge (see here, here and here for details on my first version of WiFridge) using RN-XV Wifly module, I decided to give a try to the new Adafruit CC3000 Wifi shield.

By the way, I made a mistake when I ordered the shield (although it is quite clear on Adafruit’s web site…) there are 2 versions :

  • one with uFL connector and then needing an additionnal antenna and adapter wire
  • one with built-in ceramic antenna

So unless you really need an external antenna, the ceramic antenna should be sufficient for most use…

Apart from Wifi module, hardware is quite similar :

  • 2 waterproof DS18B20 temperature sensors
  • 1 AM2302 sensor

Temp Probes

  • 3 3mm LEDs (green, yellow, red)
  • 3 1kΩ resistor
  • 1 10kΩ resistor
  • 1 4.7Ω resistor (AM2302 does NOT need a pullup… it is built-in !)
  • 1 Arduino Wireless shield
  • 1 RN-XV Wifly module
  •  Adafruit CC3000 Wifi shield
  • a bunch of wires

WiFridge CC3000 640x480

Connections are quite straightforward :

  • Led are connected to digital I/Os 3, 6 and 7 through 1kΩ resistors. They are used for operation status.
  • Both DS18B20 are conected to port 8 (yellow wire) and make use of a 4.7kΩ pullup resistor
  • AM2302 is conneted to port 9… no pullup required !

Code for arduino is here.

It has now been running for 1 day with no glitch… and it will hopefully continue !

2014-02-11 23_18_13-Emoncms

poolDuino hardware & software details

pH and ORP stamp are using standard serial communication to send data they read from the probe. So I used the SoftwareSerial library to get data processed by the arduino and I connected :

  • pH RX & TX pin respectively to pin 2 & 3 on the arduino
  • ORP TX & TX pin respectively to pin 5 & 6 on the arduino

Temperature sensor is an analog sensor which I connected to pin A0.

PoolDuino 640x480

Also, I connected power (3.3V) and ground to respective power lines of sensors.

Test code (which is way more complicated than it should be because I was first planning to use an arduino as the final solution… but then decided to go for a BeagleBone) can be found here : https://github.com/jsiobj/poolDuino

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 🙂

 

 

Introduction to one of my first Arduino based project : WiFridge…

… or why one would want its fridge to be connected to the internet !

This is one of my first Arduino based project. I had some issue in the past with my freezer that would let the temperature going to high for too long and I had no way of knowing before it was too late. I could barely detect it happened by using an ice cube in a glass that would melt in case of a huge temperature problem. That is why I decided to build the WiFridge : a wifi device that would monitor my fridge’s and freezer’s temperatures and send an alert in case anything goes wrong.

I first tried using an Arduino Ethernet because it was far less expensive than an arduino with a wifi shield. But… I have no ethernet port near my fridge and I did not want to have an ethernet cable across my kitchen… So I had a look on internet and decided to go for a RN-XV WiFly Module from Roving Networks and the ad-hoc shield.

WiFridge 1000x750

For the temperature part, I bought 2 DS18B20 sensors, in a waterproof package, coming with a 1m long cable and its 4.7k pull-up resistor. I also bought an DHT22/AM2302 temperature and humidity sensor so I can get my kitchen’s environnement data along with fridge’s and freezer’s temperatures. Both sensors are digital sensor. That is, they send the temperature (and humidity for the AM2302) in the form of bits, not an analog voltage. DS18B20 sensor is using 1-wire protocol which I found very nice because I can connect both DS18B20 sensor to the very same input.

Add a few leds for monitoring the status of the gizmo, a bit of soldering after some testing on a breadboard, a few lines of code, and that’s it, I got my WiFridge up and running, sending data to the internet…

In a coming post, I will go into more details, give a detailed schematic for the hardware, describe Arduino’s code that I used (I am still working on it though as I have some Wifi stability problems…) and how I sent data to my emoncms web sites (one local on a Raspberry Pi and one on a shared hosting.)