Posts

Reading the Temp & Humidity from the DHT11 connected to a Raspberry PI

Image
  Connecting the thermal module (DHT11) is quite simple. Here're the pins that I used. Module    RPI GND          GND (Pin 6) VCC          VCC (Pin 1 - may need Pin 2 (5v) for longer distances) Data          GPIO 0 (Pin 11) Overall, the way to read data from the thermal module is to pulse the data pin and then wait for 40 bits of data. The Pulse The RPi needs to pulse the data pin low for 18ms (milliseconds) and then wait for module to pulse the data signal low then high for 80us (microseconds) The Data The data is transmitted as 50us of the data line getting pulled low, followed by the line getting pulled high for ~27us (for a "0") or high for 70us (for a "1"). The 40 bits The 40 bits are made up of the following 2 x 8 bits of humidity 2 x 8 bits of temperature 8 bits of parity The humidity and temperature are made up of the first 8 bits are the whole part of the number when the second 8 bits are the fractional part. For example 0x10 0x12 would be 0x10.0x12 = 1

Quick guide: ADS1115 on Raspberry Pi

Image
Note that I'm specifically using this device (Well, the 12bit version, but that's a different/Amazon story),  ADS1115 16 Bits 4 Channel Analog-to-Digital ADC PGA Converter with Programmable Gain Amplifier High Precision I2C  First thing is to solder all the pins (Note that if you're only sampling one analog input, you could ignore A1->A3). I soldered male breadboard jumper wires on, rather than the pin header, as that adds even more bulk.  Next is to connect to the Raspberry Pi.  ADC (Analog to Digital Converter) to RPi connections: VDD to 3.3v            -  Pin1 GND to GND              - Pin 6 SCL to I2C 1 Clock    - Pin 5 SDA to I2C 1 Data     - Pin 3 ADDR to GPIO<any>        - For me Pin 13, GPIO2/27 ALRT to GPIO<any>      - For me Pin 11, GPIO0/17   SDA/SCL are the data and clock for i2c. ADDR is to "address" the ADC device - active high. ALRT is an alert that something has changed. Input from the ADC. Default: Active Low. Use 'gpio' or

Configuring Email on Rasbian Buster (Not Sending Email)

I had issues configuring sending Email on Rasbian Buster.  (Linux 10) In the past I'd followed this type of procedure: apt-get install ssmtp apt-get install mailutils vim /etc/ssmtp/ssmtp.conf Adding something along the lines of the following: AuthUser=<myEmail> AuthPass=<MyEmailPassword> FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES        However, the problem was that it didn't work. Whenever I tried to send Email, it would fail:      echo "This is a test" | mail -s "Test" <email>      mail: cannot send message: Process exited with a non-zero status        The first thing was to change from ssmtp to msmtp      apt remove ssmtp      apt install msmtp      vim /etc/msmtprc     # Gmail specifics account         gmail host                smtp.gmail.com port           587 from           < email > user           < email > password       < password > # Default account default :

Bash Garage Door Monitor on Raspberry Pi

This post describes the bash script that I use to enable my Raspberry Pi to Email updates on the state (open/closed) of each of my garage doors. This is a nice use of the bash 'trap' statement used to handle events, such as the garage door opening or closing. Note that 'trap' is a bash shell function, not a linux command. Although it may be fun to type in 'man trap' - you'll not get any help. Use 'man bash' to get help on the trap function. Firstly, we have the statement at the top of the file that says to use /bin/bash. If you miss this out, things tend to work OK while developing the script, but you'll run into issues once you try and automate things, as you could end up with running /bin/sh rather than bash, causing errors. #!/bin/bash Next we define the pin names. This is just the name for each garage door, or more specifically who uses the door and which GPIO pin is connected to the door. (I use a  Magnetic Reed Switch  for each GPIO