Interfacing picaxe on motor vehicle

Bozambo

Member
I just completed my 08M2 project but only to find out that there are safety issues to be considered in interfacing a Picaxe on a motor vehicle. Basically I would like to in cooperate one of those 9- 24 v DC Motion detectors that would simply serve as a switch to trigger the Picaxe when ever an intruder enters the car.
. My intentions were to use the 12v supply from the car with a suitable fuse for the motion detector, and run the Picaxe off two AAA Bateries and a phone charger connected to the cigarette lighter.
I did some checking on interfacing the project from Post/ threads dating back to 2006 and recently in 2013. There does not seem to be any thing conclusive. However members seem to be confronted with this challenge for quite some time, one of our senior members even sugested it might be better to buy a power supply ( if it can be located ) Thus far is there a simple or rather a workable solution that a non expert can work with.
 

besupreme

New Member
You may try to supply the picaxe from a 2k2 resistor directly from 12V. Add a white or blue LED and a >100uF capacitor across the Picaxe supply pins. If the LED goes dark while the Picaxe runs the program, use a 1k5 or 1k resistor. I have a 08M here running between 4V and 25V Battery with this circuit. The Picaxe supply stays between 3V and 3.3V.

Be aware that this circuit permanently draws 5-10mA. May cause headaches when the battery is almost dead ;)
 

John West

Senior Member
This is a very bad idea, besupreme, for any number of reasons that aren't really worth going into. It simply should NOT be done.

EDIT: I should have added, "this way," to the end of the sentence, but it was late here in the USA and I was weary. Folks down-thread have since gone into the details of what Bozambo needs to do and why it needs doing.
 
Last edited:

besupreme

New Member
Only if your battery is dead, AND you start from a 48V forklift battery. But I think that would break more than just the Picaxe..?? Good quality white LED have better regulation than Z diodes, from what I measured. Please elaborate -
 

nick12ab

Senior Member
Only if your battery is dead, AND you start from a 48V forklift battery. But I think that would break more than just the Picaxe..?? Good quality white LED have better regulation than Z diodes, from what I measured. Please elaborate -
How much current can you draw from the PICAXE I/O pins without it stopping working?
 

besupreme

New Member
3mA@10V battery worst case. That's much more than you need for driving a couple of Mosfets and a piezo. And some 4k7 pullups for the alarm contact, and a reset button. For driving a 8 Ohm dynamic speaker, a 1k5 resistor is OK.
 

Bozambo

Member
Gentlemen I am no expert in the field of electronics. But standing up on the outside and noting "besupreme" seem very confident in his position he seem to be standing strong and appears to know what he is talking about especially for a new member. As I said in my original post there has not been any concrete position, all I have heard is there are safety issuses to be considered and being referred to past threads on the subject but again nothing conclusive. One member said he has had a Picaxe 08m running with a LED blinking for about five on a regulated supply and the same three AAA Bateries. But some one said that is taking a chance. Just my humble position. By way of interest I came across the attached circuit for what it is worth. I cannot say any thing as I said this is not my field .View attachment 12 V SUPPLY.pdf
 

Captain Haddock

Senior Member
I would just use a good voltage regulator with plenty of caps across it to take care of any voltage spikes, you may find some vehicle wiring will affect the picaxe worse than others, I've had a picaxe project running on a boat for ages with no real problems with 2 diesel engines/2 alternators/split charging system, some get wary when using home built projects on vehicles in case they affect the systems of the vehicle itself but I doubt thats likely (I'm not saying it can't happen, thats you're own decision to make), fear of litigation has a lot to answer for.......
 

Bozambo

Member
Hi Cap

That sounds more like we are cooking with gas any comments on the 12 v supply portion of the circuit I included above.
Do appreciate your observation.
 

AllyCat

Senior Member
My intentions were to use the 12v supply from the car with a suitable fuse for the motion detector, and run the Picaxe off two AAA Bateries and a phone charger connected to the cigarette lighter.
Hi,

How do you intend to connect the two AAA batteries and "phone charger"? Is the cigarette lighter socket switched through the ignition (many are)? A phone charger will generally deliver 5 volts at quite a decent current so you certainly can't "float" the batteries across the rail.

Also, you don't appear to have said what you want the PICaxe to do if an intruder enters. To sound an alarm, for example, will probably require a relay or a FET, and even a Logic level FET is unlikely to switch properly from two AAA cells or a 3 volt "LED shunt regulator".

Probably the reason that there are few "answers" on the forum concering Auto electronics is that the experienced members won't get involved in any projects that are "safety critical". That particularly involves any method that may immobilise the car/engine under any circumstances. Another reason is that the "12 volt" supply rail can be very "dirty" with a great deal of energy behind it, so "good" design and construction is essential.

