This is the control software for the noderockets water rocket.
Read more about it at http://www.noderockets.com/
This project uses a Raspberry Pi in a soda bottle water rocket to do the following:
- Measure the altitude of the rocket.
- Deploy a parachute soon after rocket apogee.
- Take pictures/video during flight.
We have an SD card image all ready for you that has all of this pre-configured. Download it here.
You need an SD card that's at least 4GB. Install the image to your SD card using the Raspbian installation instructions.
This image is configured to run the rocket and the camera software automatically on bootup.
Install Raspbian
- You need an SD card that's at least 4GB.
- Download the base Raspbian distribution from http://www.raspberrypi.org/downloads/
- Install Raspbian to your SD card using these instructions
- Put the card in your Raspberry Pi.
- Plug the Pi into your network - it's already configured for DHCP.
- Connect the power to the Pi.
- If you have a monitor and keyboard connected to the Raspberry Pi you can login as user pi with password raspberry. Otherwise you can check your router for the Pi's IP address and connect vi ssh using the same user and password.
Install Prerequisites
- First update the OS:
sudo apt-get update
sudo apt-get upgrade
- Checkout and build pi-blaster. Pi-blaster enables PWM on the digital GPIO pins, making it possible to control a servo motor.
git clone https://github.com/sarfata/pi-blaster.git
cd pi-blaster
sudo make install
Pi-blaster will now start automatically on reboot.
- Enable the GPIO i2c modules. Edit /etc/modules:
sudo nano /etc/modules
You need to add these two entries to the file:
i2c-bcm2708
i2c-dev
Edit /etc/modprobe.d/raspi-blacklist.conf
sudo nano /etc/modprobe.d/raspi-blacklist.conf
You need to make sure the following entries are commented out in the file:
#blacklist spi-bcm2708
#blacklist i2c-bcm2708
- Download and install nodejs.
cd ~
sudo wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
- Reboot
sudo reboot
Rocket Software
Clone and build the noderocket-rocket project:
git clone https://github.com/noderockets/noderocket-rocket.git
cd noderocket-rocket
npm install
This takes quite a while as it downloads and builds all of the dependencies.
You need to run the project as root for it to have access to the GPIO pins.
sudo node server.js
You can access the rocket UI by entering the Pi's IP address into your browser.
Make the rocket software run automatically
- Install forever globally:
sudo npm install -g forever
- Copy and install the init.d script to start and stop the rocket:
sudo cp etc/rocket /etc/init.d
sudo chmod +x /etc/init.d/rocket
sudo update-rc.d rocket defaults
- If you didn't clone the rocket project to /home/pi/noderocket-rocket, edit /etc/init.d/rocket and point ROCKET_HOME to the correct path.
Configuring the Camera
- Enable the camera by running:
sudo raspi-config
Follow the menu to enable the camera, then finish.
- Reboot the Pi.
- Install some packages:
sudo apt-get install libjpeg62-dev
sudo apt-get install cmake
- Clone and build the MJPG Streamer project. This is an experimental version that uses the raspicam input plugin.
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer
sudo make install
- Run the streamer with this command:
mjpg_streamer -o "output_http.so -w /usr/local/www" -i "input_raspicam.so -fps 15 -q 50 -x 640 -y 480"
This will run the streamer with a frame rate of 15 and an image size of 640x480. This gives a pretty good result with low load on the Pi. You can look up the other input options at https://github.com/jacksonliam/mjpg-streamer.
- Open the streamer in your browser at the Pi's address, port 8080 - http://pi_address:8080
Make the camera software run automatically
- Copy and install the mjpg_streamer init.d script from the noderocket-rocket project to start and stop the camera:
sudo cp ~/noderocket-rocket/etc/mjpg_streamer /etc/init.d
sudo chmod +x /etc/init.d/mjpg_streamer
sudo update-rc.d mjpg_streamer defaults