Saturday, March 26, 2016

Graphing temperature on DataDog from an esp8266

One of my colleagues, Jules, is totally hot. I think his desk is under an air conditioning vent or perhaps he just works too hard. Anyhow, it gave me an idea. Recently we've been using the cloud logging service DataDog to send data to and have it graph and alert us. I wanted to log the temperature from an esp8266 01 board.


DataDog has a simple API for sending measurements to which you post JSON with an array of data points and a unix timestamp. Then you can make up dashboards with graphs like this:



The temperature and humidity sensor is one I grabbed at Jaycar, they call it a Duinotech XC4432 that contains a DHT11 sensor. Unfortunately the resolution seems only to be a degree so I'm waiting for something better to come in the post.

Because DataDog wants a time stamp with every reading, I get the time from an NTP server. The code is mushed together from three samples:

  • DHTester from Ladyada
  • The ESP8266 BasicHttpClient (but using POST instead of GET)
  • The UdpNtpClient from the Ethernet library
I'm using GPIO 2 on the esp8266 to read the sensor. 

Sunday, March 13, 2016

PlatformIO, the Arduino IDE for programmers

The Arduino IDE is a great way to get started with embedded programming. It combines an editor, library manager, board manager, examples, programming tool and serial monitor all in one easy to install application.

As a programmer I'm used to my editor understanding the code and helping me out by suggesting what I might like to type next and showing me errors right in line with the code.

Here's PlatformIO in the Atom editor suggesting completions to Serial.


I also like the cool dark look.

PlatformIO is a set of command line tools that can be hooked in to various text editors but the easiest way to get started is to download the IDE they've made from the GitHub Atom editor here.

Although Arduino code is c++ the actual files aren't strictly c++ so a few changes need to be made to get some sketches ported over.

Typically you'll need to #import arduino.h and put a function declaration above where a function is first called.

(PlatformIO has the ability to import an Arduino sketch too).

Here's how Blink looks:

#include <Arduino.h>

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH); 
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off 
  delay(1000);              // wait for a second
}


To use external libraries you've imported into your Arduino environment you need to add the path to that library directory in the platformio.ini file.

; Here's the trick for finding Arduino libraries
[platformio]
lib_dir = ~/Documents/Arduino/Libraries

; Windows OS / "piolib-arduino" project
; [platformio]
; lib_dir = ~\Documents\Arduino\libraries


; Linux OS / "piolib-energia" project
; [platformio]
; lib_dir = ~/sketchbook/libraries

The environment  It supports more than 200 development boards along with more than 15 development platforms and 10 frameworks. It took me a while to find the esp8266 board I have, (search for board might be a good feature), but when chosen programming worked perfectly and it figured out the serial port automagically.

This looks like a great way to explore the Internet of Things.

Welcome to the Reddit community, there's an interesting thread here.

Installing on MacOS "just worked" but that's probably because I already have Xcode installed. On Linux I needed to install clang to get code completion going, but the IDE told me what was missing. I'm sorry I can't help Windows users.

Saturday, March 12, 2016

Minimal esp8266 board runner

I've been playing with the interesting esp8266 which can be programmed with the Arduino IDE and has built in Wifi capability. Today I made a little carrier board for just running the projects. My first time using Fritzing which is an amazing piece of software (although do save frequently).



The diode drops the 3.7 volts from the Lipo cell down to a safe 3.1V and all seems to work nicely.

WSPR via WSJTX on Raspberry Pi 3

My thanks to Ross, VK1UN, for the following instructions which allow the easy installation of WSJTX on a Raspberry Pi 3 (and earlier is no doubt fine too) running Rasparian.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 862549F9
sudo nano /etc/apt/sources.list

Add the following to the end of the sources.list file:

deb http://ppa.launchpad.net/ki7mt/wsjtx-next/ubuntu trusty main

Ctrl-X to save and exit.

sudo apt-get update # important
sudo apt-get install wsjtx

Then just run from the command line the first time to see any errors, after that run it from the Ham Radio applications menu.

I'm running a SignaLink USB interface and controlling an FT-817 via Hamlib. It correctly found the audio interface on first run.


Here it is sitting on top of the PC tower it has replaced.


Tuesday, March 08, 2016

ABC iview now on Apple TV 4

This might surprise my radio friends, but by day I'm a software developer. We've just finished a new version of ABC iview (only available in Australia) and I wrote some notes on the project here.


It's a real treat to work on software that gets used by large numbers of users and to read all the comment and criticism on social media. If you have the new Apple TV and live in Australia, we hope you'll try it out.

Sunday, March 06, 2016

Purchased toaster oven - not reviewed by Siracusa

We have a toaster and we have an oven, but we don't have a "toaster oven". Recently Phillipa has been producing a huge crop of home grown tomatoes and they beg to be sliced and have cheese melted over them, but the oven is so big it seems like a waste to grill things in it.

On Saturday, I slipped out and came back with this $59 beauty:



It has elements at the top and bottom. Here's the first result (after running it for a while to burn the plastic coating off the elements).




What's great about these little ovens is that they come up to temperature extremely quickly. Hilariously the instruction book includes recipes for roast pork and lamb.

When I posted a picture on Instagram of the new toy, several people asked if it was a model that had been reviewed by John Siracusa in his excellent series sponsored by Cards Against Humanity. Checking the list, it's not. I recommend this one so far though.