Pi Blog

Where were you when we were getting Pi?

Linux LFS101 - brush up your Pi knowledge

posted 22 Jul 2015, 02:12 by Tom Cooper

If, like me, you've developed your knowledge of Linux in a rather piecemeal and ad hoc way, a brush-up on your skills might be a good idea. At the very least there might be gaps in your knowledge and, furthermore, some tasks that you are labouring over might actually be easier than you think. 

I've just completed the Linux Foundation's LFS101x.2: Introduction to Linux course. It's on-line, free and very flexible. The tuition takes you form the basics of Linux  bootloading, kernels, distributions filesystems, shells, editors – right up to common applications and GUIs. There was a lot of stuff in there that I'd got away without knowing so far, but I'm glad I've learnt it. 

Fedora, Debian and Red Hat and Suse flavours are considered, so there is plenty specific to the Pi's Debian-type system and the other stuff is good background.  

My top tip is to learn how to use the vi editor. You can used from the command line in a non-GUI environment – a bonus when you a re ssh'ing around for example – and it is just so quick to use when you are dealing with things like config files, or even code.

There's an 'honor code' exam at the end. And you can pay to have an 'id-verified' exam too. Here's my certificate on the left.

I spent around 20 hours on the 18-unit course. It's worth not skimping on the 'Labs' at the end of each section. Here you can try out your knowledge. It helps if you have a Linux system where you have root access  either a Pi or something running under VMWare  works a treat. I even had a go at CentOS (Red Hat) using VWWare on Windows.

Close to done...

posted 12 Mar 2015, 10:01 by Tom Cooper   [ updated 12 Mar 2015, 10:04 ]

Well nothing is ever finished is it? But I've sorted out just about everything on the Pi/Arduino weather station.

In the last couple of weeks I have:
  • Put a proper antenna on the outside unit (see right)
  • Done a slight upgrade to the solar power to use two blocks of four AA batteries with the blocks in parallel. This is mainly to cope with a higher charge rate which is needed because my neighbour's trees shade my solar cell
  • Generally tidied up the inside of the weather screen
  • Fitted the inside electronics into a case.
What's to come?
  • Well I need a bigger case! (see below)
  • Then I need to do a bit of reprogramming of the Python code and get it up on GIT
  • Start working on the next version!
The case

Tight fit

Disqus for Google Sites

The gadget spec URL could not be found

Close to a functional prototype

posted 17 Feb 2015, 09:10 by Tom Cooper   [ updated 17 Feb 2015, 09:17 ]

Stevenson screen
The Arduino/Pi weather station is close to a functional prototype. The Arduino (sensors) end has been redeveloped with a Ciseco RFu328 (Arduino compatible 3.3v unit) driving the sensor end. The solar power has been simplified with a pod of AA rechargables, a solar cell and simple LM317T current controller to stop the batteries frying in the sunshine. Also in the transmitter box is a 3.3v voltage controller from Ciseco. 

This is a far cheaper and simpler setup than the first prototype. The RFu328 draws just over 30 milliamps (about a third of the original XinoXF) which makes the solar power setup easier.

I've also split off the sensors from the Arduino. The original XinoXF and SparkFun Weathershield version left the XinoXF (that's an Arduino clone with a built in transmitter by the way) far too exposed. 

To facilitate that split, I made a sensor board out of a spare piece of Veroboard, some SparkFun sensors (BMP180 for pressure and HTU21D for humidity and temperature) and RJ11 sockets for my rain/wind  sensors plug into. By the way the SparkFun stuff is available in the UK from the admirable ProtoPic

To hook the sensors to the RFu328 I used a old-style RS232 serial cable so I had a pluggable, modular solution. The eventual end-game will be to produce a proper PCB for the sensors and RJ11 sockets. Meanwhile the inside of the Stevenson screen (right) looks moderately tidy!

Along the way I have had to do a bit of recoding on the Arduino end and even learned how to make and calibrate a voltage splitter to measure the wind direction.

