In this post, we learn how to interface GPIO pins with ESPHome and home assistant. We start by looking at different input configurations, we then learn about debouncing and finally, we learn about different output configurations.
Step 1: Watch the Video
The video above covers everything you need to get started with using GPIO pins. We look at different configurations and carry out different tests which is best explained through a video.
Step 2: Wire Up & Test
Use the reference diagram above to wire up the circuit if you plan on testing it.
After getting an understanding of how IR sensors work, we now learn about ultrasonic sensors. These have a much higher detection range and can be used for various purposes – from simple object detection to mapping surroundings. This post gives you all the information you need to know in order to use them and we also test it out by writing a demo Arduino sketch.
Step 1: Watch the Video
Since this is mainly a tutorial video, I’d recommend that you watch the video above to get a better understanding of using the ultrasonic sensor.
Step 2: Wire The Sensor
Connecting the sensor to the Arduino is extremely straight forward. Make sure you use a 5V Arduino board and connect it as shown in the reference wiring diagram above.
Step 3: Download The Sketch
You can download the demo sketch using the link below.
The video above gives you all the information you need to build this yourself. This post will only provide the final configuration file that can be used as a starting point.
Step 2: Wire the LEDs
You can use the reference wiring diagram above to connect the LEDs. Please note that you need to use the RX pin, which is also the GPIO3 pin. This is needed as the DMA data transfer defaults to GPIO3.
Step 3: Configuration File
You can use the following link to obtain the configuration lines that need to be added to your ESPHome node:
We continue our robotics adventures by making use of the theory that we learnt last week and building a simple 2WD rover using an Arduino.
Step 1: Watch The Video
The video above goes over everything you need to build this simple rover. This post will only provide the wiring diagram and sketch for you to use.
Step 2: Wire Up The Rover
You can use the wiring diagram above to connect everything together. Keep in mind that you may have to swap the motor wires if the motor rotates in the opposite direction. Please watch the video to learn more.
Step 3: Upload The Sketch
The Arduino Nano needs to be programmed in order for the rover to function. I have written a simple motor/rover driver library that can be used for your projects. You can download the library along with a demo file using the link below:
In this post, we learn how to use InfluxDB for long term sensor data storage and we use Grafana for data analysis. This is part of the home automation series where we learn how to set up and use Home Assistant so all this will be done using Hassio.
Step 1: Watch the Video
Please watch the video above as it goes into the details of setting everything up. It is also much easier to follow everything through and see how it all integrates together using video. This written post will only contain the important bits.
Step 2: Add Sensor Nodes
Example Node Wiring
In order to log and analyse data, we first need some sensor nodes so make sure you have added some to home assistant. The previous post shows you how to create a node using the DHT22 sensor along with ESPHome. We also create new nodes that use the DS18B20 and SGP30 sensors in the video embedded into step one.
Step 3: Install InfluxDB
Once we have the sensor nodes in place, we need to start storing their values to InfluxDB. First, we need to install it. This can be done by heading to the add-on store, searching for “InfluxDB” and then clicking the install button. This step will take a minute or two so be sure to give it some time.
Before we can start the add-on, we need to scroll down to the config section and disable SSL by replacing “true” with “false”. Save the config and you can then start the add-on. Optionally, you can also enable the “Show in sidebar” option for easier access. The add-on will take a bit of time to start so give it some time. Alternatively, you can scroll down to check the logs and wait for the “Starting Nginx” message to appear which will signify that the add-on has started.
We then need to open the InfluxDB WEB UI and navigate to the admin tab where we can create the database and username. Start by creating a database with the name “homeassistant”. Then create a new user with the name and password as “homeassistant”. Be sure to give it all permissions before moving further.
Now that we have InfluxDB setup, we need to update the Home Assistant configuration so that the two can communicate with each other. This can be done by updating the configuration.yaml file and the easiest way to update that is by using the configurator add-on. Head over to the add-on store and install configurator. Start it and then open the WEB UI. Use the folder icon in the top-left corner to open the configuration.yaml file and then add the lines with details of the InfluxDB install as shown in the image.
Once that is done, restart Home Assistant. Once it is back up again, open up InfluxDB and you should now be able to see the sensor data.
Step 4: Install Grafana
Now that InfluxDB has been configured, we need to install Grafana. This can also be installed using the add-on store. Once installed, be sure to disable SSL like before and then start the add-on. Give it a few minutes to start.
Grafana needs to access the data from InfluxDB so it is a good idea to open InfluxDB and create a new user as we did in the previous step. I’m assuming the username and password is “grafana”. Once this is done, open up the Grafana WEB UI and select the “Add data source” option. Enter the following URL as the host:
Then, enter the database name which is “homeassistant” along with the username and password we just created. Once done, simply hit the “Save & Test” button which will check if communication is OK. This completes the setup process.
Step 5: Create a Dashboard
Grafana uses something called dashboards which consists of panels. These panels can be charts, graphs and so on. I’d recommend watching the video to learn how to create some basic charts. You can obviously create much more detailed dashboards to represent your data and it is too vast a topic to cover in this post.
Please do consider subscribing to our YouTube channel to help support videos and posts like these. Thank you for reading.
I was pleasantly surprised when I decided to try to add some DIY sensors to home assistant. Using ESPHome is extremely simple and in this post, we will learn how to control a GPIO pin and also obtain temperature & humidity data from a wireless node, by using Home Assistant. The best part is that it does not require any code to be written as it does this automatically.
Step 1: Watch the Video
It is much easier to see everything being done through a video first and that is why I’d recommend watching the video shown above to get an idea of how everything works. This post will only contain the important steps needed to do this yourself.
Step 2: Install ESPHome
First, we need to install the ESPHome add-on in Home Assistant. Navigate to the add-on store by doing the following:
Hass.io -> Add-On Store
Add the following URL to the store so that it can find the ESPHome Add-On:
Once done, simply search for ESPHome, click the add-on that shows up and hit the install button. Installation may take some time so please give it a few minutes as this will depend on your internet connection. Once installed, simply hit the START button and wait a few seconds for it to start. Then, click the button that says “OPEN WEB UI” which will take you into the ESPHome screen.
Step 3: Configure the Board (Node)
In ESPHome, devices are called nodes, and we first need to create one so that it can then begin communicating with Home Assistant.
Click the add button to create a new node. Then give it a name by using the characters shown on screen. I will call it “living_room”. Then, select the device type which is “WeMos D1 Mini” for this demo. Finally, add your WiFi network details so that the board can connect to your WiFi network and then click “SUBMIT” to create the node.
ESPHome needs to be restarted after creating a new node. This can be done by navigating to hass.io -> ESPHome and then clicking the RESTART button. Give it a few seconds and then open up the WEB UI.
We now need to configure this node so that we can control the LED that is connected to pin D2. The ESPHome website contains all the information you need to configure different components and since we will be controlling a GPIO pin, we can use the example configuration entity information from the following page:
Click the EDIT button for the node and then paste the configuration information and update it as shown in the image and then, save the file. Since this is the first time we are using the board with ESPHome, we need to manually upload the code to the board. Once this is done, we can then automatically upload any updates wirelessly using the OTA update feature.
To manually download the code, we first need to compile it. So use the node options menu to compile the code for the node. This will take a while and it took about 100 seconds for me. Once done, simply download the binary file. Then, visit the following link and download the ESPHome flasher tool for your system:
Double click the file to open it. Then plug in your board, select the correct COM port, select the binary file we downloaded and then hit the FLASH button. This will download the code to your board so give it a few seconds to complete. Once done, the board will automatically connect to your WiFi network and you will be able to see this in the logs.
Step 4: Add the Node to Home Assistant
Home Assistant will automatically detect the board and give you a notification for it. You can either click that to get started or you can navigate to the following:
Configuration -> Integrations
You will then be able to see the node, so click configure and confirm the addition. Now, all we need to do is add it to the dashboard. So head over to the dashboard/overview section and then select the “Configure UI” option from the options menu in the top right section. Then, click the Add button, select Entities and then give it a new name. You can then use the entity list to select the switch which will have the same name as the node. Click save, close the dashboard configuration view and that’s all you need to do. If you toggle the switch then the LED on the board should toggle as well and the state will be displayed on the dashboard.
Step 5: Interface the DHT11 Sensor
I will be using the DHT11 sensor to obtain temperature and humidity values. Connect it to the board by using the reference wiring diagram. You first need to copy the example configuration from the ESPHome website using the following link:
Then, head over to ESPHome and edit the configuration for the node by adding the configuration. Be sure to update the pin and also add the model name as seen in the image. Once done, simply hit the upload button and wait for it to complete everything. It will automatically create, compile the code and also upload it to the board wirelessly, using the OTA feature. Once complete, you will see the output logs and the board will automatically connect to your network.
Step 6: View the Temperature & Humidity Values
Adding Sensor Values
Sensor Values On Dashboard
The next thing we need to do is add the sensor values to the dashboard. This step is similar to the previous section. Select the Configure UI option to create a new card, then give it a name and add the entities as shown in the image. Click save, exit the configuration screen and you will then be able to view the sensor information on screen.
That’s how easy it is to get started with home automation using ESPHome. We will continue interfacing different modules to home assistant so please do consider subscribing to our YouTube channel as it helps us create projects like this.
We continue with the Pi Zero dashcam project and in this post, we take care of file management while also adding some enhancements in the process. This project is almost complete and we will be carrying out road tests in next week’s post/video.
Step 1: Watch the Video
There have been a lot of updates made to the script and I’d recommend that you watch the video to get an understanding of how it all works. We also discuss a suitable option for the safe shutdown feature which will be added in next weeks video/post.
Step 2: Connect the LED & Switch
Use the reference wiring diagram to connect the status LED and shutdown switch to the board. The video goes over the logic behind the functionality and the reasons behind why it is useful to add them.
This post will tell you everything you need to know about MQTT communication which will enable you to use it communicate between devices. We add an LED to the Arduino Nano 33 IoT board and this LED is controlled remotely from a switch that is connected to a WeMos D1 mini board. All communication occurs through the MQTT broker which also communicates with Home Assistant.
Step 1: Watch the Video
A lot of effort has been put into making the video above as we felt that a video is the best way to understand a topic like this. Please take a moment to watch the video to get a better understanding of MQTT and how we will set up the broker, use it and so on.
Step 2: Install & Configure the MQTT Broker
As this involves several steps, it is advisable to watch the video to view how to set this up correctly.
Step 3: Download & Update the Sketches
As mentioned in the video, you can use the sketches linked below to test out your setup. The file below contains two sketches – one for the Arduino Nano 33 IoT board and the other for the WeMos D1 mini board.
The video gives you an overview of object detection and motion detection in general. It’s much easier to understand how everything works using a video and that is why this post will not repeat everything again.
Step 2: Download & Run the Scripts
You can use the following link to download the scripts and sample images that are used in the video.
This is the second post on image processing so if you haven’t already read the first one, then please use the following link which will take you to it. That post gives you an overview of openCV and also shows you how to install everything.
This is a demo video for the Piksey Atto. We learn how to use it as a MIDI device and control tracks in Ableton Live 10 Lite. We use a breadboard along with momentary switches and you can also use an Arduino Leonardo for this project.
If you do build a lot of DIY projects then I think you should
definitely check out the Kickstarter campaign for it using the link below:
The video below covers everything you need to know about building this project, including setting up the interfacing software that we will be using. I would recommend that you watch it first as this post is only going to provide the relevant links needed.
Once done, simply open it up in the Arduino IDE and connect the board to the computer using a microUSB cable. Then, select Arduino Leonardo as the board from the tools menu, select the correct COM port and hit the upload button. The Atto uses the same microcontroller and bootloader as the Arduino Leonardo and that is why we can upload the board to the sketch using these settings. This also means that you can use the Arduino Leonardo if you want to.
Step 3: Connect the Buttons & Test
Once the code has been uploaded, simply use the reference diagram shown here and connect 4 buttons to the microcontroller. If you are using a Mac, then you will also need to download software called Hairless Midi Serial, which can be obtained using the link below: