My Current Pi Projects

Featured

Update 19 December 2017

Raspberry Pi's

  • Raspberry Pi 1 - OSMC Media Centre (B rev 1)
  • Raspberry Pi 2 - Weather Logging Rear / USB memory stick/ DNS Server (B+)
  • Raspberry Pi 3 - Weather Logging Front (B+)
  • Raspberry Pi 4 - DNS Server with Ad Blocking 433mhz receiver / Energenie Remote Plug controller (B rev 1)
  • Raspberry Pi 5 - Weather Display Board (A)
  • Raspberry Pi 6 - Gardening Pi connected to 8 way relay board (A+)
  • Raspberry Pi 7 - Connected to a cross trainer to track RPM / time (Zero rev 1.2)
  • Raspberry Pi 8 - Monitoring Station connected to 22" monitor (2)
  • Raspberry Pi 9 - Electricity Monitor connected to multiple SCT-013-000 Current Sensors (A+)
  • Raspberry Pi 21 - Pi Camera and USB Camera running motioneyeos (Front left) (B rev 2)
  • Raspberry pi 22 - Pi Camera and USB Camera running motioneyeos (Front right) (B rev 2)
  • Raspberry pi 22 - Pi Camera and USB Camera running motioneyeos (Rear) (B rev 2)

Broken - 1 x B+ (water), 2 x B rev 3 (ebay arrived broken)
TinyTX3 - Wireless Sensors - http://nathan.chantrell.net/tinytx-wireless-sensor/

  • Bathroom - DHT22 Humidity Sensor (Node 11)
  • Kitchen - DHT22 Humidity Sensor (12)
  • Hallway - DHT22 Humidity Sensor (14)
  • Extractor Fan Pipe - DHT22 Humidity Sensor (15)
  • Freezer- DS18B20 1-Wire Temperature Sensor (23)
  • Fridge - DS18B20 1-Wire Temperature Sensor (24)
  • Spare - DS18B20 1-Wire Temperature Sensor (26)
  • PC Case - DS18B20 1-Wire Temperature Sensor (27)
  • Air Con Fan - dual DS18B20 1-Wire Temperature Probes (29)
  • Door Switch (5)
  • Window Switch (6)

Wemos Devices

  • Wemos 1 - Weather sensing attached to 3 AA rechargeable batteries
  • Wemos 2 - Weather sensing attached to 4 AA rechargeable batteries
  • Wemos 3 - Weather sensing attached to 5 x 18650 batteries
  • Wemos 4 - Electricity Usage monitor attached to a SCT-006-000 current sensor

 

This site is a collection of notes, documentation and web links for my Pi's.

Retired Pi Uses

I mainly buy parts from CPC, ModMyPi, Pimoroni and eBay

Install owfs for DS2482-800

sudo apt-get update
sudo apt-get install owfs python-ow ow-shell -y

(ignore errors about not being configured)

sudo nano /etc/owfs.conf
Comment out
server: FAKE = DS18S20,DS2405

Find
# USB device: DS9490

Insert this below
server: device = /dev/i2c-1

Remove hashes from
mountpoint = /mnt/1wire
allow_other

sudo mkdir /mnt/1wire

sudo systemctl enable owserver.service

Reboot

Backup SD card online to external USB card

Piclone (gui) only backups the actual data - https://github.com/raspberrypi-ui/piclone

 

To run from command line

Copy this script https://github.com/raspberrypi-ui/piclone/blob/master/src/backup

On raspberry pi, run

sudo nano sdclone.sh

paste in the text

cntrl-x then y to save and exit

sudo chmod 777 sdclone.sh

 

I'm using a Sandisk external SD card and USB micro SD card reader

16gb Sandisk class 10 Micro SD card - https://amzn.to/350eGpw

Kingston Micro SD card reader USB - https://amzn.to/2Ver1BX

 

Run lsblk

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 14.9G  0 disk
├─sda1        8:1    1 43.2M  0 part
└─sda2        8:2    1 14.8G  0 part
mmcblk0     179:0    0  7.5G  0 disk
├─mmcblk0p1 179:1    0 43.2M  0 part /boot
└─mmcblk0p2 179:2    0  7.4G  0 part /

 

 

