Mar 25

Temperature sensors using WeMos

After trying for a few months to get mysensors working on a Arduino mini pro with a NRF24L01+ I eventually gave up as the radio was too unstable. Works fine one day and next it loses communication. I tried all the tips and tricks to get these devices stable but had no luck. I now have a drawer full of them gathering dust.

There are loads of posts on various forums with various issues on the NRF24L01+

Next I tried a WeMOS D1 Mini Pro ย which has a built in ESP8266 wifi module. This works great. I’ve now got 6 temperature sensors running and have they have been stable for 2 months so far.


The WeMOS is dirty cheap. You can find them all over eBay for $3-$4 with free shipping. They are stable, coding on them is really easy and there are plenty of examples of code on GitHub.

Description:ย The D1 mini is a mini wifi board based on ESP-8266EX.


  • 11 digital input/output pins, all pins have interrupt/pwm/I2C/one-wire supported(exceptย D0)
  • 1 analog input(3.2V max input)
  • a Micro USB connection

The great thing is you can use the ArduinoIDE to program the WeMOS which makes it really simple.

I had a DS18B20 temperature sensor connected and up and running in no time.

To log the data I’ve setup Domotitz on a spare Raspberry Pi and the WeMOS sens the temperate to Domoticz via HTTP calls.


See my code on Github for my water sensor which words on the same principle as the temperature sensors.


Feb 05

ESP8266 + DS18B20 LUA code completed

This LUA code on the ESP works like a bomb – really simple and really stable.

The temperature sensors are connected directly to the ESP’s GPIO0 pin. This eliminates the need for an Arduino as all the work is done by the ESP.


Feb 01


After having struggled for many days with the instability of the ESP (I almost got some code going which read the DS18B20 sensors and upload the reads via the wifi, but the ESP kept resetting or returning unpredictable results) I did some more reading up and found these clever guys are now using the microcontroller on the ESP to do lots more things.


With NodeMcu firmware you can connect the DS18B20 sensors directly to the ESP and run LUA code. No more need for the Arduino and no more AT commands!!!

Check out this guys blog for how to flash the firmware.

You can also download this great GUI (ESPlorer) for sending LUA code to the ESP


A day later, no arduino, and I seem to have stable code uploading the results.

This is great! Time to order a few more of these modules!

Jan 12

ESP8266 Wifi Module

Came across this module while looking at how to connect the Arduino to the net. There are the quick and easy and expensive ways to do it, and then there is a ESP8266.

WiFi Serial Transceiver Module

This goes for around £3 on eBay so thought I’d get some of these and see if I can get it working with the Arduino.

There is a wealth of info on the net on these chips as it seems everyone is starting to use them now.

Thought I’d document my progress, hopefully it helps someone else out.

I have been messing around for a few days now and almost have something working. Its taken a while as there were quite a few issues. This module is still in the early days of development and there are a number of bugs with a few developers bringing out there own firmware.

Here is a list of useful sites I’ve been using:

First the module is powered by 3.3V. I connected it up to a USB to TTL cable and it kepts rebooting. After hours of trying to figure out the issue I found a web page in German which someone suggested setting the voltage to 3.4V. That worked perfectly – reboot loop fixed.

Commands working via the serial cable and module seems pretty stable.

Next problem I had was the the module comes with older firmware on where the baud rate is fixed at 115200. When using this with the Arduino Uno it seems to create problems as its too fast for the Software Serial.

First step – head over to electrodragon and grab v0.9.2.2 firmware and the flasher application. This was fairly straightforward. Flashed to newer firmware and set baud rate to 9600.

Now to get the Arduino to talk to the module – this is where the fun comes in. There are countless pieces of code out there and I think I”ve tried most of them without much success. A lot of programs just send the AT commands to the module without checking the response. I would like to read the repsonses and make the running of the code bullet proof.

The code here seems to almost do the trick. I can send commands to the module but most of the time I don’t get a proper reponse back (OK)

After some more reading and trying to figure out why things don’t work…..enter the level shifter.

Summed up very nicely here

Next I decided to build a quick level shifter using these diagrams

The 5V to 3.3V shifter worked great, but for some reason the 3.3V to 5V wasn’t working. Double, tripple checked everything – no go! ๐Ÿ™

Eventually I tried the 3.3V to 5V from

The labels are incorrect here – it should be ESP_TX, ARDUINO_RX

This worked perfectly – I can now send a command to the module and read the response back via the software serial. (Though code from the next still does not seem to work)

Next step is to either write the code from the ground up, or try and work out why other peoples code doesn’t work.

Going to be going this code: (ESP8266_Arduino_Uno_Hello_00.ino)