Next steps
  1. Get an external antenna for the screen end
  2. Get the receiver end (the Pi) put into a proper case
  3. Finish re-coding the Python code on the Pi into proper object-oriented and modular code (I will post some code soon)
The photos below show the inside of the transmitter with the RFu328 at its heart. Next are two pics of the sensor board showing the RS232 cable connected. Finally there is the box holding the AA batteries and the LM317T charge controller. The solar panel plugs in the left side, the cable to the transmitter plugs into the top.  
The iside of the transmitter showing the RFu328  The sensor board 
Sensor board 2  The power end

The Pi is on-line

posted 20 Jan 2015, 11:36 by Tom Cooper   [ updated 20 Jan 2015, 11:43 ]

Twitter Timeline

 Here is the latest from the Weather Pi, thanks to Twitter

A few rethinks

posted 19 Jan 2015, 11:56 by Tom Cooper   [ updated 19 Jan 2015, 12:21 ]

Weather sensors
I have been making slow but steady progress on the weather station, although power usage continues to be a bit of an issue.

The Python code on the Pi is now running resiliently with some decent logging. There are enveloping shell scripts and running as daemons via init.d processes. A good example of how to do it is on this blog: http://blog.scphillips.com/2013/07/getting-a-python-script-to-run-in-the-background-as-a-service-on-boot/

My Python coding is slowly shaping up - I've even been getting to grip with objects. I will post something when I dare to show it.

I also invested in a mini Stevenson Screen just to give me a bit of space and keep the gear protected.

The next stage is to start passing events between the process which gets the data from the weather station and the display daemon - so there are no unnecessary screen refreshes when the data has not been updated.

Stevenson Screen
At the weather station sensor end, flat batteries are a constant issue, despite a decent sized solar cell and a 6Ah LiPo battery. The XinoRF is quite a power-hungry beast - 95mA through my meter. The Sunny Buddy charger is set at 450mA by default and even when really cranked up with sensor resistors it's not putting much more power through than that. A few hours of sunshine is the best to be hoped for at this time of year and my garden is pretty shady.

Without solar the setup runs for about 48 hours, with solar about 90. To drop the power usage, I've picked up a Ciseco RFu-328 which is aimed at low power applications. With a bit of recoding and some improvising I've made a breadboard prototype that runs of an AA battery. The plan in to produce something that will run off a basic solar setup and maybe 4 AA rechargables. That setup will also keep the costs down

Arduino Pi weather station prototype up and running

posted 31 Oct 2014, 08:20 by Tom Cooper

Time to post a few more photos of the fledgling Pi/Arduino weather station. First a progress report. The weather (Arduino) end of the station has been running all week in the garden without fault. The solar charging issue seems to have been solved by a big charge for the LiPo battery then a larger solar cell This one from Proto-Pic (there it is in the foreground on the right). 

In hindsight I had an old cell in a battery trickle charger (for the car) that never really worked but could have done the trick here.

