So at PingBin we have decided to start doing a weekly round up of the great Raspberry Pi projects, the plan is to have one of these every week assuming you Pi hackers pump out enough cool projects that we can blog about, if you have any projects you would like to mention just pop up an eMail or Tweet.
Time to get started!
SnowBoarding HUD Pi Style
So first up is a great SnowBoarding HUD (Heads Up Display) from a guy named Chris, check out his Blog Post here. The Hack is basically using some MyVu Glasses and building them into a set of normal snowboarding goggles, the MyVu can interfaces directly with the Raspberry Pi’s normal video output interface (not HDMI) which makes the Python code a lot easier to write as it’s just a generic display.
Along with the Pi and Glasses there is also a battery back to provide enough power while throwing yourself down the slopes, and a GPS dongle which means using the power of python your going to get some great features such as, accurate speed, mapping routes, top speed etc…
All in all it’s a great project, however at £160 it’s certainly not the cheapest.
Need some help parking?
The next project again uses some nifty Python programming, this time Jeremy (blog) has used some Python with a webcam and small LCD display to measure and display distance readings to a user for help parking, it certainly better than them annoying beeps you get from most reversing sensors these days.
As with most great projects all of the coding is on his blog if you want to make your own or just have a play around, plus the distance measuring is also covered on another blog post by Jeremy which we have covered before. Keep up the great work and our only request would be to integrate that bell as well 🙂
Finally some news…
A bit off track here but this week Sony announced that they have created their 500,000th Raspberry PI board in their new factory at Wales, that’s actually doing a production rate of 40,000 Pi’s a week, now that’s a lot! At this rate we are expecting 1Million to be created some time in July. If you want to read more on that story click here.
In this post I will take you through the fairly simple task of getting your Raspberry PI to control an LED via the GPIO interface, the task is simple however it lays a great foundation of knowledge for any further projects where you want to interface with an external electronic device.
So the first step is to install some software on to the Raspberry PI operating system via terminal or a remote SSH session. We actually want to install “wiringPi” however to do that we are going to use the very popular version control tool “git”, which should explain the following commands.
1. Software Setup
First we will install the core software required for git to work:
sudo apt-get install git-core
Next it’s aways best to ensure that our device is on the lastest version of software, so we will do an update and upgrade, depending on how long until you last did this it could take a while, coffee anyone?
sudo apt-get update sudo apt-get upgrade
Ok so your back after the software update, now we are going to download the latest release of wiringPi;
git clone git://git.drogon.net/wiringPi
Now go into the directory and just double check with the pull command that you have all the required files.
cd wiringPi git pull origin
Now time to build the software with a command that’s fairly easy to remember:
For the physical setup you will need an LED of your preferred colour, a small 270 ohm resistor and some wire to connect everything together. I would recommend using a breadboard as well it makes all this cabling and prototyping far easier to setup and tweak.
Below is a very simple diagram on how to setup your circuit.
So now it’s time to make a really simple script, paste the following into your terminal session:
gpio mode 0 out; while true; do gpio write 0 1; sleep 1; gpio write 0 0; sleep 1; done
Note: Control + C will exit the program.
Let us know how you got along in the comments below, I will be adding another guide soon on how to get a few LED’s all working.
The Raspberry PI is perfectly equipped to turn your USB based web cam into a fully functional IP web cam that you can have lots of fun with, from there you could use tools such as Python to make your project more unique, im having a go at counting passing traffic.
If your wanting to something a bit more simple you could just have a web cam that can be access from anywhere with an internet connection, which is what you will end up with at the end of this guide.
Your shopping list…
- Raspberry Pi with an OS installed
- USB Powered Hub – Amazon UK – Amazon US
- Important; This one worked for me, however it’s not worked for others, you will find this is the case with a lot of the powered USB hubs, research before buying.
- We need a hub because the camera’s draw more power than the Raspberry Pi can actually provide, you see the same with some keyboards and USB dongles.
- Web Cam
You could also look at an external power back and WiFi if you want to make it mobile, a few people have put these in a garden or somewhere without a static power/network source.
1. Get the software ready
To start with we’re assuming that you have a working Raspberry Pi on a local network with internet access, the next step is to update your Pi ensuring that you have the latest software and drivers installed.
sudo apt-get update sudo apt-get upgrade
Next it’s time to install the software, and we’ll be using a fairly light weight application called Motion, this will do a few things for us including accessing the USB camera, getting the images, and streaming them via a built in web server. As the name suggests it will also track and trigger events on motion detected in the video frames (more on that later).
sudo apt-get install motion
2. Plug in your web cam
So now the software is on there it’s time to plug in the web cam and ensure that everything is working, ensuring that you plug it into the powered hub, and then into the PI. Otherwise the webcam will not get enough power to turn on.
When plugged in type the “lsusb” command, you should see a line there with your web cam manufacture, that proves that you have the basic connectivity working.
lsusb .... Bus 001 Device 002: ID 04ea:1142 Microsoft Corp. ....
3. Configure the software
sudo nano /etc/motion/motion.conf
In here there are a few basic changes that you need to perform:
- Daemon = OFF to ON
- webcam_localhost = ON to OFF
You can change other settings but it’s recommend you don’t take more than 2 frames, and you been the default frame pixel size, for stability.
4. Start the software
To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:
sudo nano /etc/default/motion
Then change the value “start_motion_daemon=no” to “yes”
Finally you can start the motion service to stream the web cam images
sudo service motion start
Then after about 30 seconds browse to the new web interface, which should be at the below URL (where 192.168.0.100 is your Raspberry PI’s IP address)
5. Final Tweeks
You could change the web interface port to 80 (from the default 8081), so that you can just browse to the IP address without having to put :8081 at the end, it’s really simple to do, just:
sudo nano /etc/motion/motion.conf
And then change “webcam_port 8081” to “webcam_port 80”, save the file, and restart the motion service.
sudo service motion restart
Final suggestion is enable port forwarding on your home broadband router to the Raspberry PI on port 80, that will mean you can access the web cam from anywhere in the world. There are too many routers in the word to explain how to do it here, but I am sure you will find some help on Google, if not please just leave a comment.
Warning; If you give it internet access via port forwarding this does take up quite a bit of bandwidth, and anyone can see your webcam feed, so only show what you want people to see 😉
Well the last few days have been interesting for me, here is a brief overview of what went on.
A lot of my blog posts are cobbled together in around 10-20min with a bit of effort put in but nothing really too taxing, in one of my latest posts I decide to write a brief list on “30 cool ideas for your Raspberry PI project”. As you can see in the screenshot it was a fairly boring bullet point list of 30 things with links to external sites where you can read up in more detail on a project of choice.
Well after a few days the traffic started coming in from Google and I was quite content with my new blog post, while trawling through Google Analytics I noticed a bounce rate of around 90% for that page, well that sucks! First page on Google for “Raspberry Pi Ideas” but no one wants to actually read the content.
The website had also been submitted to a few social sites with similar disappointing interest, however to be honest I completely understand why! only one other up-vote on the screenshot below:
So the plan was to revamp the page and see how that affected the bounce rate, basically I got some pictures for each of the 30 things and put them in a clean and simple HTML table, it did look considerably better for only a few minuets more work, how about another screen shot for comparison? Ok there you are at the right.
As I finished updating the layout I decided to resubmit the page to one social news site (hackernews), then monitored the traffic using Google Analytics real time to get a better idea of what people are doing.
Two active visitors, Ten, Thirty, cool people are actually looking at the content now and not bouncing straight away to another site!…. Eighty visitors now, Two Hundred active visitors…. What’s going on here??
Well it turns out people did like the new design/layout even though the underlying content was exactly the same, and I was now on the front page of hacker news, peaking around number 3 and averaging around number 6 most of the time.
Everything Broke when the internet arrived
Over the next few hours I was battling trying to keep the server online, I might go into this a bit further in another post once I get some more metrics. However the basics are that CloudFlare (CDN function) didn’t really help because it was PHP based CPU load that was killing me, not throughput. W3cache using a Memcache backend really saved the day, NewRelic is awesome for monitoring my configuration change effects in real time, and finally CDN77 has 100GB of free bandwidth which is also nice when you need some help ?
Even More traffic now…
Just as the site was back on it’s feet people started flooding in from Twitter, Reddit (Raspberry_Pi) and also Google +1, people actually use Google +1 well that was news to me! Actually it’s just edged out reddit for the second spot in Social traffic sources.
Another thing I have noticed, while the hackerne.ws traffic is fairly dependant on been on the front page it appears Reddit and Google are much more stable (so far), I expect this is because they have less churn of stories in their respective sections.
The site has now been fairly stable since the recent changes, and there is still a steady flow of traffic from some of the sources.
(Stats for last 36 hours only)
- Put more effort into design, people like nice pictures and layouts
- CloudFlare + Nginx isn’t a solution on a slow server, get caching on there (memory not disk)
- CDN’s don’t really help with CPU usage too much
- As always, keep your solution simple (Memcache > Varnish)
- Will do a more technical post soon!
- Front page of Reddit for a few min
- Front page of hackernews for 24 hours+
Quite a few netgear devices come with a hidden page that you can browse to, this will then enable Telnet access on the device. However it looks like on the DGND3700 this page has actually been removed from the code base. Fortunately there is still a way to enable Telnet access to this router.
1. What you will need:
- Download: Telnet Enable Netgear
- Windows Machine, download the file here
- PC on the same LAN as your router
- Administrator rights on your local machine
- Now you have downloaded the file from step one, extract it, and place the enclosed .exe on your desktop.
- Open up a command line window
- Hold the windows and ‘r’ key
- Type in the window ‘cmd’
- Press enter
- In your command window enter the below command, and look for the physical address (MAC Address) for your router (normally 192.168.0.1).
- arp -a
3. Enable telnet
Run the below command to enable telnet, don’t forget to change the IP and Physical address to match your setup.
telnetEnable.exe 192.168.0.1 A021B78B0DC4 Gearguy Geardog
- telnetEnable.exe – is the script name
- 192.168.0.1 – your router IP address, as you use to manage via the web interface
- A021B78B0DC4 – Your physical address, from step 2
- Gearguy – The default user, case sensitive!
- Geardog – The default password, case sensitive!
Or if you plan on doing a lot of work on the router I would suggest downloading a client like PuTTY
If your propmeted for a username or password use the ones mentioned in step 3.