More to follow.

Sep 18

Raspberry Pi script to get cpu/memory/uptime/memory

From a few goole sources I put this script together to grab the cpu temperature, utilization, free memory and uptime from my raspberry pi weather station and write the results to my MySQL database.

I will use this data at some stage in my Weather Station project.

# Script to get Raspberry Pi temperate, cpu, memory, uptime and save data
# to mysql on suse.home. This will be used my the weather station web site system infomation

# Get temperature
temp=`/opt/vc/bin/vcgencmd measure_temp | cut -c 6-9`

# Get Uptime and convert to day h m s

To use the mysql client on the Pi you will need to first install it with:
sudo apt-get install mysql-client

Sep 11

Raspberry Pi weather station

A few months ago I started putting together a R-Pi weather station using:

After a corrupted Pi SD Card and loosing the backups I’ve decided to restart this and will document everything this time. Its taken about half a day to just work out what libraries I was using. ๐Ÿ™

Luckily I stored my code in Github

To start off download the latest version of Wheezy.

Update to the latest version.
apt-get update
apt-get upgrade

I came across this site to remove all the extra packages you dont need on the Pi (If you are not running GUI)

First setup the wireless dongle. I used a cheap RT5370 dongle from eBay which works great.

You will also need to install some libraries – took me ages to get it working at first. After this was installed it worked first time.
sudo apt-get install firmware-ralink

To get the BMP085 working via i2c, there are some setup steps that need to be performed.
I2C Installation for Raspberry Pi โ€“ Step by Step Guide

Also to read the MCP3008 chip there are some additional steps that need to be done. A script needs to run at startup.

The R-Pi collects all the data from the sensors and writes it to a MySQL database running on a internal server. I’m busy working on the php code for the weather front end so its a work in progress.

Sep 08

Netware 3.12 on the Raspberry Pi

After successfully booting Windws 1.01 – 95 on the Pi, for the next feat I decided to try and get Netware 3.12 booting.

This proved a challenge and took quite a few hours to get working. Initially I used the same method I did for the booting of Windows but when trying to get Netware running there were loads of abend issues when mounting the SYS volume.

The install was successful on Virtualbox but I ran into problems with the ATA driver – when using this and mounting the SYS volume there were disk errors would I tried to repair with vrepair but they just kept returning.

After reading through How To: install Novell Netware 3.x on VMware I decided to try loading the latest patches.

Update Netware 3.12

A good few hours later with the system patched I then used the IDEATA driver instead of the ATA driver and now the SYS volume was successfully mounted in VirtualBox!!!

I then copied over the vdi file to the Pi and ran under qemu.

Abends when the SYS volume was mounted! Agghh!!!

After retrying with the latest qemu (1.1.2) which still gave issues I then decided to give bochs a bash
Bochs is another open source emulator which luckily is already package so no need to compile. The latest version I used was 2.4.6-5

apt-get install bochs

A few more hours later after figuring out how bochs works – you need a .bochsrc file.

This site was helpful for the config of bochs.

Here’s what mine looks like:

romimage: file=/usr/share/bochs/BIOS-bochs-latest
display_library: sdl
log: bochsout.txt
ata0-master: type=disk, path=”netware.vdi”, mode=flat, cylinders=243, heads=16, spt=63
ata0-slave: type=cdrom, path=”Installation.img”, status=inserted
floppya: 1_44=”Disk1.img”, status=inserted
boot: disk

I then tried to run the vdi file with bochs….only to find out bochs doesn’t support vdi files. Luckily there is a VirtualBox tool that lets you convert the file to .img

vboxmanage clonehd source.vdi destination.img --format RAW

Changed the .bochrs file to
ata0-master: type=disk, path="netware.img", mode=flat, cylinders=243, heads=16, spt=63

Started bochs and waited a few mins….and what do you know. SYS vol mounted and Netware 3.12 booting!!!

Bochs seems a lot slower than qemu but as least its working (Takes about 8 mins to startup Netware)

I did some editing on the video and speeded some parts up.

Jump forward to see the Netware snake – should bring back some good memories for some.

Sep 08

Windows emulation on the Pi

After reading a few posts on the RaspBerry Pi forums from users who have gotten Win95 working on the R-Pi I decided to give it go and see if I could run Windows from v1.0 to 95.

Windows runs on the R-Pi via qemu but its really slow. This is really just to show that it can be done – its hardly usable though, especially Windows 95.

There are lots of helpful threads on getting this to work. I started off reading this one:

Win95 on the Pi

I also wanted to remote to my R-Pi via Xming which is really easy to do:
Xming to the Pi