Spikes above 50 volts are possible which can easily destroy a "7805" or similar regulator, so besupreme's "LED shunt regulator" has some merit because most of the spike voltage is dropped across the resistor with the energy dumped into a large capacitor. Yes a white LED is as good as a 3 volt "zener", but that's because such voltage zeners have a very poor regulating capability.

When you tell us how much power is actually needed to run the intended system, we may be able to recommend a power supply circuit, but shunt regulators tend to be used only when little power is required and a very low efficiency can be tolerated. I can't comment on the attached .PDF as the diagram gives no component values, nor the "technology" of the gates, etc.

Cheers, Alan.
 

Puuhaaja

Senior Member
Regu 2.jpg


I'm using this kind kind of regulator which consist of 2x 100nF bypass ceramic capacitor, 2x 100uF electrolytic capacitor, 1x 1N4001 diode and Lm7805 regulator.
I have used it with small 12v battery several times without problems.

Do you have any idea should this work straight in a car? I think that capacitors are smoothing over spikes and diode is preventing reverse voltage.
 

BeanieBots

Moderator
This has been covered many times.
Long story short, it is NOT suitable.

The 78XX series regulators cannot cope with automotive spikes and/or surges.
You can expect 1.5kV spikes and 150v surges lasting several 100mS on the 12v line in a car.

Newer cars are much better and the cigarette lighter sockets often have suppression but just because YOUR car does not show any evidence of such noise does not mean that a circuit without sufficient suppression/protection is suitable for use in ANY car.
This is why it is such an imotive subject. The second somebody suggests a circuit is suitable, somebody else will go and fit it to their car and promptly find their engine immobolised at 70mph in the outside lane of a busy motorway.

Do a full risk analysis:
What happens if (and will at some point) the PICAXE crashes.
What happens if the code has a bug.
What happens if unit puts a dead short on the supply line.
What happens if the supply line has a 1.5kV spike on it.
What happens if the line has 150v for 200mS.
What happens if the supply is indefinitely at anywhere between -12v and +27.2v

There are many more scenarios but those the most common ones that are likely to happen frequently and are tested or mitigated for by car manufacturers.
 

Bozambo

Member
Hi BeanieBots

I have the greatest of respect for the points you have raised.

Based on what you are saying there appears to two issues it all boils down to namely: 1. The Reliability of the Picaxe
2. The Reliability of a Power Source
I wanted to to be able to immobilize my car If one day someone decided to move off with it.

How is it then that devices are being sold that has the ability to remotely control a relay with a GSM Module.

Also could I have your views on this Power source one of the senior members came up with.



http://www.picaxeforum.co.uk/showthread.php?8353-Low-Power-Battery-Backup-Reference-Design

http://www.picaxeforum.co.uk/showthread.php?23337-12v-car-project-Charger-question
 

BeanieBots

Moderator
The issues have nothing to do with reliability (though that is important), it has to do with using components within their ratings.
The 7805 regulator is very reliable but it won't last 5 seconds with 150v shoved into it.
The PICAXE is as reliable as any other micro, but it will fail (as will any other micro) with 1.5kV spikes close by.

Have you EVER in your entire life had a PC crash for no particular reason that you were aware of?
These things can and do happen. Any software YOU write may well be perfect, but the platform it runs on might not.
YOU cannot guarantee that Rev-Ed have no bugs in the interpreter and THEY will not make a statement that it is fit for "safety critical" use. (nor will Microchip who make the silicon part).

Is it possible in any way whatsoever for you circuit + program when it fails to cause a safety hazard?
eg could a bug or component failure result in immobilisation whilst driving?

How is it then that devices are being sold that has the ability to remotely control a relay with a GSM Module.
No idea. Are they legal? What are they used for? I can buy a gun but I'm not allowed to shoot people with it!

Also could I have your views on this Power source one of the senior members came up with.
I could not see any power source (maybe I missed it) in either of the links you posted.
They were about a reference design for low power running from dry cell batteries.

It is possible to make compliant safety critical designs based on micros and software. We have autopilots controlling 747 jumbo jets flying all over the place. However, there are many backup systems and safety measures in place which include independant code and component redundancy. Above all, these measures are to take into account EXPECTED component failure. The actual design also takes into account not subjecting any of the components to stresses that they were not designed to take.
 

srnet

Senior Member
I wanted to to be able to immobilize my car If one day someone decided to move off with it.
Fair enough, reasonable ambition.

There is, as others have mentioned, the potential risk therefore that the car will be immobilized when you are driving it, not in general a good situation.

It may be assumed that asking questions as to what electronics or construction are required to mitigate this risk, is a good thing.

However, the alternate view is that if you have to ask those questions, you dont have the skills or experience to implement such a system safely.........
 

JimPerry

Senior Member
There is, as others have mentioned, the potential risk therefore that the car will be immobilized when you are driving it, not in general a good situation. .

30-years or so ago I installed a simple immobiliing system for a friend. It failed when he was driving the coast road in California - lost power steering and nearly came to a very nasty end. - I've never messed with car systems since! :rolleyes:
 

