We need to make the script an executable. # navigate to home directory, then to this directory, then execute python script, then back home Include the following text in launcher.sh #!/bin/sh While still in the /home/pi/RPi_bird_feeder_monitor directory. Replace the values for "OIP_HOST", "MQTT_USER", "MQTT_PW" and "MQTT_PORT" to match your local setup. Wire the CAP1188 sensor to the RPi and perform the following to test the system after the MQTT server is operational: cd RPi_bird_feeder_monitor Install the Bird Feeder Monitor software: cd ~ I recommend using Adafruit's Configuring MQTT on the Raspberry Pi to configure and setup MQTT on this RPi. Install mosquitto, mosquitto-clients and paho-mqtt: sudo apt-get install mosquitto mosquitto-clients python-mosquitto If the CAP1188 is connected, you will see the same response as seen in the photo above, which indicates the sensor is at I2C address 0x28 (or 0x29 depending on your choice of I2C address). Install I2C tools: sudo apt-get install python-smbussudo apt-get install i2c-toolsĬheck I2C addresses with above tool: i2cdetect -y 1 Install Adafruit's CAP1188 module: pip3 install adafruit-circuitpython-cap1188 Next install a GPIO and Adafruit blinka package: pip3 install RPI.GPIOpip3 install adafruit-blinka You should see the following response: /dev/i2c-1 /dev/spidev0.0 /dev/spidev0.1 Install Adafruit CircuitPython: sudo pip3 install -upgrade setuptoolsĬheck for I2C and SPI devices: ls /dev/i2c* /dev/spi* Install pip: sudo apt-get install python3-pip Log into the Raspberry Pi Zero W and perform the following steps. The RPi Zero and CAP1188 could have been packaged in one weatherproof box, but I preferred to package them separately. The capacitive sensor needs to be located as close to the perches as possible. I constructed a 16" long cable to connect the Weatherproof Box containing the RPi to the Weatherproof Box containing the CAP1188. This project should work with batteries, but I didn't want the hassle of changing batteries on a routine basis. The other end of the wire was connected to a fused 5-VDC power supply in the garage. A 2-Pin Weatherproof Connector was attached to the end of the wire for connecting the RPi Bird Feeder Monitor. Power for the RPi was provided externally, by running a wire underground from my garage, and up through the pipe used as the bird feeder stand.
0 Comments
Leave a Reply. |