Search This Blog

Saturday, October 24, 2015

RPi - auto start application on boot

There are a number of ways to get a Raspberry Pi to start an application on boot... making it good for IoT type applications...

You could use a cron job (crontab).... or edit the /etc/rc.local file

sudo nano /etc/rc.local

eg. add a line
python myscript.py



Sunday, October 4, 2015

Mac OSX - can't use SUDO with some folders anymore in El Capitan - solution

This works - from here -   http://stackoverflow.com/questions/32590053/copying-file-under-root-got-failed-in-os-x-el-capitan-10-11/32590885#32590885 
_____

El Capitan now protects certain system directories in "rootless" mode (a.k.a. System Integrity Protection). If you run the command ls -lO /System/Library/LaunchDaemons you'll see that the directories and files under there are now marked as "restricted."
You can disable rootless mode like this:
  1. Reboot into recovery mode (reboot and hold down Cmd-R)
  2. Open a terminal
  3. Use this command: csrutil disable
  4. Reboot and run the command that worked prior to El Capitan
When you're done, it is highly recommended that you re-enable SIP by following the same steps, but using csrutil enable in step 3.

Tuesday, May 26, 2015

Making my Raspberry PI into a Print Server (inc AirPrint for iPad)

It's useful to print from any device wirelessly... with a cheaper non-wireless printer (in this case a Brother laser).... here's how to make a Raspberry Pi into a useful print server.

Source: http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server
Set up the IP address on the PI
Listing 1
/etc/network/interfaces
#/etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Upgrade ready for install CUPS
sudo apt-get update
sudo apt-get upgrade

Installing CUPS

CUPS (Common Unix Printing System) manages printers connected via USB or the network and provides a management interface. You can install CUPS on your system by running:
sudo apt-get install cups
You will want to add the pi user to the lpadmin group, so it can access the administrative functions of CUPS:
sudo usermod -a -G lpadmin pi
After the install, CUPS runs as a system service and provides a management interface on the local system. If the network on which the Rasp Pi resides is trustworthy – and that is the case with your home LAN – just run
sudo cupsctl --remote-any
sudo /etc/init.d/cups restart
Adding AirPrint for Apple i* devices
sudo apt-get install avahi-discover

Source:
http://www.makeuseof.com/tag/add-airprint-support-raspberry-pi-print-server/

Monday, May 25, 2015

Ubuntu on Mac Air

 

Installed Ubuntu on to my Mac Air…. had a few issues with the WiFi (Broadcom BCM4360 Wireless Network Adapter)

This post by Eneko Chan sorted it… many thanks to Eneko!!

http://tech.enekochan.com/en/2015/03/16/install-bcm4360-wi-fi-drivers-in-ubuntu-for-macbook-pro-13-retina-display-mid-2014/ 

But in case you don’t have one, it’s posible to download all the deb packages (from another computer and copy them to an USB drive) and install them manually. The version numbers will differ from one distribution version to another so check them. For Ubuntu 14.04 I installed those:

The installation process is quite simple, just follow this order:

$ sudo dpkg -i libfakeroot_1.20-3ubuntu2_amd64.deb
$ sudo dpkg -i fakeroot_1.20-3ubuntu2_amd64.deb
$ sudo dpkg -i dkms_2.2.0.3-1.1ubuntu5.14.04_all.deb
$ sudo dpkg -i bcmwl-kernel-source_6.30.223.248+bdcom-0ubuntu0.1_amd64.deb
 
 

Tuesday, April 21, 2015

Garmin ANT – using a Raspberry PI to sync Garmin Data from a Forerunnuer 401

 

I’ve a spare original Raspberry PI that wasn’t doing very much. I’ve also a Garmin GPS watch that can sync data over ANT (wireless) to the likes of Strava. So I set about searching for a way to do this… to find it’s already been done!

Once the PI has Raspbian running you need to follow these instructions.

https://github.com/braiden/python-ant-downloader 

(mainly copied from URL above with additional steps added)

> SSH to the PI

sudo apt-get update

sudo apt-get install python-pip

sudo apt-get install python-pip libusb-1.0-0

sudo apt-get install python-lxml

sudo pip install python-ant-downloader
apt-get install python python-lxml python-pkg-resources python-requests python-serial

 


Make sure you have permission to access the USB device. Add a text file with one of the following to /etc/udev/rules.d/99-garmin.rules.

On Ubuntu 10.04 (or other other older distros):

SUBSYSTEM=="usb", SYSFS{idVendor}=="0fcf", SYSFS{idProduct}=="1008", MODE:="666"
 

The first time you run the program it will need to pair with your GPS device. Make sure the the GPS unit is awake (press a button), and make sure pairing is enabled. Then just run ant-downloader. When prompted accept the pairing request on your GPS device. Once request is accepted a key is saved and you should not need to pair again.

You may also choose to enable "Force Downloads" on your device. This will cause all old data to be downloaded. WARNING, It will also upload all data to Garmin Connect.

Configuration

See antd.cfg from configuration options including where files are saved, and Garmin Connect login details. The file will be created in ~/.antd the first time you run the program.   (Note: check root folder after running the data download first time, if not showing using ls then just use vi to edit the file and it’ll load)

Twitter API – Error 401

 

I have a Raspberry PI2 running a PostgreSQL database (+PostGIS)…. and a python script to grab GeoTweets. It works surprisingly well.

However one thing to consider is that the Pi clock resets to 1970 after power has been disconnected!

If you don’t do this and try to connect to the Twitter API then you get error 401 – unauthorised. Also need to remember to set the clock without adding an hour for BST!!

Monday, November 24, 2014

Raspberry Pi



Notes on setting up Python on a Raspberry Pi remotely from a Mac


install Raspberry PI OS - Debian Wheezy  http://www.raspberrypi.org/downloads/


Connect from Mac to the Pi
Mac> ssh pi@192.168.0.3   (Pi IP address)

Install PIP on the Pi
Pi> sudo apt-get install python-setuptools
Pi> sudo easy_install pip

Add Python Packages using PIP
Pi> sudo pip install tweepy
Pi> sudo pip install shapely
etc

Transfer Files between Mac and Pi (using Finder on Mac)
Pi> sudo apt-get update
Pi> sudo apt-get install netatalk

Mac>open afp://192.168.0.3   (IP address of the PI)

Set up Remote Desktop 
Pi> sudo apt-get install xrdp  
                  (add protocol for RDP one time set up on the Pi)

Mac> use Microsoft Remote Desktop client to connect to Pi
(download the App from App Store - search for 'Remote Desktop')