Investigating Node.js for Raspberry Pi Robotic Vehicle

I’ve been looking at alternatives to WebIOPi since it is no longer maintained. I have successfully built a few, small vehicles running WebIOPi but it seems that the project is no longer supported. I was also never satisfied with the latency when moving the vehicle or servos attached to it.

I’ve worked with Node.js before but was not aware that you could use it to create the PWM signals that I normally use to control the motors on my vehicles. I have developed larger vehicles now, with tank tracks, that use 12 volt drill motors. I use Radio Controlled ESC’s (Electronic Speed Controllers) to handle the increased voltage and amperage. This is a small tracked vehicle I built controlled by Node.js, Johnny-five and Raspi-io. I deploy an ad-hoc network on the bot for a connection.

Just a side note. I built this vehicle from spare parts and junk I had in the garage. The frame is made from crutches. The track wheels are from an old set of roller blades. The tracks themselves were made from rubber tarp straps. I cut the metal ends off and spliced them together. I then screwed metal stitching plates used in construction between the two straps. Topped them off with strips of rubber that I cut up from a spare BMX tire. Motors are cheap drill 12V. I bought two 30amp RC ESC’s on Ebay for the connection between the Raspberry Pi and the motors. I used PWM signals to make them go forward, backward and define the speed.  I built my own dashboard to control it. Using the extensions of Node called Express & Socket.io to do this through a browser.

These are my notes so far while installing Node.js and other components.

  1. Intall Node using the ARM package
  2. Install the Pi-blaster daemon
  3. [sudo git clone https://github.com/sarfata/pi-blaster]
  4. [sudo apt-get install autoconf]
  5. [cd pi-blaster]
  6. [sudo ./autogen.sh]
  7. [sudo ./configure]
  8. [sudo make]
  9. [sudo make install]
  10. [cd ..]

Create a folder for your project.

Install the node modules that you need. Express, socket etc..

 

 

 

 

 

quick2wire-gpio-admin

If you are using quick2wire-gpio-admin, you’ll need to make a few changes to make it work.

https://github.com/quick2wire/quick2wire-gpio-admin/pull/6

In src/gpio-admin.c

Change this line 30  int size = snprintf(path, PATH_MAX, "/sys/devices/virtual/gpio/gpio%u/%s", pin, filename);
To this --          int size = snprintf(path, PATH_MAX, "/sys/class/gpio/gpio%u/%s", pin, filename);

Did a “sudo make uninstall” from within the quick2wire-gpio-admin folder, then “sudo make install” and added the user “sudo adduser $USER gpio” (where $USER is your user..). Logout and login,