To program the Wemos D1 Mini NodeMcu via Arduino development environment on the NanoPi do the following:
# download newest Linux Arm version from https://www.arduino.cc/en/Main/Software
tar -xf arduino-1.8.0-linuxarm.tar.xz
# ignore the error messages, arduino can be found in the Development menu or on desktop
# open File-Preferences and add http://arduino.esp8266.com/stable/package_esp8266com_index.json to Additional Boards Manager URLs
# open Tools->Board:xxx->Boards Manager select esp8266 and press install
# open Tools->Board:xxx and select Wemos D1 mini
# insert board into USB port and select under Tools->Port "/dev/ttyUSB0"
sudo chmod a+rw /dev/ttyUSB0
For further information see https://github.com/esp8266/Arduino , ESP8266 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
There is a nice housing available for the NanoPi M1 at friendlyarm.
To fix the NanoPi into the housing you need M3x10mm spacers and 4 screws M3x6mm and 4 screws M3x10mm. If you do not have spacers you can print it with a 3D printer. The .stl file is here. Or you can buy them here.
All in one security solution for your home
Autonomous security for your homy house.
- 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.
* Wemos D1 mini pin mapping or use Dx directly for pin
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/188.8.131.52/ and in a CMD shell we have to run:
com2tcp.exe --baud 115200 --ignore-dsr --telnet \\.\COM46 [your ESP's IP] 80
To set up the tunnel in Linux just install socat:
sudo apt-get install socat
sudo socat pty,link=/dev/ttySx tcp:[your ESP's IP]:80
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 this case line 5 and 11 are too long
In such a case break the lines into smaller ones and it will work.