GitHub: https://github.com/debsahu/TheButton Things we want to achieve: Low on power consumtion: ESP8266 is OFF when the button is not pressed debsahu/ESP_External_Interrupt Portable: Uses 18650 battery, lasts years Talks to Home Assistant: debsahu/HARestAPI
Let’s build a security camera using Raspberry Pi Zero W and Movidius Neural Compute Stick to recognize a “person” on the video stream PiCamMovidius Set up NCSDK API Install required packages on Pi sudo apt-get install -y libusb-1.0-0-dev libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev git automake byacc lsb-release cmake libgflags-dev libgoogle-glog-dev liblmdb-dev swig3.0 graphviz libxslt-dev libxml2-dev gfortran python3-dev python-pip python3-pip python3-setuptools python3-markdown python3-pillow python3-yaml python3-pygraphviz python3-h5py python3-nose python3-lxml python3-matplotlib python3-numpy python3-protobuf python3-dateutil python3-skimage python3-scipy python3-six python3-networkx python3-tk libboost-python-dev Clone NCSDK cd ~ git clone https://github.com/movidius/ncsdk Compile and install NCSDK’s API framework cd ~/ncsdk/api/src make sudo make install Test installation using sample code from NC App Zoo cd ~ git clone https://github.com/movidius/ncappzoo cd ncappzoo/apps/hello_ncs_py python3 hello_ncs.py Output should look something like this: Hello NCS! Device opened normally. Goodbye NCS! Device closed normally. NCS device working. Install Paho-MQTT Use pip3 to install Paho-MQTT pip3 install paho-mqtt sudo pip3 install paho-mqtt Using these examples Clone this code cd ~ git clone https://github.com/debsahu/PiCamMovidius Native MobileSSD Enter into following directory cd ~/PiCamMovidius/native/picam Edit picam.py with appropiate MQTT server IP, port and topic and run python script python3 picam.py OpenCV 3.2 YoLoV2 Install pre-compiled OpenCV 3.2 Add to apt-source list echo ‘deb [trusted=yes] http://dl.bintray.com/yoursunny/PiZero stretch-backports main’ | sudo tee /etc/apt/sources.list.d/bintray-yoursunny-PiZero.list Update apt sudo apt update Install OpenCV sudo apt install python3-opencv Verify Install python3 -c ‘import cv2; print(cv2.__version__)’ Enable V4L driver sudo modprobe bcm2835-v4l2 Enter into following directory cd ~/PiCamMovidius/ocv3 make Edit picam.py with appropiate MQTT server IP, port and topic and run python script python3 picam.py
Here is a naive attempt at predicting a particular stock’s price and displaying it on a ESP8266. This algorithm is not the best one out there, but what is being shown here is the ability to port it elsewhere and easily integrate these complex models with micro-controllers (ESP8266) and other devices. GitHub: https://github.com/debsahu/StockPredictionPython Install MATLAB 2017a Runtime v9.2 from here Goto Python/matlab_stock_python_lib folder and install “stock” python library using `python setup.py install` Use “requirements.txt” file to install required libraries. Console: “$ pip -r install requirements.txt” Enter appropriate values for MQTT server in “upload_stock_pred.py” and run “python upload_stock_pred.py” Upload Arduino files on your esp8266 using Arduino IDE
Idea: Did you ever want to use ESP8266 to communicate to Home Assistant directly? Implementation: Here we use a color sensor to read colors and change a RGB light in Home Assistant to the color observed. Arduino Code: Link RGB Lights connected to Home Assistant McLighting: https://github.com/toblum/McLighting
Idea: If there is smoke, smoke alarm detects it ESP8266 detects this digital signal from smoke detector, connects to WiFi and sends data to a MQTT server Esp8266 turns itself OFF Implementation: Try to find where on the smoke detector is the 3.3V digital signal when it detects smoke Lets look at Kiddie RF-SM-DC Third pin from top corner seems to send out 3.3V signal to speaker when it detects smoke Lets connect our previously created ESP8266 circuit that wakes from external interrupt. Configure Home Assistant to process MQTT message and send notifications. Source code for this idea can be found on my GitHub: https://github.com/debsahu/Internet_Fire_Alarm
Let’s say that you don’t have your smartphone around and someone mentions you on twitter. Wouldn’t it be nice to have a display that automatically reads your twitter mentions and show it on a scrolling display? So let’s build a internet controlled (IoT) dot-matrix display that does this for us using an ESP8266. The plan to accomplish this is as follows: Someone mentions us on twitter (in my case @debsahu) IF This Then That (IFTTT) tracks these mentions and posts this data on Adafruit.io (MQTT Broker) An ESP8266 connects to Adafruit.io and shows this data on a Dot-Matrix display We can’t control who mentions us on twitter, so we move to the second step in our plan to configure IFTTT and Adafruit.io. To setup a data feed (MQTT topic) on Adafruit.io, Goto “feed” and “Create New Feed” Provide a unique name for the feed like “twitter-calls”, this means the MQTT topic that we need to subscribe to is “feed/twitter-calls” To setup IFTTT to connect to twitter and Adafruit.io, Connect your twitter and Adafruit.io account to IFTTT by logging in and giving proper permissions Create a new applet For “this“: Select “twitter” and “New mention of you” For “that“: Select “Adafruit” and “Send data to Adafruit.io”. Remember to select the correct topic created above and a message template using ingredients that suits your need. As a part of the third step in our plan, we need to subscribe to our MQTT topic and display this data on a Dot-Matrix display. Hardware Wemos D1 mini (ESP8266) link Max7219 Dot Matrix Display here Software Setup Arduino IDE to be able to program an ESP8266 (Instructions on how to do this is here as well as in the video below). Install Adafruit_MQTT and MAX7219 Dot-Matrix display libraries Upload the code found here on your ESP8266 Make these following connections between Max 7219 display and Wemos D1: VCC -> 5V GND -> GND DIN -> D7 CS -> D8 CLK -> D5 That’s it, now you should be able to see your latest twitter mentions on your Dot-Matrix displays.
Building electronics is one of my hobbies and I have in the recent year developed this skill to a point that I can help inspire others to make these things that make our day to day activities easier. Activities as simple as turning on and off lights using the internet (or using voice via siri/alexa/google voice) will help save energy and make our lives more easy aka… automated. My MCU of choice will be ESP8266 which costs as low as $3 which operates at 80 MHz, equipped with WiFi and up to 8 GPIO pins. I own a few NodeMCU v1.0 and Wemos D1 mini that I will use for almost all of my projects. I have a tons of ESP8266 (micro-processors with WiFi capability), relays, displays, motion sensors, led strips etc that I can assemble to make a functional product. There will be two aspects to this, Hardware building encompassing soldering and planning circuits Software (Arduino IDE) to take care of all this hardware functioning properly. I will spare some time and build one product at a time, documenting it by videos and post the details over here. Some project examples will be something in the lines of internet controlled light switch or motion sensor based home automation or home security using laser trap or animations on a LED strip etc.