Skip to main content

Raspberry Pi bot progress

I've been chipping away at my Raspberry Pi/Arduino bot here and there so I decided it was time for an update.

Basic Controls

I've added more general functionality, such as turning left & right. That was easy with Firmata by setting a pin to a mode such as Digital Input or PWM and setting it Low. For example
this.firmata.digitalWrite( this.right.forward.pin, this.firmata.LOW);
would turn the stop the right wheel from moving forward.

Mobile-first UI

Once I got the new controls wired into Socket.io, I improved the interface. I forked a neat little project called virtualjoystick.js /by +Jerome Etienne. It is a canvas joystick library that supports touch on mobile (with a mouse fallback.) The primary directions are mapped to their respective socket.io method calls. Therefore, I can drive the bot directly from my android phone's mobile browser. While it doesn't show much, here's a screenshot:

Easy remote access with localtunnel

When building an internet-enabled device, you need to a way to get to it through the internet (duh.) Using an internal IP works when you're on the same network. When outside the network, you need a proxy of some kind. Localtunnel is "the easiest way to share localhost web servers to the rest of the world." There's a great port for Node.js that I got working in minutes.

Simple app for accessing multiple devices

I could get the local IP & localtunnel url and write it to std.out but that's not useful from my phone or laptop. I wrote a simple App Engine app I'm calling DHD that logs devices and their addresses. Here's another mildly-useful screenshot:
It basically takes a POST and stores it App Engine's NoSQL db. Nothing too fancy, really. I imagine that addressing is a common problem for networked/internet-connected devices (I wonder how other projects like Electric Imp deal with it?) I may open source the code when it becomes more sophisticated, seeing as other internet-connected device projects might need something like a DHD.

Next Steps

Software

I plan on writing an init.d script that uses Forever to fire up the bot code whenever the machine starts & always keep it running. I also would like a shell script that tries to join open networks when nothing else is found.

Hardware

I picked up that Rover 5 from +SparkFun Electronics as well as a sweet accelerometer, gyro & compass unit from +Pololu Robotics and Electronics. Between having more motors, optical encoders and the IMU might mean I need to upgrade to an Arduino Mega. No biggie.

I still have a pipe dream to do some OpenCV/SimpleCV tracking or use an obsolete CMUcam I have lying around. We'll see.

Hopefully I'll have some more fun updates the next time I decide to blog.

Cheers,

Popular posts from this blog

My weekend project: an Arduino, Raspberry Pi & Node.js robot

Yes I know, I'll get more buzzwords when I my JavaScript creates Cloud Synergy - but after I Pivot.




I've been spending my wee few hours a week designing, tinkering and finally building my little robotics platform. I've had ideas brewing for a while but haven't had enough time outside of work to start hacking.

It all started when I first saw Rick Waldron's Johnny Five framework for Node.js.
Sensors are asynchronous, so, ya, a node.js robot framework makes sense. A few months later I started sketching designs, reading up on firmata and buying my arduino & Pi.

Before the what & why, here's the basic BOM:
1 Arduino Uno R3 running firmata1 original Raspberry Pi with Raspbian, Node.js & 4gb of storage1 Magicians chassis1 SN754410NE Quad Half H-Bridge to drive the motors1 dual-output mobile battery backA custom mount for the Pi & some custom USB cabling for power Why Raspberry Pi The main controller is a Rpi. It turns 2 small motors by delegating instru…

A Maker's Equipment List

I've been building up a nice supply of tools and components so I decided it is high-time to build a small workspace in my tiny SF apartment. There were things I knew I still needed but wrestled with some tough choices (like which Oscilloscope to buy.) I wanted either a nice Wishlist on Amazon or at least a great list to start my journey. I found a few decent starting points in the form of video & blogs:
How to set up an electronics lab/workshop at homeSo You Want to Build ElectronicsHow to equip your EE lab The first link is actually a transcription from +EEVblog /by +Dave Jones (EEVblog is an awesome blog and YouTube channel, you should subscribe.) The second blog /by +Kenneth Finnegan covers more of the components side.

What I couldn't find is a complete compiled list with links to purchase. So I made one! I put together a simple Amazon Affiliate store called Maker Workbench Equipment List. I merged what I thought made sense and added a bunch of items I think any good Mak…

Easily switch between different versions of GCC ARM Embedded

I need to switch between different versions of GCC ARM Embedded somewhat often. I couldn't find a good solution online so I threw together a simple shell script to simplify the process I call switch-gcc-arm. Here's a screenshot:


The script is pretty simple, even for a bash n00b like me. It uses symlinks so that standard make files work:

For each version of gcc you want to support, you'll need to add it is as an elif statement and add it is as a new option. The script creates a "virtual" $BIN directory that points to whichever version of gcc you need. Make sure you add the path to the folder where you placed the script, as well as the $BIN path you set as the virtual bin directory. I add the paths to my .bash_profile and rely on the system keeping the last-used version of gcc.

Hope this helps someone. Any suggestions for improvements?

./bbk