At the Pi end the acquisition of a TriBorg gave me two extra GPIO headers and finally let me run the datalink (via a Ciseco Slice of Radio) and the display (Embedded Artists 2.7" ePaper) together (see it in action on the left). I've already mentioned one compatibility issue (the use of the transmit-receive pins by the EA display) but when I plugged everything together the display just went blank. A bit of trial and error with a breakout board revealed that disconnecting GPIO pins 8 and 10 (TX and RX) from the display smoothed the way. So I just clipped these pins off one of the TriBorg headers.

The Python code still needs a bit of work in terms of error trapping and logging. Plus I am adding some more virtual screens to be scrolled through via button presses (using that third free TriBorg header!). 

I've also ordered the final bits of hardware: a case for the display end, a power supply and a few cables. More on that later, but now I'll add those pics.

Arduino / Pi weather station - displaying progress

posted 26 Oct 2014, 03:28 by Tom Cooper

Embedded Artists 2.7-inch epaper display with data from the Raspberry Pi
Excitement reigns at Cooper Towers... well maybe not but I have managed to get some data from the weather station on an Embedded Artists 2.7-inch epaper display. The code from GIT compiled easily on the Pi - just follow the instructions and links from the above. Then it's a matter of putting together some Python code to read the data from the SQLite database and add it to the screen. There are a couple of examples of text displays (using Python and the Python Imaging Library) on the GIT as well and these make a good template to start from.

The only slight issue is there was a pin clash on the Pi between the EA display and the CISECO slice of radio. The radio, of course, uses the UART pins (8 and 10) for serial IO. The EA uses these too - just for general control. Fortunately someone has come across this before and there is a code variant in the GIT hub to cope with that. Just find epd_io_free_uart.h in gratis /PlatformWithOS/RaspberryPi. Swap that with the epd_io.h code before you compile. That stops the problem of the EPD Fuse service contending with the radio for pin eight ( think 8 was the issue as the radio was 'on' all the time).

Funnily enough I didn't have to re-wire the pin connections to make things work. The latest version of the EA board plugs straight into the PI GPIO via the usual ribbon cable. 

The next stage is just to tidy up the code a bit and make it a bit more robust. I'll post up some code when the bugs are ironed out.


posted 21 Oct 2014, 06:19 by Tom Cooper

XinoRF fitted to case with weathershield - note the whip antenna
The basic weather station setup is working. I have the Arduino (XinoRF) sending data  back to the Raspberry Pi (Slice of radio) where a Python script is logging the data to an SQLite database. The original plan was to use MySql but I couldn't get this working with Python 3 - I'm not sure if it is even supported yet. I'll post some samples of the code later when I have tidied it up.

Making the cutout
Making the weather screen
I haven't actually taken it outside yet as I haven't quite got the solar power working yet. I tried to save cash with a really cheap solar cell, but it can' keep the voltage over the 6v under load that the SparkFun Solar Budy I'd acquired needs to start charging the LiPo battery. 

Sensor shield
Meanwhile I've started working on the weather station shield to keep the sun of the sensors yet still allow the air to circulate freely. I'm using plastic plant-pot saucers to build this - more on that later too. Meanwhile here are some progress pics.

Arduino/Pi weather station - progress report

posted 12 Oct 2014, 03:05 by Tom Cooper

Assembling the SparkFun Weather Meters (rain, wind direction and speed) is a breeze – which is just as well as there are no instructions. The nuts and bolts for attaching them to the supplied pole were not supplied either  M3 bolts work well if you need them.
I'd bought the SparkFun Weathershield for the Arduino, just to help me get started (don't worry this isn't an advertorial!). This proved pretty simple to fire up. Firstly I soldered a standard set of Arduino headers on the board followed by a couple of RJ11 sockets for the cables from the weather sensors. 

There is a demo sketch on the Weathersheld product page works ok with the XinoRF board I have decided to use on the weather end of the operation. The only issue is that the sketch uses pin 8 (well it declares it but never uses it for a status LED). So it's worth commenting that declaration out. Similarly the Weather Shield has an LED wired to pin 8. This is the pin used by the XinoRF to switch on the radio. You can leave it wired up if you want. But I cut off pin 8 on the Weathershield header and jumped over pin 12 so I can light that green LED if I ever need to.

It's worth running the demo sketch initially just to verify everything is working OK via the serial monitor on the Arduino IDE interface. After that you can try firing up the radio by adding the following to the sketch to toggle on the radio:
pinMode(8, OUTPUT);
digitalWrite(8, HIGH);

Then it's time to get the other side of the interface working on the Raspberry Pi.

Shopping for my Arduino/Pi weather station

posted 3 Oct 2014, 05:42 by Tom Cooper

With some basic plans in my head (and some written down below), I have been hitting the internet looking for suitable components. 
The inspiration from this project from Sparkfun can be seen in some of my choices. Here is what I have acquired so far:

For the weather station head

  • Weather sensors PPSEN-08942 SparkFun model from Proto-Pic £60 + VAT
  • SparkFun Weather Shield from Pimoroni.com £30. A bit expensive but pretty confident it will do the job and makes interfacing with the above sensors a little easier.

For the solar power

On top of that all I need is a handful of connectors and I'll power up the soldering iron and get going.

1-10 of 12