Installing Arduino on NanoPi

To program the Wemos D1 Mini NodeMcu via Arduino development environment on the NanoPi do the following:

For further information see https://github.com/esp8266/ArduinoESP8266 Arduino documentation or Arduino language reference

The following libraries for sensors I use (Sketch->Include library->Manage Libraries):

Adafruit DHT-sensor-library Version 1.2.2
Adafruit_MQTT_Library Version 0.16.2

For adding a Filesystem to the ESP8266 see uploading-files-to-file-system

 

The autohomy security milestone

All in one security solution for your home

Autonomous security for your homy house.

Technical Details:

  • smoke detector for fire alarm
  • 12V/5A LED Strip driver for light control
  • motion detection PIR sensor for light control and intruder detection
  • 85dB acustic alarm
  • temperatur sensor for heating control and fire alarm
  • humidity sensor

Schematics for interfacing the smoke detector with the NodeMcu

K1-3 … NodeMcu GPIO output alarm
K1-2 … NodeMcu GND
K1-1 … NodeMcu GPIO input smoke detected

K2-3 … Smoke detector test switch 12V
K2-2 … Smoke detector test switch GND
K2-1 … Smoke detector red buzzer cable

Picture of the enhanced alarm board

Schematics for interfacing the LED strip with the NodeMcu

Picture of the Mosfet

Picture of the DHT11

Picture of the DC/DC converter 12V to 5V

Picture of all

Attention! When programming the Wemos D1 mini via USB port, it is necessary to have the 12V power supply attached to the system. Otherwise the 5V from the USB port will burn the fire alarm chip! Really crazy but found not solution, yet.

 

Pin Mapping

Updating code via webserver

To update the code via the webserver, you need to install a virtual COM port to TCP driver.

On a windows system you can download com0com from https://sourceforge.net/projects/com0com/ , a virtual Nullmodem cable.
Start setup.exe and 4 COM ports will be installed we need the one beginning with COM (e.g. COM46 and COM47).
Then we need com2tcp from https://sourceforge.net/projects/com0com/files/com2tcp/1.3.0.0/ and in a CMD shell we have to run:

To set up the tunnel in Linux just install socat:

Downloading the code:

First we have to display the webpage of the node via a webbrowser. Then we turn telnet mode on by pressing the button “Turn telnet mode on”. After that we can start com2tcp like above.
Via Esplorer we open the virtual com port 47 and set in the Esplorer settings the “dumb mode”.
Then open the file you want to update and send it by pressing the button “Save to ESP” to the node. You can work with Esplorer like you are connected via the serial port, with the only exception that button “Upload” is not working, use the button “Save to ESP” instead.

Sometimes “Save to ESP” has a problem with long lines, you can see it in Esplorers output window:

In such a case break the lines into smaller ones and it will work.