My first attempt to get Win95 booting proved tricky but I eventually got it working with Qemu and a older version of Wheezy. For some reason Win95 kept crashing with the latest version of Wheezy

Here are the steps I used to get Windows 95 booting:


Expands FS

Do a apt-get update and apt-get upgrade

Windows 95 only successfully boots with Qemu 0.15.50. To install this you need to download from source and compile

Download older version of Qemuwget

Install libsdl sudo apt-get install libsdl1.2-dev

tar -xvf qemu-git.tar.bz2

cd qemu

./configure --target-list=i386-softmmu --enable-sdl --extra-cflags="-O3 -mfloat-abi=hard -mfpu=vfp -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk"


After a few mins you will some errors – you will need to edit 2 files to get rid of these errors:

Edit qemu/tcg/arm/tcg-target.c and qemu\tcg\i386\tcg-target.c

Search for: static void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)

And replace with:

static inline void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)

Run make and make installl which should now complete. It took around 15 mins to compile on my Pi.

Now that you qemu built, copy the Windows 95 img file to the Pi and run qemu win95.img -m 64

After successfully running Windows 95 I decided to try out Windows 1.01, 2.1, 2.11, Windows for Workgroups 3.1

All successfully booted and running on the Pi

I found the best way to create the images is to install VirtualBox and then setup Windows. Once you have it working copy over the vdi file to the R-Pi which you can then run with qemu.

Windows 1.01

Windows 2.1

Windows 2.11

Windows for Workgroups 3.1

Windows 95

Aug 14

MyFitnessPal weight importer

I wrote this php script as MyFitnesspal does not have the functionality available to import a historical list of weight/body fat values.

After looking at the http post values I came up with a script to read a file and post the values to the MFP site.

In order to upload the data you need to provide your MFP credentials, the script then logs onto MFP and creates a drop down options box based on your settings in MFP.

You will then need to provide a text file containing the data and weight (or Body fat, or what ever you want to import)


dd/mm/yyyy 123.1

The data will also need to be tab delimited with no blank line of the last line of the scipt. The data will then be uploaded to MFP – it took a good few mins to upload about 2 years of my data so just be patient. Not sure if this is a limitation on the MFP side.

One problem I have noticed is that the first and last values uploaded always contain the wrong vlaue. I will need to fix this up but please we aware of this.

The script also does not check if the data already exists – I’m not sure what would happen. Haven’t tested it.

There are bound to be a few bugs in this. Let me know if you find any. I’ve uploaded 4 years of weight values and it seems to have been uploaded successfully.

After the script has finished the uploaded file and cookies are delete. No personal data is stored on the server.

Update: Busy relooking at my code. Seems MFP has changed something and it no longer works ๐Ÿ™

Nov 27

Setting up web based/client less SSH for the Raspberry-Pi

I had a spare Raspberry Pi lying around so though I would see if I would get a web based SSH session going for the raspberry pi, as well as setting up SSL using a free 1 year SSL cert from StartSSL

It was surprisingly simple.

After searching around I came across GateOne which gets some good reviews and seemed easy to setup.

First to setup SSL you will need to have a FQDN that points to your Pi. There are loads of free sites out there that allow you to do this, for this example we will assume we have setup which points to the IP address of the Pi (You will need to setup port forwarding if you are doing this on your home broadband router)

You could also skip the below step and use the self-signed cert that is automatically generated, but I’m not a fan of self signed certs on the internet. For your own home use on a LAN fine, but its its internet facing then generate a proper cert. I googled a bit and found that StartSSL offer free 1-year certs.

You will need to generate a keyfile using:
openssl genrsa -out 2048

This generates a 2048 bit keyfile for

The below will generate a CSR file (after completing a few questions):
openssl req -new -key -out

The csr file then needs to be uploaded to the CA, and they will validate it and then give you a PEM encoded certificate.

Both of these files ( and need to be saved to

Now onto configuring GateOne. Connect to your Pi and download the master file from Github:

Extract on the R-Pi using

Once unzipped run ./
This will generate a conf file for you under conf.d/10server.conf

I changed the following lines:

"certificate": "/home/pi/GateOne-master/ssl/",
"keyfile": "/home/pi/GateOne-master/ssl/",
"origins": [""],
"port": 443,

Run ./
and with a bit of luck you should be able to open up a browser and browse to


GateOne - SSH Session

Once connected to the Pi, i can then SSH to all my other Linux servers….mwaaa haaaa haaaa! ๐Ÿ™‚

I still need to setup to start automatically but that should be easy enough.
A quick search shows a few sites on how to do it:

Older posts «