Archive for the Embedded Category

It occurred …

Posted in Embedded, Erlang, 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 nerves-project.org down (for some dangblasted reason) I tried building Erlang on one of my C.H.I.P. from instructions here (for RaspbreathyPiklette).

CHIPerl

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:

http://www.pool.ntp.org/zone/au

Code therefore becomes:

sntp.sync("0.au.pool.ntp.org",

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

 function()
   print('failed!')
 end
)

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

 

OpenSprinklette

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?)

flow

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.

 

Why?

Posted in Embedded on June 26, 2015 by asteriondaedalus

Death to Electric IMP~!

Why? Aus$60 versus AUS$3.16 for ESP8266 or AUS$9.42 for NodeMCU.

The development tools for IMP are cute but once you are past NEWBEE who cares … really.

 

Extra Sensory Perception?

Posted in Embedded, Hardware, Networking, Wifi on May 12, 2015 by asteriondaedalus

What ever it is, the ESP 8226 has read my mind.  Including being able to run LUA and so include MQTT and also things like Actors, CSP, FSM.

esp

 

Especially with NodeMCU on board.

NodeMCU

 

Now with ESP 8226+NodeMCU+MQTT, don’t forget Node-Red.

For my MQTT broker I am using, of course, emqttd as it is erlang based.

For connecting from python on PC, Raspberry Pirate, Beaglebone Black, one needs paho-mqtt.  MQTT has topic much like ROS does … hmm … more reason not to need ROS broker.

In any event … get it … event … never mind, on Android one can use MyMQTT to hook into broker to push and subscribe as a test tool.