Posts

Showing posts with the label bash

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 "...

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...