Pizazz Robot (Raspberry Pi)

From ipswichmakerspace
Jump to: navigation, search

Description

The Pizazz is a two wheel drive line following and collision avoidance robot supplied by 4tronix and represents an ideal starter robot for anyone interested in making their Raspberry Pi mobile!

http://4tronix.co.uk/store/index.php?rt=product/product&path=66&product_id=340

The kit is well made and can be put together in less than 30 minutes, the only thing that confounded me was that my B model Pi is a very early one with no mounting holes so had to fit the Pi into half a Pimoroni case and then bolt that to the robot.

Pizazz3.JPG

Along with a motor control board the kit comes with line following and ultra sonic distance sensors, making it very good value for money, although for a few quid more you can get a more powerful controller board with additional I/O.

I have added the Pi camera in a ModMyPi enclosure that sits slightly proud of the battery case.

Pizazz1.JPG

The Pi also sports an Edmimax Nano wireless dongle, to allow complete freedom of movement.

Software

The Basics

       Raspian image from Noobs 
       NFS demon - apt-get install nfs-kernel-server - to allow mounting of the pi's user space for updating software.
                  (apt-get purge nfs-common rpcbind then reinstall if problems, then edit /etc/netconfig and disable the lines that configure udp and tcp settings for IPv6)
       SSH demon - to allow remote access from PC
       Enable Pi Camera

The Camera

To get the camera to stream video, I found this source code https://github.com/codemonkeyricky/pi_streamer and reduced the bit rate and resolution down so to reduce lag, although its still lags a couple of seconds behind "live", so needs a bit more work.

The stream can be view in VLC as rstp://<Pi IP Address>:8554.

       https://www.youtube.com/watch?v=yvpNA0s2oi4 
       <include iframe width="420" height="315" src="//www.youtube.com/embed/yvpNA0s2oi4?rel=0" frameborder="0" allowfullscreen />

Remote Control

Using the sample Python code, I a created a "listener" application on the Pi which runs a small web server to listen for HTTP Get requests with commands in the query string like:

  http://pizazz:3333/pizazz?mov=F for forwards or http://pizazz:3333/pizazz?mov=L for left

This means that I can test the code with a web browser on the same network.

Web API

Once that was working I also created a small web page on my ubuntu box to use jQuery with Ajax as a faster method of testing.

ControlHTML.png


Here is a code fragment showing the embedded java script calling the web methods on the Pizazz.

<script>  
 function forwards() {
   $.ajax({
           url: "http://pizazz:3333/pizazz?mov=F"
   });	
 }
 function backwards() {
   $.ajax({
           url: "http://pizazz:3333/pizazz?mov=B"
   });	
 }
 ... etc ... 
</script>

Android App

Finally I created a small app in Android Studio which consists of a ViewView above 5 buttons, which essentially does exactly the same as the webpage.

RobotSelfie.png


Action Video

The video stream did keep hanging but I appear to have cured it by seeking to 1 ms once its starts buffering. Anyone with knowledge of streaming on Android please get in touch.

Here is a video of Pizazz in action.... (Video by Little Miss Shaky Cam )

   https://www.youtube.com/watch?v=0as1Z2LS6xo

Future Plans

I still need to improve the video to reduce lag and update the web api to support individual setting of the motors for fine control (see the control html page) and of course every thing needs refactoring and could be improved. I also want to improve the autonomous functionality but allowing the remote to override the robots software if it gets stuck etc.


This is an attempt to document the steps required for this project, apologies if anything is unclear. Please add any questions to the bottom of the page, and I will attempt to expand the page to answer them.

Pizazz2.JPG

FAQ

Ask questions here please

What software was used to develop the phone application?
The phone app was developed using Android Studio from Google. https://developer.android.com/sdk/installing/studio.html