If anyone planning to create some DIY sensors, then beyond to popular ESP8266 the cheap and low consumption "Raspberry Pi Zero W" modell is also a considerable option.
The RPI Zero W costs approximately 10USD and it's power consumption is almost 1W. However it has only one CPU core but it is more than enough for handling several sensors on it's 40 pin GPIO which is the same as on the RPI2/3/4. It also has integrated WiFi and Bluetooth 4.0 modules, so for example a BLE gateway can be built with it.
If you are able to connect some sensors to the GPIO but do not have much programming skills or you do not want to write new code for every new devices, there are a simple solution, named RPIEasy.
RPIEasy is a Python3 based program for Debian/Raspbian based computers, mainly targeted for Raspberry Pi, but some functions also available on a simple PC. RPIEasy harvests data from the devices attached to it and forwards to a local home automation server, through HTTP/UDP/MQTT - the method is selectable in the Controllers menu. RPIEasy is compatible with the famous ESPEasy (for ESP8286) firmware, and the GUI is also very similar to it, in fact RPIEasy is able to join into an ESPEasy P2P UDP peer network.
Currently the following device/sensor types can be added through a user-friendly webGUI to RPIEasy:
- Digital switch input (PIR,Door open sensor,etc...)
- DS18b20 temperature
- DHT22 temperature and humidity
- PCF8591 ADC/DAC
- Wiegand RFID reader
- MCP23017 GPIO extender
- BH1750 light sensor
- LCD display (I2C)
- HC-SR04 ultrasonic range sensor
- Si7021/HTU21D temperature and humidity
- TLS2561 light sensor
- PN532 Mifare/NFC reader (I2C)
- PCF8574 GPIO extender (I2C)
- PCA9685 PWM extender (I2C)
- OLED display (I2C)
- MLX90614 IR temperature sensor (I2C)
- INA219 DC current sensor (I2C)
- ADS1015/ADS1115 ADC
- BMP280/BME280 temperature
- NeoPixel/WS2812 addressable LED
- MH-Z19 CO2 sensor
- AM2320 temperature
- MPR121 capacitive touch sensor (I2C)
- 7segment TM1637 display
- RF433Mhz RX/TX (simple GPIO)
- APDS9960 gesture sensor
- VL53L0X LIDAR range sensor
- MAX44009 temperature
- MCP9808 temperature
- MCP4725 DAC
- Stepper motor (28BYJ-48)
- (V-)USB Relay
- USB Temper temperature sensor
- Xiaomi BLE Mijia temperature and humidity sensor
- Xiaomi BLE Mi Flora flower care monitor
- DS18b20 through serial-USB
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Assembly
Let's get started with a simple setup, using a temperature and a light sensor:
- Raspberry Pi Zero W
- 8GB/16GB Class10 microSD memory card
- Micro USB 5V2A Wall Charger
- DHT22 temperature and humidity sensor
- 4.7 kOhm resistor
- BH1750 light intensity sensor
- some jumper cables
- plastic box
Assemble it according to the fritzing.
Step 2: OS Installation
- Download a Raspbian Lite operation system image
- Download Etcher
- Write the Lite OS image with Etcher to a 8-16GB SD card
After the process is completed modify the file on the SD card "etc/wpa_supplicant/wpa_supplicant.conf" to similarly:
4. Place the SD card into the RPI memory slot, plug the MicroUSB power supply cable to it's "PWR IN" connector and if we de everything in the right way, than the RPI starts up and is accessible through SSH. (IP address is gathered from a DHCP server, so check your router DHCP leases for the used IP address)
5. At the first start the username is pi and the password is raspberry.
Step 3: RPIEasy Installation
First (optional) step is to update your system:
sudo apt-get update
sudo apt-get upgrade
After that install the required packages:
sudo apt install python3-pip screen alsa-utils wireless-tools wpasupplicant zip unzip git
sudo pip3 install jsonpickle
If your system lacks "ifconfig" command install it also:
sudo apt install net-tools
Then download RPIEasy from github to the actual directory and start:
git clone https://github.com/enesbcs/rpieasy.git
If nothing is using port 80 yet, then the GUI is now available through port 80 with a web browser, if it is not available the program will try to use 8080 then 8008. (it writes the port number at the console on startup)
Step 4: RPIEasy Hardware Settings
On the hardware settings page you can enable "RPIEasy autostart at boot" option with a simple checkbox then pressing Submit button.
This application is python based so there are several possible dependencies which can be viewed and installed at Plugin&controller dependencies page. Installation can be started by clicking to an underlined text, please be patient, the process may take several minutes depending on package number and complexity!
Then it may be a good idea to check hardware settings at Pinout&Ports. Make sure that I2C is enabled (for the Light sensor) and the GPIO 22 pin type is "Input" for DHT.
You can make other, system-related changes in here, but do not forget to press Submit and Reboot in the end. (Reboot command is available at the Tools menu)
Step 5: RPIEasy Controllers
As you are making a sensor you might want to setup some kind of Controller at the Controllers menu: it can be Domoticz HTTP/MQTT, Generic UDP, ESPEasy P2P or Generic MQTT (for HA, OpenHab, etc..)
Step 6: RPIEasy Devices
And finally: devices can be added at the Devices menu, there are 48 device slot possibility, if it is not enough please open a github issue and it will be raised. :)
Click an Edit button, select the necessary DHT22 and BH1750 plugins and set parameters according the fritzing. The DHT22 1st GPIO is GPIO22 and oversampling is generally a good idea as this kind of sensor is very sensitive of accurate timing. (remember that DHT communicates with one wire, but it is not 1-Wire compatible!)
The BH1750 is an I2C sensor, the I2C address can be selected from a select, the default is 0x23, oversampling is not necessary as the I2C communication is quite solid.
It can be selected that on which controller, which IDX and what intervals the sensor reading has to be sent. The Formula field is compatible with EasyFormula, and local ESPEasy compatible rules can be specified at the Rules menu.
This is the short story of making an RPI based multisensor, there are many options and combinations, feel free to try them in the spirit of the DIY!