Some interesting PROJECTS

Fun and satisfaction: Learning, Curiosity, Tinkering, and Making it work:

Mainly technology projects, some of the more recent tinkerings.

Started "eons" ago with microprocessors and coding in machine language; went through Basic, VBA, C++, Python, Processing, Squirrel, Java Scripts and now with graphical Flow languages like Node-Red with Java scriptings making things so so much easier...  

"Hey Google turn on my light": Multiple locations, anywhere!

A few years ago, I had Google turn on and off my lights with voice commands. The platform used were  Google Assistant, IFTTT and Wemo switches, it was relatively easy as IFTTT have a service for Wemo. This works great for one location or house (instance), but it is a pain if you have more that one instances,  as Wemo does not cater for two locations, which means that at your holiday home you have to set up another instance with a separate phone.

To facilitate control of two locations, I decided to drop the Wemo switches, and redesign the switches with the esp8266 wifi modules. The commands were received via MQTT, starting with Arduino sketches using the PubSub library, however the Espeasy platform is much easier for rapid prototype and it also support OTA, and is what I am using now.

On the publishing side (control), any platform or programing that support MQTT like Node Red, OpenHab (with MQTT bindings), etc can control the esp8266 publishing the right Topic.

To get google assistant to trigger the esp8266 with MQTT however, we need to bind the MQTT with Google assistant. IFTTT does not provide a generic service for MQTT, but does for Adafruit service (io.adafruit.com). You have to do some tinkering and the topics also need to bind with adafruit channels settings for this to work.

Get in touch if you want technical details. note: espeasy GIT version: mega-20180625

=============================

Alexa "turn on switch one"

By using Node-Red, interfacing Alexa is easy as there is an Alexa node in nodered. You can use the node to call api with http rest request or IFTT or Mqtt or Adafruit.io.


============================

"Trying the Witty Cloud dev board"

Had a play with the witty cloud dev board. Basically a Wemos with inbuilt usb programmer, rgb neo pix led, ldr on a0, and a push button. The usb programmer can be separated.

With no extra hardware and some simple rules programming, got it to turn on the green led on low light level in less than 5 mins. Note that it does not fit 5 holes breadboards.

Pins and gpios:

  • GPIO#2 controls the tiny blue LED next to the WiFi antenna. 1= off , and 0= turns on the LED.
  • GPIO#15 controls red LED.
  • GPIO#12 controls green  LED.
  • GPIO#13 controls blue LED
  • The push button is connected to gpio0

https://www.faranux.com/product/witty-cloud-board/

  • ======================


"Control and interface air conditioner or any IR appliances with Arduino"

After some code debug, managed to turn on my heater via an IR led connected to the Arduino.  First have to decode the remote signal with and IR receiver. The protocol seems to be NEC.  Below is the basic command code to send to IR led:

irsend.sendNEC (0xFE18E7, 32)

I have used 220ohms resistor in series with the IR led to limit the current to the arduino pin, and because of this the range is not as far as I expected. Will try a FET driver to see the range increased.







"A consistent cup of Tea"

Always after a consistent cup of tea or coffee exactly way you like it?
While "dunking" my tea bag, thought I make a tea/coffee maker to do the work.
Just got my Arduino 1 Sheeld and hooked it to an Arduino uno, designed a simple programme to response to a button press in the smart phone and move a servo to "dunk" the tea bag for a programmable number of times to produce a consistent cup of tea. A precision ds18b20 one wire temperature sensor senses the water temperature and start the flow sequence. Another innovation is the use of magnets to adjust height of servo to cater for different size cups. Works good.

===============================

"Connecting Raspberry Pi and Arduino using Firmata and Node Red"

One of the deficit with Pi is the lack of analog input ports, so why not combine the Pi with Arduino?

After researching the various methods, I used Firmata firmware on Arduino and node red on the Pi, loaded the Arduino nodes and is working a treat and connection is via usb port. Currently a ds18b20 is hooked up to Arduino connected to the Pi and sending data to Thingspeak and node red UI. A slider controls a servo motor connected to the Arduino via the Pi. I have access to both the io ports of both the Pi and Arduino now.

==================================

"Use of SendToHTTP in espeasy"

A powerful command in the espeasy's rule scripting is the SendToHTTP command. This command allows for API calls via http request. I tried it with ifttt and got it working after finding a bug in release mega-20180722 which have some parsing issues and had informed espeasy. This was fixed in the next release.

My script below:
Usecase: pir sensors to activate sonoff. 
Sonoff rule script (create event toggle):
on toggle do
gpio,12,1
delay 3000
else
gpio,12,0
endif
endon

pir sensor trigger point:
on pir#pir1=1 do
SendToHTTP 192.168.20.102,80,/control?cmd=Event,toggle
gpio,2,0
delay 3000
gpio,2,1
endon

One could then have multiple pir trigger points to send http api requests.

Using Adafruit.oi as a mqtt bridge:

Adafruit.io can be use a s a mqtt broker, the advantage being that it can be invoked with ifttt as well as node red. For control systems that do not have direct mqtt interfaces but have ifttt or nodered like Alexa, than Adafruit and be use as a bridge to mqttt. 

==========================

"Wifi Environmental Nodes (IoT)"

Designing IoT environment nodes is made a lot easier nowadays with the MCU esp8266 development boards. The concept is to have multiple nodes publishing environmental data and we can monitor them anytime and can set trigger points to automatically turn on heatpumps etc. The heatpump could be turned on or off with  Broadlink IR controllers. I settled on the esp8266 Wemos. I started off coding in Arduino c++, but settled on espeasy with OTA config programming. With the low costs of oled displays and sensors, it is now practical for multiple environmental nodes all accessible by wifi with payload published to various platforms.
Basically each node publish a unique topic with payload of temperature, altitude, humidity or pressure depending on sensors used (the ip addr is displayed for easy OTA access). Sensors: ds18b20, dht11, i2c sensors.
I publish the payload data via MQTT for access by Node Red or OpenHub, and also to MATLAB Analytics (Thingspeak) which can plot the data over time and provide a basic database.

note on oled to display frm http request:

HTTP request is of the following form:

https://<ESP IP address>/control?cmd=oled,<row>,<col>,<text>

  • row : line
  • col : column where display text
  • text : text to display


============================

"Using rules with espeasy"

Simple use of rules and setup for sonoff flashed with espeasy. This turns the sonoff on for 3 sec on pressing the inbuilt switch button and turns light on at 630pm and off at 10.30pm.

With rules, Espeasy is very versatile, example my setup with sonoff internal push button on gpio0.


==============================

Command Communications with espeasy:

Commands can be sent to espeasy via:

1. The tools in the esp gui webpage; just enter the cmd, e.g gpio,12,1 or 7dn,88

2. Browser (http get); type https://192.168.20.112/control?cmd=*******, in a web browser, eg https://192.168.20.112/control?cmd=7dn,88

3. Node red or any platform that can perform a http get request:
e.g https://192.168.20.112/control?cmd=7dn,88

4.MQTT

topic:/kkwemos03/cmd

payload: eg 7dn,888

topic: <MQTT subscribe template>/cmd
example: /ESP_EASY/cmdpayload: <command syntax>
example: GPIO,12,1More commands:
https://www.letscontrolit.com/wiki/index.php/GPIO
https://www.letscontrolit.com/wiki/inde ... _Reference