It’s a hot, hot summer

Summer holidays in Australia and it has been a real scorcher of a week. As I need to get some preparation for the school year happening I am still playing with IoT here, even if it’s a little bit harder working away from home.

I’ve been playing with NodeMCU a bit more, because it has the obvious benefit of built-in WiFi, so once configured it just needs power and a network connection and you have data logging.

As noted in my previous post, Xively is no longer providing free hosting, so I need to find other options. A bit of hacking and some examples online and I have temperature logging being pushed to ThingSpeak. I’ve put the board outside plugged into a USB phone charger and am using a phone hotspot to provide internet connectivity. Proof-of-concept done!

Feed is here:

graph of temperature
Local temperature

Currently it’s dropped a little to just 35 °C, cooling off a bit!

Edit: Now back at home, and it is inside so a bit cooler!

Home weather offline for the moment

With a bit of ingenuity and a lot of trial and error there are ways of making this IoT work without having to sign up for commercial services. Since I am doing this for hobbyist/education purposes I can’t really justify paying for business services.

So what tends to happen is, something that one uses for a while and ‘it just works’ stops working because the provider changes the terms of use. Before Christmas, Xively sent out a notice that they were dropping their free data hosting, and I would either need to upgrade to a paid service or go elsewhere. This is quite reasonable, they are a business and I have been able to use their services for several years now. They even made a few suggestions for alternative hosts.

Being the silly season, time was limited to get a new service onboard, although I did spend some time with ThingSpeak it didn’t go smoothly, so I would have to say that Xively do have a very good platform because it was so easy to get up and running in the first place. So at the moment the weather station isn’t logging to the web, and will need some more work done before it does.

The Xively feed started on Mar 14, 2014, so it has been logging data for almost four years. That was my first real IoT experiment so I’m pleased with that! It was interesting to be able to check the weather at home when we were on holidays, and you could even work out who had been working in the study by the changing light levels.

HomeAssistant + Arduino

OK, HomeAssistant runs on RaspberryPi, but the RPi only has digital in/out, but what if I want to read analog values from sensors? One solution appears to be to use an Arduino, since this is the sort of thing they do well. However, finding details of how to do this seems a bit sketchy. I could use I2C, but that seems a bit tricky. I did read that I can use USB, which is convenient because that will also give me power for the Arduino. To use an Arduino as an add-on board for the RPi, I had read about something called Firmata, which loads as a sketch running on the Arduino. This is easy at the Arduino end, as it is just one of the examples pre-installed, upload and it’s ready to go.

