Archive | June 2015

Flying Pet released!

Hello, I am happy to announce that Flying Pet, the game I (we) have been working on for nearly 2 years! It is available here! https://play.google.com/store/apps/details?id=com.centurexInc.FlyingPat And this is website for this page, not made by me. Movie of the game 🙂 https://www.youtube.com/watch?v=6O-gh39kL94 And website! http://flyingpet.io/ Hope you enjoy it!

For people, who are interested in 3D artist, here is his blog:

http://krebs3d.weebly.com/

Advertisements

Wifi RC car; controlled by browser based App from PC or Android/iOS through websockets

Hello, there!

I want to show off my project which I am extremely fond of. I loved doing it every bit. And

that is why this post will be quite long – lots of pictures and video.

This is the picture of unhacked car, a car in it’s original form with cover removed.

Car_Unhacked

This is the Raspberry PI v1- the computer. Also unmodified. You can also see WiFi dongle plugged in, which was later turned into Wireless access point.

Raspberry_Naked

Raspberry has GPIO which stands for General Purpose Input Output. I needed outputs so I can control the car. I cut the IDE cable so it would fit.

IDE_hacked

GPIO is signal port – it is weak. So I needed to design my own “driver” board, which is essentially just an signal amplifier. This way I also could separate battery for computer and another battery for car.

It means more stability – I had experiences of computer restarting itself because of single battery.

PCB_Design_2

When I finished PCB design, I did toner transfer method to make the circuit.

PCB_CloseupPCB_Cutting

I transferred toner – black ink with heat onto cooper board.

PCB_AdjustingPCB_Transfer_2

Then got rid of paper with help of water and soap.

PCB_Washing

And threw it into chemical which eats copper.

PCB_Etching_1Etching closeup

Requirement of this chemical is to be heated to 50°C so that it can eat cooper.Etching_Chemical

This is why I did water bath – it is really safe to do. Water heats to 100°C and water heats the plastic pot with chemical.

warming up water bath 2

After etching, I needed to get rid of toner – the black stuff.

Etching complete 2

But it’s better to drill before removing black paint, because it’s less error prone.

PCB_milling_closeup

After cleaning it with “nitro paint dissolver” board looked like this. Quite shinny :).

PCB_milled_and_cleaned

Let’s add stuff to it.

But before I can add stuff, I need to hop into shop and buy stuff.

Komponente_1

Soldered some stuff. This is also where IDE from Raspberry PI will connect to – the GPIO.

IMG_20130701_170244

Boom – finished. I also cut corners.

PCB_Soldering_Almost_Complete

Because sometimes people make mistakes, they need to repeat everything to get it right.

So there you can see multiple versions of this driver.

PCB_Multiple versions

Connecting the driver with car

PCB_wiring

The Raspberry GPIO – IDE connection. Soon to be made.

PCB_wiring_2

Quite messy. I need more duct tape.

Car_hacking_beggining_2

Ok, after enough duct tape, wires and all other glorious building components, I got the car into this state. I hope NASA doesn’t use this thing in space mission.

Car_hacked_finished

Now comes the programming. This is the part you will not see in pictures, but I will describe everything I used.

Raspberry PI computer had Linux installed in it.

For WiFi Dongle, I drivers and some scripts which turned the dongle into Access Point. Basically, I turned computer into router, to which you can connect to with laptop or smartphone.

This is how I mostly programmed the car – from WiFi with my laptop through SSH and SFTP.

Then I downloaded Mono – for C#. The Mono is really nice: It is possible to drop .exe files compiled directly from Visual Studio.

That is, I made my main backend server with C#. I used Fleck library for Websockets.

https://github.com/statianzo/Fleck

And thanks god someone did the PI-Blaster. With Pi-Blaster, you can turn GPIO ports into 8 port PWM output. With PWM I controlled the servos and LEDs.

https://github.com/sarfata/pi-blaster

After all this backend stuff, I had to write my own web based client. Of course I wrote it in Javascript, HTML, CSS3. I also made whole graphical design by myself.

webappwebapp2

The On/Off icon indicates if connection to car is alive. The lights indicates well, the lights. (Car has LEDs). The brown pad is for touch pad control. This client also works with WASD keys if you run it on computer.

In short, the Raspberry PI had following things so it could work flawlessly:

  • drivers for WiFi dongle so the car had it’s own Access Point (so you could connect to it with PC or Smartphone, w/e),
  • DHCP server for giving out IP addresses,
  • hacked DNS server, so it would route “rc.si” into it’s own server (C# backend),
  • HTTP web server, which served HTML web app client, which connected to PI server over webSocket,
  • C# control server which worked through webSocket. This program accepted messages from HTML client and sent controls to steering servo, LEDs, motor.

Testing video:

This is picture of functional web client on Samsung Ace with broken glass.

Testing web client on android

Turning left and right:

Testing web client steer LEFTTesting web client steer RIGHT

Switching lights on and off:

Testing web client LIGHTS ON Testing web client LIGHTS OFF

That is all there is to it. I had lots of fun doing this project!

I made also compiled a short movie with help of GO Pro camera. The camera is NOT realtime (I don’t see live feed on web client).

Hope you enjoyed this blog post!

The project was funded by http://cnj.si/#/, you can also see theirs logo on PCB and web app :).