Quick demo video and current status

I just figured out that I always show my work in progress, but I never show the car when it is working. So here it is, a small video showing the car as its current status.

I totally rewrote the iOS application. I wanted to make some big changes with the software architecture, and I decided it was a good opportunity for me to learn deeply the Swift language. So I rewrote everything from Objective-C to Swift.

And for those who don’t want to read my previous post and want to know what I am talking about : I took a RC car, removed the radio part on the car, and replaced it by my own hardware. This now allows me to pilote the car with an iPhone or an iPad, and with a video feedback from the camera I installed on the car. And here is how it works :

  • a standard RC car I bought (not too cheap, it has to have standard components and connexions, like a standard servo motor and brushless motor). I removed the radio part and controls now directly the brushless motor and the servo motor for the direction.
  • a Raspberry Pi B+, running with Arch Linux OS, which is lighter than the Raspbian installed by default on a RPi.
  • on the top of the Raspberry Pi B+, a daughter board I conceived and made manufactured. On this board, there is :
    • power management : it take the 12V from the battery, makes +5V and +3,3V for the RPi, the servo power, and the PIC. It is done with a PWM power controller so there isn’t too much power loss from the battery, and not too much heat dissipation needed.
    • dsPIC33 : a 16 bits dsPIC which manages :
      • the control of the servo and the motor; it generated the 1ms to 2 ms pulse required
      • PID control of the motor: there is a sensor coming back from the motor to the PIC for that, but it is not yet implemented in software.
      • power monitoring : there is a divisor bridge on the +12V coming from the battery, and going to an ADC of the PIC so the battery level is monitored. This currently works but I am still calibrating it.
      • status leds : the PIC just blinks the status leds
    • Status leds :
      • 1 indicating if the hardware is powered
      • 1 indicating if the PIC is running
      • 1 indicating if the RPi is running and communicating with the PIC
  • A camera on the top of the car; it is the standard camera sold for the Raspberry Pi. The video streaming is made with GStreamer, it is an open source library made for video streaming. It is quite light, it has been ported on almost all possible OS (including Arch Linux and iOS for my needs); and most important it can achieve streaming with a very low latency.
  • a headlight at the front of the car. It is composed by a small PCB with 8 white leds. And it is here not only for fun, but when it test the car in low light conditions, it is very useful !
  • An iOS device. My Application works on both iPhone or iPad. Currenlty the application has the following features :
    • display the video streaming coming from the car, with a very low latency
    • allow to control the motor and the direction of the car. There is also a manual break, and a command to change the lights on the car, or even flash the headlights.
    • modify the motor cartography, this allows me to decrease the maximum speed of the car (which is too much powerful, especially when used inside), and to give a little more power when the starting the car. But for sure the possibilities are endless, the cartography is fully configurable.
  • A bluetooth gamepad, made for iOS, it is optional, but it is much more easy to control the car with rather than with the iOS device itself. I won such a device several month ago; it is a Mad Catz C.T.R.L.i gamepad, and it works great.

I thinks that’s it for now. So the only thing in the list above which does not work yet is the PID controller for the motor, everything else works. I also have to mention that each system (the Raspberry Pi, the iOS application and the PIC) has its own failure management, each of them is able to detect if it is still communicating with the other parts, and if there is a problem of communication, the car is stopped, and the servo and the motor are put in an idle position. The iOS application and the Linux software react in 1 second, and the PIC reacts in 200ms.

Sorry for the long post, and I don’t have any potato. Next step : the PID controller, stay in touch.

Migration from Rasbian to Arch Linux

It has been a very long time since my last post about my RC car; I have made some progress since then, my car works perfectly when I control it from the iPhone or iPad app. Since the first try, I decided to develop my own PWM driver, because the one I was using didn’t have a good enough response time for my needs; and with my own driver, it works great, the car responds quickly to commands. This change was only possible because I bought a Raspberry Pi B+, which now has the 2 pwm channels outputs available o the extension port.

DSC00390

So today I decided to migrate the Raspberry Pi of my RC car from Rasbian to Arch Linux, because Arch Linux is supposed to be a very light and easy to use embedded Linux distrib.
I was not disappointed, the operation was quite easy, I just followed the steps on this wiki : http://archlinuxarm.org/platforms/armv6/raspberry-pi. I created my sd card with an old ubuntu I have, because I didn’t have time to try to do it on Mac OSX, but maybe later I will try and post the steps here.

Then I had to make the wifi work (as a client), I also just followed the steps on the arc linux netctl wiki https://wiki.archlinux.org/index.php/Netctl. All I needed was to install some package, but no worry, they are automatically suggested when you follow the steps.

Last step, make my own daemon work on Arch Linux, the only difference was to migrate the daemon system to systemd. I started to use systemd recently, and I find it quite powerfull and easy to use. So I just made that service file :

 

# PiCarux

[Unit]
Description=PiCarux Daemon
After=netctl@wlan0\x2dLivebox\x2dUnsigned.service

[Service]
Type=forking
ExecStart=/root/picar/PiCarux

[Install]
WantedBy=multi-user.target

That’s all for today, next step (and a big one) : I just order a RPM sensor for the brushless motor and I want to use it to apply a PID controller. I will first need to find out how the sensor works (there is no description of the kind of signal it sends), the I will have to manage to capture the signal of the Raspberry Pi (that could be hard assuming the signal could have a quite high frequency), and last I will have to develop my PID algorithm ! A lot of work to keep my mind up during the winter 🙂