Very first PIC project "I welcome all advice"

Thread Starter

Kyo

Joined Nov 1, 2009
10
Hi Every one,

I am looking to make a controller for My pop up headlights on My car,
just for kicks as I like projects.

So I have decided on a PCB board micro controller DIY project
I found online for My car...
but here comes the bad part, the schematics for the PCB are no longer hosted on the website
I don't know how to draw up the schematics for the Board or for the right parts..

but after allot of searching around i have managed to draw up a set of schematics.

http://7kyo.wordpress.com/files/2009/11/sleepy-eyes1.png


Now I Fully plan to use The program and all the details from the DIY website..

what I would like to know is will this schematic I drew up work for the DIY project on the Guy's 'website here is a link to the Project I am taking a stab at

http://members.dslextreme.com/users/ltruong/sleepyeyes.html

be 100% Blunt with me this is my very first project like this and I welcome all and any Advice

when I get all the details worked out I will build it, but for now it is just theory till i learn more...

Thanks for all your advice and help

Cheers
Kyo
 
Last edited:

tibbles

Joined Jun 27, 2008
249
hi kyo, looks like you enjoy a challenge.i've just started myself, i'm usingthe 16f84 too, only because it came with the hardware,
the code has gone through the assembler fine with no errors.
so that the experts can help you better , you may need to make your schematic a bit clearer.
when the time comes, might it be an idea to use two boards- an output board
and a processor board?

good luck
dougal
 

Thread Starter

Kyo

Joined Nov 1, 2009
10
Hi Dougal, Yeah I love to challenge my self it keeps my interested in what i am working on.. Thanks for running the code for me. good to hear it had No errors.

Here is another view of my schematic that I hope is clearer. my first was done in Eagle, this one i drew up real quick in paint..
http://7kyo.files.wordpress.com/2009/10/controller_3.jpg

I have not thought of using two boards but that is a idea, Thanks


Cheers
Kyo
 

tibbles

Joined Jun 27, 2008
249
i guess first task would be to determine the input /output pins-- port A inputs-port B outputs?
can you tell from the program?
 

tkng211

Joined Jan 4, 2008
65
Hi Kyo, the original circuit employs comparators to shift the output of the mcu from 5V to 12V to drive the FET. The circuit you drew can't work if you use the same code since a transistor inverter is used to shift the output voltage ( 5V->0.8V, 0V->12V). What you need to do is to modify the code a little to make the mcu output polarities reverse as compared with the original coding. The alternative is to add one more NPN transistor into each driving circuit so the voltage level shifter will no longer be a transistor inverter, hence you can use the original code.
 

Thread Starter

Kyo

Joined Nov 1, 2009
10
tkng211 ---
Ok,
would it be possible to get a example of how I would wire in another
NPN transistor into each driving circuit?

OR

would it be better to recreate my schematic like the original
using comparators?
what comparators would i use
I am new to all this and not sure what that is..


Dougal ---
So I should configure the code to use
Port A-output
Port B-input
and redraw my schematic accordingly..

Inputs to the mcu should be pull-down by a 10k resistor
 

tibbles

Joined Jun 27, 2008
249
hi kyo you just beat me,

the 339 has 4 comparators on one chip, a wide voltage supply range-- configured as a non inverting buffer ? plenty of info here or google

hopefully no need to alter code
time for bed
good luck again
 

tkng211

Joined Jan 4, 2008
65
hi kyo,
You can use the comparator IC LM339 or build the voltage level shifter by two NPN transistors. The circuit using transistor is attached for your reference.
 

Attachments

thatoneguy

Joined Feb 19, 2009
6,359
If you have the 16F84 and programmer, Set up the circuit on a breadboard, but use LEDs for the outputs. Then try the switches and make sure they will be sending the correct signals to the MOSFET controllers.

This will allow you to tweak things without making the big jump to modifying the car to see if it functions as intended. Though from a quick glance at the code, it should.

PortA is typically used for inputs, and PortB for outputs. There are sometimes valid reasons for this (uC limitations), but often it is just to follow convention. If you can read and understand the source code, and compile it to run on a breadboard, you should be good to go!
 

Thread Starter

Kyo

Joined Nov 1, 2009
10
tkng211 & tibbles --- Thanks for the circuit reference..


thatoneguy --- yeah i do plan on setting it up on a breadboard to give it a go first before hooking it up to the car itself.. The leds for testing are a good idea, thanks

I have most of my parts and PIC16F84A on there way here now ..
however i do not yet have a programmer. I was Thinking about the PicKit 2 (Microchip part #PG164120)
Do you think that would be a good programmer for my needs??
I have heard good things about it.


Cheers
Kyo
 

thatoneguy

Joined Feb 19, 2009
6,359
The PicKit2 is an excellent tool! It also functions as a hardware debugger and a logic probe.

When ordering the PicKit2, you can get the low pin count demo board for $10 more, it comes with many examples of programming, debugging and generally great info when learning about microcontrollers.
 

tkng211

Joined Jan 4, 2008
65
Kyo, when I took a look on the original website, the author used an N-channel Enhancement Mode FET MTP52N06. I thought you're gonna use the same FET. That's why I gave you the previous comment.
After double checking on your schematic diagram, I found that you'd use a P-channel Enhancement Mode FET. So your circuit will be okay for the voltage level shifting. Sorry for confusing you.
Since you are using it in your car, better put a resistor about 10-22 Ohm between the gate of the FET and the transistor's collector to limit the discharge current, hence the transistor will be more reliable.
Another suggestion is adding a LED between the transistor collector and the 1K resistor as an indicator.

Cheers
 

BMorse

Joined Sep 26, 2009
2,675
PortA is typically used for inputs, and PortB for outputs. There are sometimes valid reasons for this (uC limitations), but often it is just to follow convention.
It is usually because RB6 and RB7 are usually connected in a way to the external circuit to where ICSP can be implemented, and it is best to have them as outputs than inputs.....atleast, this was my impression....

My .02
 

Thread Starter

Kyo

Joined Nov 1, 2009
10
tkng211 --- Thanks for clearing that up, I was a bit confused..


so if
I used a N-channel FET
your schematic would be best..

and if
I used a P-channel FET
The one I have attached would do the trick..

neither would need me to change the code right?


Cheers
Kyo
 

Attachments

Top