Category: Raspberry PI

  • Home Automation at a bargain price

    ad560dac-3c75-42c9-8236-5dcebb79296dI discovered these little “Orvibo S20” sockets that let you turn sockets on and off using your iphone. Very neat.
    You can also do this over the Internet. But I’m not entirely convinced that the third-party proxy is secure enough for my level of internet security paranoia. I mean, I am sure it is fine but I only paid them a one-off fee under £20, so their motivation to run a highly secure proxy is going to eventually wane a little. So I need another solution.
    Fire-up a Raspberry PI and have a play with this project on Github. You’ll soon have a webpage on your PI that lets you turn sockets on and off. Now it is in your control, putting it behind a VPN tunnel or SSH session is a possibility.
    Now go look at what the more expensive proprietary home automation systems cost and decide if £20 and a few hours of your time makes sense…

  • Pi Zero and Camera not working

    pi-camera
    I have a few Raspberry PIs. I’m an engineer at heart and these things allow me to tinker without expending a lot of money and the SD-Card nature of the filesystem makes it easy to try something, wipe it and try something new.
    One thing that has frustrated me for weeks is a camera failing to work. I checked config and it was good, so I thought it was the cable. Bought a new cable. It wasn’t the cable.
    Thought it might be the PI. Tried a different one. It wasn’t the PI.
    Argh.
    Tried another camera. Different version. Nope.
    Then I found this: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=160611
    And one line of obscure, seemingly unrelated config later, it is working perfectly.
    Seems there is a version bug in the Pi. Apparently it relates to certain versions of the Pi Zero and my board should not be affected. I checked the revision numbers and the OTP that the Pi thinks it is and they all check out. So I shouldn’t need this fix. But it turns out I do.
    If you have a Raspberry Pi and the camera doesn’t work, giving some mmal errors, please rad the post. It may be a simple job of adding

    force_board_rev=0x900093

    to /boot/config.txt and then running

    sudo raspi-config

    and enabling the camera. One reboot later and

    sudo raspistill -o test.jpg

    will give you a view of the world as the Pi sees it.
    Hooray!

  • Wifi on the Raspberry Pi

    Had a few requests about this and there are various answers on forums around the place, but this is how I did it using a PI Hut dongle:

    sudo apt-get update
    sudo apt-get upgrade
    sudo shutdown -r 0

    Those three commands make sure everything is the latest it needs to be before you try anything else. Now let’s edit two files:
    sudo nano /etc/network/interfaces

    # just add or edit the wlan sections at the bottom, leave the rest of the file as you find it
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    allow-hotplug wlan1
    iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    

    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

    #This is the entire file and it gets me onto my home wifi network, but change the ssid and the psk to the password for your network
    ctrl_interface=DIR=/var/run/wpa_supplicant
    GROUP=netdev
    update_config=1
    network={ ssid="59KnightsWay" psk="afafafafafa" }

     
    Note: If you wanted a static wifi address, the interfaces file needs a minor tweak:

    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.1.99
    netmask 255.255.255.0
    gateway 192.168.1.1
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    Reboot and use these two commands to check what did and didn’t work:
    ifconfig wlan0
    tail -500 /var/log/syslog | grep wlan
    If you struggle with wpa_supplicant, you can wimp out and do it all in /etc/network/interfaces

    # interfaces(5) file used by ifup(8) and ifdown(8)
    # Please note that this file is written to be used with dhcpcd
    # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
    # Include files from /etc/network/interfaces.d:
    source-directory /etc/network/interfaces.d
    auto lo
    iface lo inet loopback
    iface eth0 inet manual
    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.1.99
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8
    wpa-ssid "MySSID"
    wpa-psk "mypassword"