BeanieBots

Moderator
However, the alternate view is that if you have to ask those questions, you dont have the skills or experience to implement such a system safely.........
I have to agree with that comment however rude it may sound. (it is not intended to be rude)
It's good that you ask but it really isn't practical to try to explain what has taken a degree course in electronics and many decades of experience to be able to put over in a forum environment without any direct interaction. We can offer advice and advise about specifics but to cover the whole really isn't possible.
Probably the best advice is to find yourself somebody who knows and get them to help you out in person.
This has been covered many times here and usually ends the same way for the same reasons you are now finding out.
 

Adamey

Senior Member
This is the field I work in (automotive). Over the years I have taken apart countless modules in cars to see how their power supplies and interfacing works. They are surprisingly similar. In a nutshell they look something like this:

Battery --> Fuse --> 22V MOV --> 1N4001 --> (sometimes a Zener) --> Automotive Regulator --> Circuit.

Of course there are the required capacitors by the regulator. Most common automotive regulators can withstand 60V. The only time you'd ever get a really huge voltage spike is if the battery (which prevents major voltage fluctuations) is suddenly dis-connected from the vehicle while the alternator is simultaneously putting out a lot of current. The regulator in the alternator can't respond quickly enough so you can get a large voltage spike for a short period of time (usually less than 1 second).

Of course, this assumes that there's nothing else in the vehicle that can absorb the voltage. Any loads in the vehicle drawing power are going to also help to soften this spike. So will any other modules that are also equipped with MOV's (which most are).

Inputs to modules are usually protected by a small MOV along with a voltage divider. The divider not only limits the maximum voltage that can reach your input, but also limits the amount of energy the MOV has to absorb. Typically I see inputs equipped with tiny surface mount MOV's.

Another thing I see now almost exclusively is the use of logic MOSFETs or IPS's (Intelligent Power Switches). Basically an IPS is a logic controlled MOSFET that also has a few extra features built in (like shutdown for thermal, overvoltage, no load, shorted load) and status feedback in the form of a logic signal or even a proportional current sense so your microcontroller can monitor current itself. These devices basically do everything for you and take away much of the circuitry that used to exist to protect devices and your circuit.

Some basic precautions on the power supply and use of an automotive regulator will ensure your microcontroller doesn't have any issues with "dirty" voltage. Combined with IPS's makes it MUCH easier to design a reliable circuit for automotive.


Of course, this still doesn't mean things are foolproof and you could still have problems with your code. To re-iterate what others have said - don't let a critical system rely on something you built such that your engine or another system could fail while driving. However, that still leaves a LOT of stuff you can control and improve in your car.
 

BCJKiwi

Senior Member
The key, in the string of protection devices mentioned by Adamey, is the AUTOMOTIVE regulator e.g. an LM2940 which has been suggested previously in many 'Automotive' threads on this forum.
I am sure there are other alternatives now - just be sure to use the capacitors specified in the data sheet for the regulator - not 'the ones you use'!

I do wonder about the MOV as my understanding is they become ineffective if required to work too often and need to be replaced.
 

BeanieBots

Moderator
Some basic precautions on the power supply and use of an automotive regulator will ensure your microcontroller doesn't have any issues with "dirty" voltage. Combined with IPS's makes it MUCH easier to design a reliable circuit for automotive.

Of course, this still doesn't mean things are foolproof and you could still have problems with your code. To re-iterate what others have said - don't let a critical system rely on something you built such that your engine or another system could fail while driving. However, that still leaves a LOT of stuff you can control and improve in your car.
Absolutely!

It's really a question of not doing anything that might be dangerous but more to the point KNOWING what might be dangerous.
Also, don't forget to inform your insurance company because many will deam the policy void if they get a hint of any modification that they have not approved and that can get you into some very deep water even if your circuit doesn't fail.
 

bpowell

Senior Member
Sounds like a cool project...how were you planning to immobilize the car? Removing power to the ignition? Or maybe the fuel-pump?
 

fib

New Member
^ Better to interrupt the starter. If you disable fuel/ignition and the crook does try to steal your car they might keep cranking it over until you're left with a dead battery and/or a burned out starter. Plus you don't have to worry about a circuit failure causing your engine to stall.

Some of the things I've used PICAXE for.....

- One touch power windows.
- Automatic open/close of convertible top (replaced Jaguar modules on XJ-S and even did an old Ford retractable hardtop that had a mechanical system of switches/levers/cams to operate the necessary parts in sequence).
- The sequenced turn signals as found on old Mercury Cougars.
- Sequenced power turn on for multiple amps in a stereo system.
- Delay wipers.
- Dimming interior lights when door closed instead of the usual turn off (used PWM).

There are all sorts of things you can do if you just sit down and think about it for a minute. In my case, many of these were done as a result of something quitting in the vehicle and replacement parts being difficult to find.
 
Top