To run

 

sudo ./sdclone.sh /dev/sda /dev/macblk0

 

 

 

 

Items to add to a new Pi install

sudo apt-get update
sudo rpi-update
sudo apt-get -y dist-upgrade
sudo apt-get update

sudo apt-get install python-smbus i2c-tools mariadb-client-10.0 python-mysqldb git minicom build-essential python-serial python-dev python-pip fswebcam git scons swig python-openssl python3-lxml python-lxml -y

MQTT

sudo pip install paho-mqtt

sudo pip install --index-url=https://pypi.python.org/simple/  paho-mqtt

DHT22

git clone https://github.com/adafruit/Adafruit_Python_DHT.git

cd Adafruit_Python_DHT

sudo python setup.py install

 

BMP085

git clone https://github.com/adafruit/Adafruit_Python_BMP.git
cd Adafruit_Python_BMP
sudo python setup.py install

 

LEDs

git clone https://github.com/jgarff/rpi_ws281x.git
cd rpi_ws281x
scons

cd python
sudo python setup.py install

 

BME680

curl https://get.pimoroni.com/bme680 | bash

Using an Arduino Nano to sense wind speed

I tried using a Raspberry Pi to count the number of times the Wind Speed Anemometer revolved, but the Pi was unable to keep up.

So I used an Arduino Nano to do the counting.  The Raspberry Pi then looks for the output from the Arduino Nano


volatile byte count;

unsigned int loopcount;

unsigned int maxofcount;
unsigned int araysum;

unsigned int duration;
unsigned long tenseconds;
unsigned long sixtyseconds;

int countarray[6];

void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  attachInterrupt(0, arduino_anemometer, RISING);
  
  tenseconds = millis() + 10000;
  sixtyseconds = millis() + 60000;
  
  //countarray[]= {0,0,0,0,0,0};
  
  loopcount = 0;
  maxofcount = 0;
  Serial.print("Startup\n");
  //printwait();
  count = 0;
}

void loop()
{
  if (millis() > tenseconds) 
    {
      countarray[loopcount] = count;
      loopcount++;
      if (loopcount > 5)
        {
            maxofcount = getIndexOfMaximumValue(countarray, 6); 
            araysum = getSumofArray(countarray, 6);
            Serial.print("Current Count#");
            Serial.print(araysum,DEC);
            Serial.print("#Burst#");
            Serial.print(maxofcount,DEC); 
            Serial.print("#\r");
            
            loopcount = 0;
            sixtyseconds = millis() + 60000;
        }

      //printwait();
      tenseconds = millis() + 10000; 
      count = 0;
      //Serial.print("\n");
    }
  else
     {
        if(millis() < (tenseconds - 20000))
          {
            tenseconds = millis() + 10000;
          }
     } 
}

void arduino_anemometer()
{
  count++;
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(50);
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
}


void printwait()
  {
      Serial.print("\n");
      Serial.print("                                   Current time - ");
      Serial.print(millis());
      Serial.print("      tenseconds = ");
      Serial.print(tenseconds);
      Serial.print("      sixtyseconds = ");
      Serial.print(sixtyseconds);
  }
  

int getIndexOfMaximumValue(int* array, int size)
  {
    int maxvalue = 0;
    for (int i=0; i<size; i++)
      {
        //Serial.print("\n");
        //Serial.print("              Array Number ");
        //Serial.print(i);
        //Serial.print("  Array value ");
        //Serial.print(array[i]);
        //Serial.print("  Max value ");
        //Serial.print(maxvalue);
  
        if (maxvalue < array[i])
          {
            maxvalue = array[i];
          }
    }
    return maxvalue;
  }

int getSumofArray(int* array, int size)
  {
    int sumofarray = 0;
    for (int i=0; i<size; i++)
      {
        sumofarray = sumofarray + array[i];
      }
    return sumofarray;
  }

 

Add static IP address to ethernet

Raspbian Jessie

sudo nano /etc/dhcpcd.conf
interface eth0

static ip_address=192.168.1.82/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.162

 

On Older Raspbian

sudo nano /etc/network/interfaces

address 192.168.1.67
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1