• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC24FJ64GB002 Project

Status
Not open for further replies.

Aashi

New Member
Hi, I'm using pic24fj64gb002 for my project. In this project i want to read the output(values) from the Ignition and AC of a car. That is i want to know whether the ignition and ac of the car is ON or OFF. How can i do this and what are the required components?

The output of this should be available so that i can get it into my PIC, possibly through the UART.

Thanks in advance.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Uart???? The output from a car is canbus, however!! The data available via the ODB2 connector is complex..

To check the ignition and or A/C is on, you can just tap into the wiring...

I suspect a deeper thought process is coming!! Whats on your mind!
 

vne147

Member
Ian is right. Depending on how old the car is, you can probably monitor those 2 parameters via a CAN bus. My car has 3 CAN buses, and from what I understand that's a pretty common arrangement. There's one CAN bus for the entertainment (GPS, radio, etc), one for the body(door locks, turn signals, etc), and one for the engine(ignition state, engine speed, etc). The specific state of the ignition switch is almost certainly on the engine CAN bus, but all 3 busses will have some flag telling them whether or not the car is running. As for the A/C, I'm thinking engine bus once again but it may be the body bus.

Interfacing the CAN bus is the most elegant solution, but it's not the easiest to implement. Depending on your experience level and resources, the easiest solution would be to go the route Ian suggested and simply splice into the switch for the ignition and the switch for the A/C. You'll need to use a couple of transistors or a logic level converter since your PIC can only withstand a maximum of 5.5V at its I/O pins. Maybe something like this SparkFun Logic Level Converter - Bi-Directional. I know it says it converts between 3.3V and 5V, but it should work to step down 12V to 3.3V which is what you'll need.

As far as what you'll need to do for the PIC, do you have any programming experience? What languages? What compiler/IDE do you use? And, what do you want to have the PIC do once it detects that the engine is running and/or the A/C is on?
 
Last edited:

Aashi

New Member
Thanks for the info. Yes, i have looked into the topics you suggested and they seem to be doable. I'm going to use MPLAB X IDE for my programming and as far as programming goes I'm between Beginner and Intermediate. But I know C and C++ pgm very well, so I think I'll be okay.
What i need the pic to be doing is, if the Ignition is ON, then generate a pulse (whether or not AC is ON) and if ignition is OFF, go to sleep mode. And i want to sent the output via USB into a display (any).

So i'll be getting input from the engine via CAN BUS(like you suggested) input into the PIC, then program it, and then give output to the display.
So what i need to know is what all components will have to be used here, coz i need to design this using KiCad.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member

Aashi

New Member
OBD2 ELM327 adapter seems alot easier when i started reading about it. But how can i program the conditions i have to input in the PIC?
As the ELM327 displays all thats going on with the vehicle, how can I tweek it so that I can use it in my project as i mentioned earlier?
 

Aashi

New Member
Ian Rogers I have read the datasheet. Understood a lil bit about it.. Can't i directly connect the CAN to the PIC via L7987L regulator? Seems easier that way i guess coz then i can connect to PIC and do the programming.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Of course you can... The idea of the site was purely to get the commands... If you use the pic in can bus mode you should be able to read the values... From what I know about OBD2 protocol, it seems to be messages ( rather like GPS systems) or packets.... You send a command, then a series of bytes flow back.. The data you need will be in on or several of the packets..
 

Diver300

Well-Known Member
Most Helpful Member
Everyday data, like ignition status and whether the AC is on, is usually sent all the time on cars. You don't have to ask for it. It is likely that the signals will be in messages that contain other signals. For instance, an 8-byte message can be sent, but the ignition status may be in just 4 bits of those 8 bytes. The rest will mean something else, but can be ignored if you are just interested in ignition status.

It is only diagnostic data, like what error codes are set, that needs to be asked for.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top