Archive for the Embedded Category

Pump up the volume

Posted in C.H.I.P., Embedded, Linux on July 22, 2017 by asteriondaedalus

So Target had finally dropped prices of sound bars with aux input to AUS$49 so I can deal with the wife’s nagging about the BOSE wifi sound system with a $9 C.H.I.P. and a $49 sound bar.



Perfect for the bedhead in the main bedroom and the window sill in the guest bedroom or in the book case in the wife’s study.

I only bought two as we had the speaker tower in the backroom.

Now, given all the problems I had with debian server distro and the OPiZ, here I am using nmcli to setup the static IP for the wifi on the C.H.I.P. with no problems.

Given I had the 3-pin serial cable out, I just swapped it over to the C.H.I.P. from the OPiZ.

I flashed with the headless server version 4.4 of for the C.H.I.P..

I used nmcli to setup the wifi using the provided example.

I then used “sudo nmtui” and setup the static ip and then reboot.

I found the device on my gateway list of wifi devices … bute!

To install shairpoint-sync I simply followed the instructions at Hackster.

The trick is where the instruction asks for interpolation to be set to soxr I reset it back to basic.  I also set the alsa property:

audio_backend_buffer_desired_length_in_seconds = 0.5 (it was set to 0.15).

I did this because the audio would drop out briefly.  Evidence is the soxr interpolation takes a grunting cpu and there might have been some network problems.  So, between relaxing the interpolation and buffering more audio, the dropping of audio apparently has ceased – much to Madam’s delight.

The nuisance, the wife has given up her iPhone for a Samsung S8 – which she doesn’t like.

I found you can get Airplay running on Android so we could get by.  I bought her a new laptop but she hasn’t moved her iTunes to that yet.

She hasn’t installed iTunes on the PC that I built her.  iTunes is on her old laptop so there are some politics there to get that transferred – especially as I have my eye on her old laptop to be my 64bit Debian dev box.

So while the Airplay route is “comfortable” it is rather “complicated”.

However, she has an iPad that she now hardly if ever uses so it can be the server for the house music.

Too easy drill sergeant!

Too easy, that is, because even though I am using a debian based distro on the C.H.I.P., and essentially using the same tools to set up the C.H.I.P. as I was the OPiZ, I am having no problems with C.H.I.P. headless server.


Oh … yes, if she asks BOSE was bought out by Thompson.



Wow, that turned out to be simple

Posted in Embedded, node-red, OpenSprinklette, Orange Pi, The downside of Opensource on June 13, 2017 by asteriondaedalus

So voila!


This doesn’t look like much but it made my teeth grate for the longest time.

The problem was setting up node-red on the OPiZ (and indeed the ODROID-C1) I could not use the google calendar as planned, for setting sprinklers on/off, because the embedded machine’s IP would not resolve to the domain name “”.

Turns out I had the right idea, I just set the IP address incorrectly in my hosts file on my PC.

The problem was fixed by setting the c:\Windows\System32\Drivers\etc\hosts on my PC with the correct IP address of the OPiZ (I noted I had shrapnel there from the ODROID-C1 attempts and realised I had a 178 in place of 168 in the IP preamble).

The figure above shows now browsing from the PC into the OPiZ which is running node-red.

What you are seeing is a response from a google calendar I set up (to ping the node-red server when an event start occurred).   My heart stopped a little when the google api exception popped up (though that itself told me we were talking).  The start event I set came through regardless (so it must have resolve the lists in the background in any event).  The strange problem being that there is a time sync problem between what my computer says is the time and the calendar.  I can get events from calendar two minutes early according to my computer.  Likely source is whatever “clock” google calendar is running to (it reports the correct time from perspective of the calendar).  Something to track down.

Not the best solution, setting up a hosts files on every machine in the house is doable but there has to be a smarter way?

Now I have to muddle through the emqtt install again.  The problem there ended up none of the examples for starting the emqtt as a service worked for the armbian distro.

It occurred …

Posted in Erlang, Embedded, ODROID is wonderful, OpenSprinklette on December 5, 2016 by asteriondaedalus

