Integration in progress

I am currently finishing the software of the dsPIC for my new hardware.
I am integrating the features progressively, and it is almost done. I can (eventually again) control the motor and the steering of the car.

The longest part was to develop the SPI drivers on both the Raspberry Pi and the PIC. I chose to used the 2nd SPI peripheral of the RPi, which is part of the auxiliary peripherals (called universal SPI master in the datasheet), and does not work at all like the main SPI controller (which of course I did not check before…). And as usual the documentation of the RPi was not very precise. The most weird problem I faced is that the RPi SPI outputs the LSB of the data first by default, which is very unusual for a SPI bus. There is a parameter to output MSB 1st, but when you choose it, it outputs the MSB of the 32 bits buffer register, and I had configured to output a 16 bit value, so all I had was some zeros on the bus. It took me some time to understand the trick.

As you can see on the pictures, I also added a light on the front of the car, and this is not just for fun, I often perform my tests when it is dark outside, and I cannot see anything on the camera if there isn’t some good light.

I still have to finish and calibrate the software which measure the battery level, and I have to develop the PID controller for the motor, I did not start this part at all.

PCB for daughter board received

I just received today the PCB for the daughter board for my RC car I was talking about in the previous post.  I am glad because the manufacturing looks good and everything is well aligned. I was a little bit wondering about that because this was the first time I had my own PCB manufactured.

IMG_1816

This is a perfect timing because today I was not working, so I soldered everything (too bad I haven’t received my new Weller soldering station yet) .

I had several problems, fortunately nothing too serious. For several parts the size of the hole was too small, so I had to drill a bigger hole, trying to keep the pads intact. And for some other parts the footprint was too small, so I had some troubles to place my components. (You can see on the picture that it is a little bit tight on the “power” zone :-/ )

IMG_1821

I am still testing the board. The power part is working fine, I have the +5V and +3,3V from the +12V input. The PIC is also working, I can communicate with it when the debugger is plugged, but I might have a problem with the MCLR pull up, I am not sure yet. I might also have a bigger problem with the oscillator, I cannot switch the PIC to the external oscillator configuration yet; I don’t know why and I am still debugging and trying to figure out; unfortunately I don’t have any oscilloscope at home to check the hardware.

Most important : the LEDs are working fine ! Yes I love make blinking LEDs (I’m just joking, hey !).

So I still have to fixe the problem with the oscillator, and then I will have to develop most everything for the software on the PIC (I barely started), plug it with the Raspberry Pi, and integrate everything.

A (kind of) robot with a RC car and a Raspberry Pi

I decided to achieve an old dream : I am creating a robot (or kind of a robot for the moment).

So I am using my Raspberry Pi that I recently bought, and for which I succeeded to build a cross compiler (that was y previous post). I made a small home-made extension board to plug on the RaspPi. This extension board provides the power from a 12V battery to the 5V needed. And it also has 2 connectors for servo-motors; it will for sure have more components and connectors later.

On the other part, I bought an electric RC car. It is a 1/16 model with a brushless motor. So it is the perfect size to embed a Raspberry Pi on it, and it is surprisingly very powerful (it says up to 70Km/h, I did not try). The battery of the car is big enough to power the RaspPi, and I event think that compared to what consumes a brushless motor, the 700mA of the RaspPi are not a big deal. (here is a link to this car : http://www.funrctoys.com/eShopWeb/product-9022-HBX_BRUTAL_1_16_BRUSHLESS)

DSC00187

For the first version, it is not really a robot. I made an iOs application so I can control the car with my iPhone. And after several weeks, I must say it works ! Well, it still needs improvement for sure, but the prototype works.

For the RaspPi software, I used an existing servo-motor driver (you can find it here https://github.com/richardghirst/PiBits/tree/master/ServoBlaster), I will try to do it myself later. My software communicates through sockets with the iPhone; I have one udp socket for the car to send its “alive” status, and allow the iPhone to discover it on the network; and another socket, tcp, to send commands from the smartphone to the car. Quite simple, and it works.

Here is a video of one of my tests; I am controlling the car with my iPhone. You can see there is a lot of lag, but I know where it comes from, and I am working on it.
MAH00185

More to come soon I hope …