Connecting a programmable chip to a remote Controlled Car September 11, 2009
Posted by GuySoft in Crictor, Electronics, Hamakor, ITU, linux, open source, programming, Uncategorized, wireless.Tags: C, Electronics, hacking, howto, linux, open source, programming
trackback
Hey all,
I have been playing with electronics the last few days, and I thought I might show you the outcome.
I basically took a remote controlled car, and connected it to a 16F84 programmable chip, and now I can control the car using C code.
Although I am using a car in this guide, you should be able to close and open any kind of switch. Anything under 15 volts.
For people who have don’t feel like reading all this (and also for those who do), here is an action-packed video of the outcome:
After you saw that, here is how I did this.
Starting with electronics
This project was really my start on electronics. I guess reading about transistors (on my way to become an amateur radio ham) got me in to all of this. The transistor lets you control circuits with any other circuits. You better just google them, and read, the more you know the cooler things you can build!
Finding what you need is usually the harder part of the job, I better thank #electronics channel on freenode for helping me find the parts I needed. Once you find the part, you better look at its schematic, it will tell you what all the pins do. Schematics are easily searchable on the web. You can also open up old electronics (the simpler the better), and look for parts there, but it is hard to find exactly what you need, and you most likely will need to spend some money on parts (really, they cost nothing!). In Jerusalem you can check out the shop Kashayuf.
Here are the parts I used for my project:
The 16F84 programmable chip (the brain)
The 16F84A is really an obsolete chip, and is very limited. However, it was the only one I could get around here. And since it only costs 8 NIS (under 2$), I got more than my money worth. After all, what possibly could you get for under 2$ that you can write code for?
The programmer
Usually the programmer will cost you more than the chip. Mine cost 50$, and is called the MPLAB ICD2. I got it off ebay. Although its powerful and can program many PICs, I guess I could have gotten something much cheaper.
The software for the chip
I used an IDE to code called Piklab, it really gave me everything I needed, from programming and compiling, to pin diagrams of the chips.
To compile I sadly had to use CCS (you can see the code here). I should be able to use the open source alternative SDCC, but it seems the delay_ms() function there is not working for my chip. If anyone has any source, I’d gladly use it.
7805 – 5V Regulator
The 7085 chip lets you take anything and turn it to a 5 volt power supply. If you want to try something simple, like building a USB power charger. Watch this systm episode. That video will also explain you how a bread board works.
14066 – The switching transistor
The MC14066 chip I used is a 4-in-1 chip that lets me open and close circuits. Its really a bunch of transistors. Before using it I tried using an IR540 MOSFET transistor, but it needs +5V at its gate, and the PIC only gives out 2.5V. Still it could be used to turn on an off motors with the LPT port, or big lights. Remember: Without transistors, you will only be able to power using the 2.5 signal that comes out form the PIC, or anything else.
Other chips Programmable chips
There are many chips, as I said in the video, the AVRs are popular, and are the basis for many projects you might have heard of (like the Arduino), you can have a look at avrfreaks for projects.
Next project – The bumble-b
While doing this project I found a really cool looking chip called the bumble-b. I ordered one, and I hope to update once I try it out.
This is really all for now, hope you enjoyed my quick introduction to electronics and my project, and I hope to do more projects before the semester starts.
Update: All 4 directions on the car are working , a friend and I hope to code it a route in the campus!
[…] is a cool way to remote control your car. The microcontroller is a bit of an older one, have a look at the 16f628 for a more modern one […]
Hey, you are off to a great start. I can’t wait to see where you take it from here! Thanks for sharing your experience.
Cool project, maybe next you can disregard the remote controller all together and just put a circuit on the car.
I would recommend you purchase an 18F series if your programmer supports it, you have more instructions and more hardware available to you. I recommend the 18F4550 but im sure there is a better one out there.
I have to order them from the US. There aren’t any here to be found, at least where I have looked. specifically asked shops about the 18F4550.
If you can do this kind of stuff, brush up on the legal stuff for getting your ham license and go for it. I just noticed you are in israel, so I don’t know how it compares. Good luck!
Amateur radio is a dying hobby here. I visited the ITU about a year ago (recommend this post), and I thought I might try and become a ham. So now I am using the holiday time from university to do this. Its hard in Israel, because no one actually knows when there will be a test, its not organized like in the US, and the tests are much harder.
[…] complicated project to be his first, but seems extremely comfortable with it. This project was to control his R/C car with a pic16f84. That chip was chosen simply because it was the only one available at local stores. Though […]
Download the latest version of MPLAB from microchip – it has a free version of the CCS compiler included.
Thanks for the info. Although I still rather use a compiler whose source is completely free. I got code to compile and run on SDCC, but it seems not to have delay_ms() functions for 14bit PICs. Here is the SDCC code I got so far.
I don’t understand your statement “the PIC only gives out 2.5V”. Since you’re using 5V as input, your digital I/O levels are basically 0V and 5V.
One way that I know of for you to be getting 2.5V out of a (5V) digital I/O is if your MCU has internal pull-ups that you haven’t turned off. In short, this basically means that you haven’t setup that particular I/O (port bit) to be a digital output properly.
The only other way that comes to mind to get significantly less than 5V out would be if you were heavily loading the output (trying to draw more than, say, 30mA), causing the voltage to sag.
I’m definitely no expert in this area, but there’s something wrong if you’re only getting 2.5V out.
regards
Actually, I talked about that to a friend of mine who works with electronics. PICs give about 2.5V even though they get a VCC of +5V. Modern chips apparently even use 1.6V. The reason is because capacitors and transistors are becoming smaller, and its now technologically possible to make the voltage lower in the circuits, thus rending them faster (charging capacitors takes time).
I came across this fact, because prior to the 14066 in the circuit, I used the IR540 MOSFET transistor (as described above), that requires +5V and there was not enough voltage for the gate pin.
not only faster charges, but also higher frequencies take more power, so with a lower voltage you can take the circuit to higher speeds without eating all that expensive energy. my highscool finishing project (described in my other comment) also had a 5v regulator and a 9v input because it was taking too much damn current for a set of batteries, not to mention a single 9v. It was fun to build and test though, it was a MIDI monitor, telling you what events where sent on which channels by analysing serial communication via an opto-coupler, but without a serial com chip – I did it all in software because I didn’t know where to get or how to use a 16550 🙂
Ach… The good old days spent at Kashayof’s basement…
man, you throw my back to my highschool days with those TTL parts and the white prototype board. next you’ll be doing wire-wrap and stuff 🙂
I wish I knew where my old heap of equipment was, but I don’t. I barely know where my finishing project is at – it has a 7segment display and I think 24 more LEDs, all controlled by a 8051 with an external EPROM (yes, the kind with a tiny window for erasing with UV…)
16F84A!! You are on some wonderful drug.
These days you can get double the size, 1/2 the cost, 4 time the peripherals, and 4x the speed from Microchip. F84 what a joke.
Only if they import it here. And they don’t. There is no service I came across that will import single PICs in Israel. Only masses for big companies.
Why be so rude?!!! The guy has used what he could get, made it work, and is generous enough to share with others.
You, on the other hand do your best to knock his efforts.
Get a life.
Don’t you youngsters know the first rule of public discussion mediums? All users of IRC, forums, mailing lists and blogs know you should never feed the trolls… 🙂
16F84 was not the only one available. You simply were not looking for another kind. Read up on other chips.
Read the blog. I am not in the US.
AmazinG!!!
nice.i want to modify the control to start with that could you share your source cod
The source code is in the blog post. Look for the word “source code”
hey man, I need some help for my science fair project.
I need to know how to connect the 16F84 to two 6 volts motors. I need to know about transistors, resistors, regulators, etc, and how to connect them. I want the motors to make the wheels go forward, left, right, stop, etc. Please I need some help I don’t know so much about electronics but I already know about programming and pics.
Please read the blog, the post explains how to turn on and off 6V power supplies.
About basic electronics/motors – wikipedia/google/youtube are your friends.
If you have specific questions, then ask ahead.
please help me, how many ampere of opto coupler use to control the appliances…..
I am not sure I understand what you are trying to do Dax. Perhaps you could explain yourself.
can i know how did you connect the remote with the chip??
With the switching transistor, read the text..
Can we have the programming and your circuit diagram for the transmitter and receiver?
No, I hacked an existing transmitter and receiver. So i have no schematic for it.
Looks really nice! I’m thinking about making some kind of guitar effect switch with a programmable chip, I could probably use some well-known good sounding ICs for the signal switching, and then feed those with (logic) input from a programmable chip like yours, right?
I would need input to the C program via a momentary button… is this achieved by letting the button feed the chip with voltage, and having the chip poll for voltage (timer/cycle-based)?
Thank you!
wow great… please help me of every details of ur project… I’m a bigginner.. thank u so much.
I WANT TO TRY THE SAME BUT DON’T KNOW HOW TO PROGRAM IT. CAN YOU GIVE ME THE C PROGRAM FOR THIS?
kishanth0094@gmail.com
car.c is available for download from the blog post. Please read it.
It looks very nice! I wanna try something quite similar. The only difference is that I wanna control the car directly but not through the remote controller. Do you think it is possible? What is more, could you share me your circuit of this? I have no idea where to start.
sam123rickzyy@gmail.com