… that after all the fluffing around with TTB on the inherited RaspingBreathBurryDOodlePi, I did rather prefer my mix I built originally on one of my ODROID-W.

Still, now I have got the additional ODROID-C1 it makes more sense for use as the house automation server.

The reason is that there is a UPS module that I can get from HardKernel that will help with survival requirements (given the blackouts we occasionally get in sleepy little Adelaide).

I do rather like the 7″ touch display you can get for the C1 as well.  Although, that isn’t strictly necessary since we will browse into the node-red running on it.


Erlang on C.H.I.P.

Posted in Embedded, Erlang on July 30, 2016 by asteriondaedalus

Well, with github and down (for some dangblasted reason) I tried building Erlang on one of my C.H.I.P. from instructions here (for RaspbreathyPiklette).


Sorta stuck after that as … github is down.  Git can’t find it, ping can’t browser can’t.  The site reports up and running but still can’t connect.


Connecting NodeMCU to a NTP server

Posted in Embedded, Lua, NodeMCU on July 4, 2016 by asteriondaedalus

Ignore the IP suggested in example.

Search google for “NTP server”.

Being Australian I am using one from the pool listed at:

Code therefore becomes:


   print('setting time to:', sec, usec, "from: " .. server)
   rtctime.set(sec, usec)
   sec, usec = rtctime.get()
   print('time set to: ', sec, usec)


The difference between times that you will see, when running this gem, is in and around 7 milliseconds which is the cost from function calls is all.

The idea would be to use a timer, set to max time and auto mode to run this occasionally to keep the time on the node synced with your local world.  That is:

tmr.register(6, 6870947, tmr.ALARM_AUTO, sntp.sync(...)) -- see above code

You might like to set a flag if the sync fails, or publish a mqtt alarm, or something more useful as the print will be lost on the world since we are deploying nodes in the real-world sans terminals.  Although consider loss of sync might also be loss of wifi access and so likely loss of communications with your mqtt server – so devilishly complicated this will all be.



Differences between WeMOS and UNO pin numbering

Posted in Embedded, ESP8266, IOT, Lua, OpenSprinklette on June 29, 2016 by asteriondaedalus

The table below shows the mapping between the UNO pins, the pins on generic 4 relay shields, the ESP8266, and the WeMOS UNO clone for you info.

UNO Relay on Shield ESP8266 IO Index ESP8266 Pin WeMOS IOL/IOL1
PD4 4 2 GPIO4 D2
PD5 3 3 GPIO0 D3
PD6 2 4 GPIO2 D4
PD7 1 5 GPIO14 D5



Posted in Embedded, ESP8266, IOT, Lua, MQTT, Networking on June 29, 2016 by asteriondaedalus

So, just got delivery of my 5 WeMOS uno clones …


arduino killer

… and 5 …

5v 4 Channel Relay Shield Module For Arduino

… we are now ready for OpenSprinklette!  All up AUS$11.00.  Only four channels but add a second unit for sum total of AUS$22.00!

So, a little work as we need to convert the 12volt AC to DC, should work a treat as the WeMOS board is happy to take 9-24V and also provides the 5V the relay board needs (apparently the 3.3V outputs should be okay *whimper*).

Now, since the “leak” (and the $3K water bill for the quarter) I will fit flow sensors to ensure flow is within expected range – so the unit can raise alarms.  Got 4 from Aliexpress for US$12 (or US$3 per sensor) which is better than the AUS$15 per sensor LittleBird is pinging people for similar devices.  Just needs a 3.3V zener and a 220 ohm resistor to adapt the 5V output of the sensor to the 3.3V inputs on the WeMOS.  Will build that onto a protoshield. (Anyone know what the connector type is from the photo below?)


The NodeMCU provides NTP so I can run timers on WeMOS.  MQTT to the ODROID-W server (in the house) to pick up the watering times, weather off internet to decide upon whether or not to water etc.

A second two will be used for remote control of back and front yard lighting.  So remote ON/OFF and IR triggered to boot.