Weather Balloon 3 – Testing wifi over a distance

The plan is to use BerryCam to take pictures of groups of people and these pictures would be available to anyone who has the IP address of the router. I suspect that in order for people to be recognised the height of the balloon would not need to be too great. Taking pictures of the surrounding countryside would then be accomplished under programme control. At a rough guess something around 100 feet could be about right, although that’s just a guess.

So I need to be able to use WiFi to at least 100 feet although more range would be good. There is a long straight corridor where I work that is 30m long, just under the 100 feet I want. There is access to mains sockets at each end so I set up the router at one end and the Raspberry Pi with camera at the other.

On the day the router will on the ground with the Raspberry Pi in the air, so to mimic this I stood alongside the router. Using my iPad I was easily able to control the Pi using the iPad and take pictures on the Pi over 30m away. Looking at the WiFi signal strength I suspect the distance that the iPad will be able to control picture taking will be well over 100ft, but it will not be possible to identify people at this range.

The picture below shows the view down the 30 m corridor with me standing on the right, just visible.

2015/01/img_1616.jpg

Time lapse photography on the Raspberry Pi

This is part of my Weather Balloon project.

There are a lot of tutorials on the Internet showing how this can be done, but I spent some time trying to get it to work. The following procedure worked for me and may be of use to others.

Start the LX Terminal to enter the following:

Step 1 – make a new folder where all the files and images will be kept.

mkdir Timelapse

cd /home/pi/Timelapse


This creates a new folder then navigates to that folder.

Step 2 – write code that will take a picture

Create a new file called timelapse.sh

nano timelapse.sh

Then enter the following code

#! /bin/bash
DATE =$date("%d-%m-%Y_%T")
raspistill -o /home/pi/Timelapse/$DATE.jpg

Save and exit by clicking on Ctrl x

To check this works enter

sh timelapse.sh

The LED on the camera board should light and a picture should be taken and saved to the Timelapse folder with the date and time as a file name.

If all is well then you need to write the code that will take pictures at regular intervals. Crontab is used and it is started as follows.

Step 3 – The Crontab code.

crontab -e

This starts the editor, scroll down to the bottom of the code and enter the following code

*/1 * * * * /home/pi/Timelapse/timelapse.sh

This is where I went wrong, no one said that there has to be a space after the */1 and between each of the * characters and a space before the command address. Without those spaces it will not work, and I admit that the code on the Internet had those spaces but they were impossible to see on my iPad.

Save and exit and if all is well the camera will start taking pictures at a 1 minute interval. This can easily be changed, for example */15 would take images at a 15 minute interval.

If an error message is shown when you exit from crontab go back and check the code.

Controlling Cron.
sudo /etc/init.d/cron stop
sudo /etc/init.d/cron start
sudo /etc/init.d/cron restart

All the images will be in the Timelapse folder and a programme like AVIdemux can be used to stitch them into a movie.

OLED displays do not have reverse polarity protection!

As if this weekend was not bad enough after I fried my Raspberry Pi, I managed to destroy a brand new OLED display. I mistakenly reversed to power leads and that was the end of that. In future I will double check all the connections, I just have to hope that the old saying of things come in threes is not true.

Disaster with the Raspberry Pi camera.

I was running a few tests with the Pi camera when I dropped it, now the cable is just the right length so that the back of the camera hits the GPIO pins. With that the camera would no longer work and every time I tried to connect it I got the following error report:

received unexpected camera control callback event 0x4f525245

2015/01/img_1599.png

When I Googled this error I found it was a fairly common problem and that it meant the camera was dead. I tried a new camera but that also gave the same error. At this point I began to suspect I had corrupted the operating system, so I built a new Raspian SD card, but the camera still would not work.

When I tried both cameras on another Raspberry Pi they both worked, so I had not fried the camera but the Raspberry Pi instead. The camera is cheaper than the Pi so in some ways I would have preferred it to have been the camera that had died. At least the Pi retains some functionality, it just will not operate a camera.

The moral of this tale is that it is necessary to take the greatest care when handling that tiny camera and that sometimes the Internet may not have the right answer.

Weather Balloon 2. Connecting the Pi to an iPad

Most of the software I have had running before except for the radios. The first task was to try and link the Raspberry Pi to my iPad so that I could control the picture taking from the ground. Easy to do when everything was connected to my WiFi at home but could be a problem in the middle of a field.

I had an unused ZyXEL router which could be powered from a 12 volt battery and I used the following procedure to connect it. Ensure the router is reset to factory defaults and no password is set. First I connected the iPad using VNC to the WiFi in the normal way, turned on the router and waited for a few minutes to make sure that everything had settled down. I opened the wpa_gui on the Pi and clicked on the Scan button.

2015/01/img_1596.png

After a few minutes it found the ZyXEL router, click on the drop down list in the network box, then double click on the router. Everything will now stop because the VNC program has lost contact with the Pi.

2015/01/img_1597.png

Close down VNC and go to settings on the iPad in WiFi settings select your router and once it’s connected restart VNC and the Raspberry Pi desktop should appear. Of course it will not be possible to access the Internet unless the router is connected to the Internet.

Weather Ballon 1.

The first of what should be a series that will end in mid June 2015. I have just purchased a 2.5 metre weather balloon and six canisters of Helium to fill it with. The plan is to fly the balloon over the Isle of Wight Festival site in mid June. A Raspberry Pi with camera will be used to take pictures and video while an Arduino will be used for control and to collect sensor data. I hope to use radio links and WiFi to control the picture and video taking.

I only have the ideas at the moment and the means of achieving them remain a mystery. The available hardware at the start of the project are a Raspberry Pi Model B, several Arduino boards and a variety of sensors including GPS. EasyRadio USB radios will be used for control although I also have a pair of NRF24l01 radios that could be used. A Pi camera and a 7.2 volt LiPo battery complete the hardware at the start.

I have no idea how much Helium is going to be needed or what the problems are going to be trying to inflate it, but I expect I will discover that when it come time to fill the balloon. The payload is another unknown, one Internet source quoted at least 2kg but I will believe that when I see it. A bare minimum of hardware – Raspberry Pi, camera and LiPo battery is just over 100 gms, so there should be no problems.

Arduino and the BMP085 environmental pressure and temperature sensor

2015/01/img_1582.jpg

The BMP085 I have is an I2C device with seven pins, but only four, Vcc, Gnd, SCA and SCL are used (pins are in that order). I found a number of sketches but feel that the best was the one on the Adafruit site,

I made one small change, I wanted to plug the sensor straight into the Arduino, so I made A2 and A3 power pins. If you want to do the same insert the following code into the sketch at the start of the void setup() loop


pinMode(17, OUTPUT);
digitalWrite(17, HIGH); // make this pin 5 volts
pinMode(16, OUTPUT);
digitalWrite(16, LOW); // make this pin Gnd


Just a word of warning if you do this, make sure your board needs 5 volts not 3.3 volts to power it and also make sure your pinout matches mine!

The altitude is only correct if you know exactly what the pressure is at sea level as this sketch assumes it is 101500 pascals. Height is calculated by knowing the difference in pressure between your location and sea level.