The camera works! Here is me thinking:
The reddish hue is due to this being an IR camera.
Monday, May 12, 2014
Hardware
In my last post I discussed how to log into the Pi with SSH, and start taking data. Today, we will dig into the code and see what this program is actually doing.
We start by importing Adafruit libraries for these sensors. This allows us to use basic functions to talk to and control the sensors and not have to "reinvent the wheel" every time we need to do something. I have taken screenshots of the rest of the code, and I have made comments in red describing what the program is doing.
And that's how it works! Here is a link to the data log
However, as I look at this, I realize that I need to do more work to get useful information from the accelerometer and magnetometer.With some work you can do some pretty cool things with this information.
Here are some leads...
Sunday, May 11, 2014
Setting up SSH
Hey everyone,
We have made quite a lot of progress on the Raspberry Pi. I've got it sensing GPS, pressure, temperature, compass heading, and taking HD pictures along the way. So I'm going to walk you through what I've done. Today I will start with opening an SSH connection and running the data logging program.
SSH
To make the Pi easier to work on, I've been using SSH. This allows me to control the Pi from the command line over the university network. The benefit to this is that I don't need two keyboards, two mice, a monitor, and an extra USB hub; and all that can make it a pain to set up and take down. All I need to do is hook my Pi up to the network. I hope to be able to network the Pi straight to my laptop, which would make it easy to start collecting data even in a remote area -- but I haven't gotten that far yet. Here is how to log on to the Pi via SSH.
First, if you are using a Windows machine, you will need to download Putty. Putty will open up and look something like this:
Then, you will want to enter the IP address of the Pi. (137.28.116.63)
If for some reason the IP address has changed, you can look it up on the Pi itself by using the command.
sudo ifconfig
in the Raspberry Pi terminal. Yes, unfortunately, you will need to set up the monitor, keyboard, and mouse for this... The result will look like this: (I highlighted the IP address)
Once you have the IP address, you can enter it in the "Host Name (or IP address)" field.
Next, you will be directed to a login page on the PuTTY terminal. It might first give you a warning pop-up, but you can disregard this. Log in like this:
login as: pi password: balloon
Note: when you type the password, it won't appear on the screen -- this is normal.
And then you're in!
To work your way around the command prompt, you will need to know some basic Linux commands. It might look intimidating at first, but the basics really aren't that bad. First, it might be helpful to change from a black to white background, otherwise blue is very difficult to see. You can do this by right clicking the top window bar, select "Change Settings...", go to Window, then Colours, and change "Default Background" to white.
To look at the current directory (directory is a computer sciency name for folder), use the command ls. This helps you keep track of where you are in the computer, and what files are in that current folder.
The code that I am using for this project is in the "Adafruit-Raspberry-Pi-Python-Code" directory. To navigate to it I use "cd", which stands for "change directory". Below, I use this command and then ls again to show the contents of Adafruit-Raspberry-Pi-Python-Code. (Note, you don't need to type the whole address, simply type the first couple letters and then hit the tab button. The computer will complete the rest.)
The code we are using is in "PiBalloon"
Before you run the program, we have to do a couple of strange things to get it to work. For some reason, the GPS doesn't often work without resetting it first, so that is what we will do.
So that's all there is to it. To run the program, type:
sudo python DumpInfo.py
The program will start taking data from all the sensors and taking pictures every couple of seconds and dumping that data into a comma-separated values (CSV) spreadsheet. To stop taking data, press CTRL+C. You can disconnect the Pi from the SSH connection if you wish, and it will continue to take data. When you next access it from the command line, you will need to do something different to stop the data collection. Type...
sudo killall DumpInfo.pyTo look at the data you just took, open the file DataLog.csv in the PiBalloon directory using the "cat" command.
You will also notice some new JPG files in the directory. Those are the pictures that the Pi took. I don't yet know how to view them over SSH, but you can view them from the Raspbian GUI
That's all for today!
Will
Subscribe to:
Comments (Atom)