I set up the configuration in HomeAssistant and immediately got a whole heap of errors, mostly referring to needing PyMata 2.14. Now PyMata is a client library that allows Python to control the Arduino. Obviously not part of the standard RPi/Hassbian image. After a bit of messing around here’s what I managed to do:

  1. Plug the Arduino into your computer, load up the IDE and upload the StandardFirmata sketch (found in the Examples submenu)
  2. Plug the Arduino into a USB port on the RPi. Log into the RPi using SSH
  3. At the command line, run:
    sudo pip3 install pymata
  4. If you download the examples from the GitHub repository, you should be able to call the blink sketch to verify that all is working. It should flash the LED 10 times, and you should see the process running in your terminal session counting down. (Note that my UNO clone is connected at ‘/dev/ttyACM0’, so the script works as is.
  5. Add the following entries to your configuration.yaml script and save it:
      port: /dev/ttyACM0
      platform: arduino
          name: LED
  6. Restart HomeAssistant
  7. The LED should show up as another switch in your dashboard, and turning it on should light the pin 13 LED on the Arduino
HomeAssistant dashboard with Firmata switch
LED on pin 13 of Arduino controlled through HA using Firmata

Note that it appears you can only read analog input pins, and switch digital output pins through this interface. No PWM, and I suppose if you need to read digital inputs then you can do that directly on the RPi.

More info at:



Thought it was time to step up the home automation effort, so a mention of HomeAssistant on a blog had me interested. So now the RaspberryPi is running some new software and I’ve been tinkering with this seeing what it can do. There’s not too many things in the house that are ‘smart’, but I can turn the TV off and control a WeMo switch. Much of the built-in functionality is impressive, so triggers for sunset or time let one test how it works. Integration with my phone also lets it track location and use geofencing for triggers also.

I’d be interested to see what can be done once I can integrate with other systems in the house, such as the alarm system, thermostat or pool controllers. Being open-source and open, there’s plenty of scope to ‘roll-your-own’ to meet individual needs.

Here’s a useful article on using the version of HomeAssistant. Worth a look.

A new electronics magazine for Australia

It’s interesting how things have come full circle. As a teenager, I used to buy Australian-published electronics magazines each month, and tinkered with making some projects. At that time, we had Electronics Today International, or ETI, and Electronics Australia. Early in the 90s ETI disappeared, and EA hung around a while longer. At some time some of the former EA staff set up a new magazine, Silicon Chip, which I have looked at from time to time.

Suddenly people are making things with electronics again, but the focus has shifted from analog circuitry to computer technology, and now that we have affordable programmable devices the hobby market is born again.I was quite excited to discover a new magazine launching in Australia, called Diyode. First new electronics magazine in the country for almost 30 years. I’ve subscribed, in print as well as digital, and the first issue arrived yesterday, a few days ahead of the newsstand launch. Good thing it’s school holidays and I’ll have some time to read it. Looks good, like some of the better UK magazines with full colour page spreads and some good practical articles.

We have vision!

I bought a Raspberry Pi camera to go with the RPi 3 for the school project. The eventual intention is to put it on our tank robot so we can see what it is seeing.

Following on from the previous tutorial IoT: Raspberry Pi Robot with Video Streamer and Pan/Tilt camera remote control over internet I installed streaming software, plugged in the camera and crossed my fingers. Loading the page showed some promise except I’d turned the lights off in the server room when I went away, so I had a square of black. Back to the server room, then back to my computer to find I was looking at the roof of the server room.

It works!

First view from the pi camera. The server room ceiling, not the most exciting view.
First view from the pi camera. The server room ceiling, not the most exciting view.

Science Talent Search – Robot Buggy

My son entered Science Talent Search with this Arduino-powered buggy. We used IR with a TV remote to issue codes for motor control and combinations of colours for the RGB LEDs.

Programming was fairly simple, but we found issues with power. It seems that motors are very noisy and when they run it can reset the Arduino. We solved this by running the motor off 4 x AA batteries, whilst the Arduino is powered by a phone battery booster. The Arduino in question is actually a Freetronics Leostick, which is a nice small board, and has a USB plug which we just plugged straight into the phone battery.

New Raspberry Pi 3 setup

This is the second Raspberry Pi I’ve bought, this one is for school projects. The really neat feature is that it has built-in WiFi.

  1. Download NOOBS and copy onto a MicroSD card
  2. Put in the MicroSD card and boot the RPi, then run the installer
  3. After a while, it restarts and you get the desktop. At this point it was easy just to join the home network and we’re done to this point
  4. At school, we set up a fixed IP address on a hidden wireless network, and used the MAC address to secure access to the network
  5. Proxy settings needed to be added
  6. Now, to run some updates. First apt-get update, then apt-upgrade
  7. Install vncserver so we can connect remotely using Chicken of the VNC

Now it’s time to tackle some specific jobs we need for projects.

  1. I used this article IoT: Raspberry Pi Robot with Video Streamer and Pan/Tilt camera remote control over internet to install lighttpd so now we have a simple web server running on the Pi . I wrote a simple page in Nano to test that it works

ESP8266 & NodeMCU

I bought a NodeMCU module a while back, but couldn’t figure out how to use it at the time. I also played with one of the ESP8266 modules using a FTDI adaptor to also convert to 3V3, but it seemed rather flaky. In the end, I found I could simply hook up the NodeMCU to a USB port and use the Arduino IDE. To save a whole lot of messing around, I also set up Blynk, which works briliantly with this type of device. One slight complication is that the NodeMCU tries to map pins to equivalent Arduino pinouts, whilst Blynk is still aware of the GPIO pinouts. Finding a pinout diagram here helped make sense of it.

NodeMCU on breadboard
NodeMCU on breadboard, with one LED connected. Note el cheapo phone booster battery doing a great job.

It also seems that the USB ports on my MacBook Pro aren’t reliable with this device, whether it isn’t so happy with USB 3.0 ports or whether it’s not supplying enough current I can’t tell.  When it shows up it is easy to flash it with the Arduino sketch. Plugging the board into a phone charger it works 100%. I’m also testing out an el cheapo phone battery booster from K-Mart as a portable power source for projects, and at only $5 this is great value, so I plan to pick up a few more.

Blynk screenshot
Test Blynk project. The red LED is on the breadboard, and the other two are blue LEDs on the NodeMCU board.

Suddenly I see a whole lot of benefits of using these inexpensive NodeMCU boards in place of Arduinos for lightweight projects, considering that you get Wi-Fi built in.

Raspberry Pi!

So it’s been busy, and school is just about to go back. I did find time to try out my Christmas present so I opened up the kit, plugged in the SD card and WiPi adaptor, hooked up peripherals that normally are hooked up to the Mac Mini, plugged in the power and we’re up and running. A few clicks and we’ve joined the network and posting a new item on this blog!