END command

chipset

Senior Member
Hey guys Ive been learning alot over the last few days and I have a question about the END command. In the manual it says it will sleep teminally until power cycles. Now does that mean that Vdd needs to go to 0vand back to 5v before it starts again? If it does is there a way to put the PIC into a deep sleep until it is woken up by an input going high? More or less Im trying to make a circuit that turns off at the end of a program and turns on again when you press a button without removing the power to the pic. Im not quite sure which command I should use , like HIBERNATE, but given there are a few that seem fairly similar to each other I wanted to ask.
 
Last edited:

SilentScreamer

Senior Member
Which PICAXE? You could use the reset pin (have a switch, or other input, from the reset pin to 0V), but not all PICAXEs have one. I'm sure there will be another work around if your PICAXE doesn't.
 

lbenson

Senior Member
We need to know more about your equipment and what you are trying to accomplish. The crystal ball is hazy but suggests you might be running on battery and want to save juice while awaiting an event. If so, this thread shows how to sip microamps, essentially giving the batteries the same duration as shelf-life (assuming that periods of doing nothing predominate):

http://www.picaxeforum.co.uk/showthread.php?t=8353&highlight=power

As a test, the 08M in that project has been running on 3-AAs giving a low-power LED blink every 7 seconds and awaiting input which will never come--going on 18 months now.
 

chipset

Senior Member
this is a question regarding the 08m and its being run in a car. The cars battery voltage is ~12.7 at rest with a well charged battery and the chip will be regulated down to 5 volts (for anyone wondering lol). The project is documented in this post http://www.picaxeforum.co.uk/showthread.php?t=12394 It is a digital ignition switch utilizing a single push button just like some new cars. Im not quite certain how power needs to be cycled (if any) and I suppose on a side note if it even matters. Obviously a car battery has quite a big reserve of standby power but I need current draw with no pins high to be less than 500mA and the less draw the better. I dont really know if the chip really pulls any current just looping around waiting for a switch input.

The link posted looks like I shouldnt even worry and just let the program cycle as long as it wants to. The nice thing is that even if the battery is disconnected it begins back at the same spot it would be looping. Im just wondering if I need to worry about powering down the chip or not. I think not but hey you never know... thanks
 

lbenson

Senior Member
Many caveats have been posted regarding using a picaxe in a vehicle, but I don't think that current draw of a freerunning chip doing nothing but awaiting input has been among them. I think that the 08M is only rated for currents under around 100ma anyway. Cycle away. What you attach could be another question, of course.
 

chipset

Senior Member
what issues with a vehicle are you talking about? Ive seen quite a few projects in the forums with picaxes being used in vehicles. Hell thats how I was reffered to this in the first place. With proper signal conditioning I dont see why there would be any issues but maybe you could link me to a post regarding this?
 

BeanieBots

Moderator
There are many 'issues' relating to fitting ANYTHING to a car's electrical system.
As you say, appropriate signal conditioning is one. (not many have a clue of what is involved).
Certification to ensure you do not void your insurance is another.
Vibration & temperture tollerance are two more.

The ability to cope with kV spikes, 100v surges and brownouts will be the most complex issues to overcome but it is possible. The concerns of members on this forum relate to those who think it's a simple case of hook up a 7805 regulator to the 12v line and run your PICAXE of it just like you can 'on the bench':eek:
 

chipset

Senior Member
oh well that is a little clearer. Ok just take my word I know how to install electrics into vehicles PROPERLY, then I would assume there arent any other kind of crazy no nos about it. As long as its in the cabin, properly mounted and the proper signal conditioning is in place via caps ect then Id assume it should be fine in a car setting.. no?
 
Last edited:

chipset

Senior Member
ok normally I but a 10n and 470u cap between Vss and Vdd as close to the chip as possible as well as making the ground trace as large as possible to soak up any interference (as in the whole pcb no used for actual signals is a ground plane). beyond this should I be concerned about anything else? Assuming good grounds in the elctrical system and an alternator that isnt totally F'd up the spickes and AC ripple should be relatively low and most likely wouldnt cause an issue with something like this or so I would think. I know a lot of guys with very technical backrounds look and very worst case scenarios in the absolute worst possible situations but assuming a clean power signal with power and ground being supplied dirrectly to the battery with nothing in between I cant think of anything that would mess with this, or are those famous last words lol
 

hippy

Ex-Staff (retired)
Beyond designing and ensuring the system has no adverse affect on other electronics and systems the biggest issue seems to be designing to handle the 'noise' which can be on the power supply or signals. As noted these can be positive and negative going spikes of possibly kV, some short, some long, sustained over-voltage and under-voltage.

Such a design can be achieved but it involves more than throwing a circuit together and putting a few caps on the supply rails. A ground plane may solve some issues but not all of them. The main difference between professional vehicle electronics and home designed is in experience and knowledge plus the ability to test all adverse situations before fitting in a vehicle.

With a perfect electrical environment there should be no problem, but vehicles are never a perfect environment. The reason that vehicle electronics needs to be approached with a worse case scenario attitude is that a failure or fault condition can be catastrophic or fatal to yourself or other innocent road users.
 

BeanieBots

Moderator
Unfortunatley I can't find the link to a techincal paper regarding car power supplies. It has been posted before so a good search should find it.

In a nut-shell. As hippy states.
Even across the battery terminals, expect to see +/- kV spikes.
These can be suppressed with common mode chokes and a fast transorb.
The killer is the alternator over-run when heavy loads such as headlights are turned off. These surges can exceed 100v and can last for 10's of mS.:eek:
There are special regulators designed for automotive use that can handle such spikes. (a 7805 won't last very long).

In the cabin. Expect temperatures to exceed 60C when not occupied and parked in the sun. Most 'commercial' semiconductors start to fail at around 70C. That's not much headroom to play with.

Don't forget the legal issues.
Once complete, get it certified and give a copy of the certificate to your insurance company.
My insurance was actually CHEAPER after I submitted a dealer approved certificate of conformance for a redesigned (analogue) ECU.
 

QuIcK

Senior Member
off topic, sorry.
my knowledge of car electrics = -273'K
lmao, I love all the little geek sayings. All the stuff Ive been supressing at work, i think i may be able to say here
 

hippy

Ex-Staff (retired)
Real geeks would get pedantic about -273'K, -273'C and 0'K and question if it's possible to know less than absolutely nothing :)
 

D n T

Senior Member
Petrol head projects rool

Just a thought, have a look into what your vehicles manufaturer has done to ensure that the ECU supply is stable and copy it or find a constant 5v source leaving your ECU, after all, the manufacturer would have spent much dollars on getting this right for all the reasons mantioned by the caring and father like contributors to this forum.

I mean "when I was 13 my dad didn't know very much but by the time I had reached 21 it was amazing how much he had learned", old parent proverb.

-273C or 0 K might be fluent geek for cold or know very little about something, but I thought because this is a pertol head thread, I would translate into fluent petrol head for you. When refering to -273 C a petrol head might be refer to it as "bl%%dy cold mate" and as far as knowing very little about something they might say " yeh mate she'll be right, give it ere"
 
Last edited:

eclectic

Moderator
Real geeks would get pedantic about -273'K, -273'C and 0'K and question if it's possible to know less than absolutely nothing :)
Actually, I made a terminological inexactitude.

I know a tiny bit about cars.

So, I really know about 0.15'K or -273'C. :))

e
 

QuIcK

Senior Member
I should have kept quiet. Ive totally sabotaged this thread. Im sorry.

I didnt realize there could be 100v spikes across a car battery. I spose if i'd thought about it, it makes sense. I just thought that there would be some sort of conditioning... can car batteries take that kind of abuse? (stupid question.. apparently they can :eek:)
is that why boy-racers always have massive capacitors across their "amazing" sound systems?
or is that to stop lights dimming when the speakers are driving hard?
 

Andrew Cowan

Senior Member
Both to stop noise (lights turning off) to the speakers, and to stop the subwoofer power fluctuations making the lights all flash, and all the electronics reset.

A
 

westaust55

Moderator
Real geeks would get pedantic about -273'K, -273'C and 0'K and question if it's possible to know less than absolutely nothing :)
There is the old line:

Some learn more and more about less and less until they know absolutely everyting about nothing. :rolleyes:
 

westaust55

Moderator
Hey guys Ive been learning alot over the last few days and I have a question about the END command. In the manual it says it will sleep teminally until power cycles. Now does that mean that Vdd needs to go to 0vand back to 5v before it starts again?
To specifically answer your question about power cycling:
Yes, to cycle the power is to remove the supply to Vdd and then restore the power to Vdd.
 

fernando_g

Senior Member
Interesting to read how this thread drifted from a software question into a full blown automotive-power-supply discussion.;)

So I'm entering the fray myself and provide my two yen on the subject:

Another source of oddball waveforms in automotive environments are motors spinning down when the vehicle is turned off. The worst culprits are motors driving fans, which are a few: the radiator fans, condenser and evaporator fans in air conditioners. There may be other cooling fans, but these are the most usual.

Since these are usually permanent magnet motors, they will generate a variable frequency pulsating voltage when they spin down.
 

chipset

Senior Member
I should have kept quiet. Ive totally sabotaged this thread. Im sorry.

I didnt realize there could be 100v spikes across a car battery. I spose if i'd thought about it, it makes sense. I just thought that there would be some sort of conditioning... can car batteries take that kind of abuse? (stupid question.. apparently they can :eek:)
is that why boy-racers always have massive capacitors across their "amazing" sound systems?
or is that to stop lights dimming when the speakers are driving hard?
those deaf kids (i am one now that Im older and got through the loud stereo stage) have the cap on there to smooth out the voltage during large discharges. More or less when the voltage troughs the cap releases energy back into the system to maintain a constant voltage.
 

chipset

Senior Member
Just a thought, have a look into what your vehicles manufaturer has done to ensure that the ECU supply is stable and copy it or find a constant 5v source leaving your ECU, after all, the manufacturer would have spent much dollars on getting this right for all the reasons mantioned by the caring and father like contributors to this forum.

I mean "when I was 13 my dad didn't know very much but by the time I had reached 21 it was amazing how much he had learned", old parent proverb.

-273C or 0 K might be fluent geek for cold or know very little about something, but I thought because this is a pertol head thread, I would translate into fluent petrol head for you. When refering to -273 C a petrol head might be refer to it as "bl%%dy cold mate" and as far as knowing very little about something they might say " yeh mate she'll be right, give it ere"
I will look at megasquirts power circuits. Being that its open source and pretty well refined nowdays id say itd be safe to copy their system. And youd be suprised how geeky you gotta be in my area of expertise of automobiles. I do custom electrical systems for custom cars of all sorts. Fuel injection nowdays is pretty intense stuff, hell some engine management computers have over a meg of ram now, they all run on CAN networks and some cars can have well over 25 seperate controllers in the car. I have to be able to not only fix that stuff but implement it on some level into early model cars ie; engine swaps to full interior swaps. Best one I did was take a 67 corvette and install not only the engine and trans but also the full interior with all components functional from an 06 corvette inside. This included ABS, the dash, climate control, memory seats as well as the body computer. It was VERY involved and Ive learned alot about the high end side of auto electronics.

One thing I was aware of though was these kV spikes on the line, obviously Ive never experienced it, Ive seen horrible AC ripple due to bad alternators with crapped out diode bridges but never scoped a spike of a 1000 v. Either way Ill look into the links posted and go from there. Im sure Ill be able to make this work. If not then I guess Ill have to find something else :(
 

krypton_john

Senior Member
Unfortunatley I can't find the link to a techincal paper regarding car power supplies. It has been posted before so a good search should find it.

In a nut-shell. As hippy states.
Even across the battery terminals, expect to see +/- kV spikes.
These can be suppressed with common mode chokes and a fast transorb.
The killer is the alternator over-run when heavy loads such as headlights are turned off. These surges can exceed 100v and can last for 10's of mS.:eek:
There are special regulators designed for automotive use that can handle such spikes. (a 7805 won't last very long).

In the cabin. Expect temperatures to exceed 60C when not occupied and parked in the sun. Most 'commercial' semiconductors start to fail at around 70C. That's not much headroom to play with.

Don't forget the legal issues.
Once complete, get it certified and give a copy of the certificate to your insurance company.
My insurance was actually CHEAPER after I submitted a dealer approved certificate of conformance for a redesigned (analogue) ECU.
There are plenty of car chargers about on ebay etc to charge cellphones and they are only a few bucks. I've never blown up my car or a cellphone using these things. I've also never heard of an accident caused by such a device malfunctioning.

Just get a car charger adapter for a cellphone and hack it.
 

SgtB

Member
If you tie into the main battery line you can get high voltage "load dumps". Tying into the regulated Accessory line is safe. It may be noisy, but the spikes are gone.
 

chipset

Senior Member
in a car theres no such thing as a regulated accessory side. The only difference between the main line voltage and the accessory side is the position of the ignition switch. I actually thought about the phone charger method. If I can hack their circuitry Im sure Id have it whipped. Im looking at the LM2937 regulator which is set up for automotive apps as well as a diode on the 0v rail to block negative voltage aka AC ripple. I think with a diode on the 0v rail as well as some hefty caps pre regulator and post regulator I should be able to suck up enough transient voltage and noise.

As far as the 60c temp limit I suppose thatll be the biggest issue. Im thinking though that as long as the module itself isnt mounted to the firewall and out of direct sunlight, the actual air temp may stay low enough to keep it safe. You gotta think that 60c is plenty hot and with proper packaging and placement I should be safe (knock on wood.).

Any other comments on the subject are very welcome since most if not all my projects are for use in an automotive enviroment (some guys like computers, some like robots, I like cars what can you say?). THanks a ton
 

chipset

Senior Member
oh and heres the power circuits for a megasquirt (a diy fuel injection sytem for vehicles). It also uses an LM2937 along with caps, diodes and zeners. Take a look at this and lemme know if this is sufficient for the picaxe, Id think it is, but who knows..not me lol.


edit guess the picture isnt happy being linked... oh well goto http://www.megamanual.com/357/V357_schenmatics6.gif and youll see what Im talking about
 
Last edited:

SgtB

Member
I guess my Honda's have good regulators. There are three taps in the fuse box const-switched-and lights. I may be wrong, but they are tied directly to the alternators regulator output. I've never blown anything, but I may just be lucky. *shrug
 

chipset

Senior Member
Im not lying lol. Really the acc and ignition circuits arent conditioned AT ALL. To put it in simplest terms and this pertains to ALL vehicles from 1900 till now is like this...

1)BATTERY goes to IGNITION SWITCH and splices off to the fuse panel for the BAT circuits.

2) The IGNITION SWITCH takes the BAT voltage and sends it to..
a. ACC (Accessory) buss bar of the fuse panel
b. IGN (Ignition) buss bar of the fuse panel
c.) START (Starter) this is direct via a few inline switches for safety and/or security

There is no conditioning added at all. The nice thing about newer cars is either the lack of guys hacking the wiring, less or no corrosion, correctly designed alternators ect.

What Im getting at is that most cars in what Id consider good shape dont experience alot of the issues warned about. A properly grounded motor and chassis should remove 99% of the noise in the vehicle. Beyond that you have the high frequency EMF from the ignition and misc motors and thats where the component conditioning comes from. After reading the post about using a PICAXE to run a fan in the engine compartment without anything close to acceptible signal condition Id have to say Im more that confident that Ill be able to implement a working design into a car.
 

chipset

Senior Member
I guess my Honda's have good regulators. There are three taps in the fuse box const-switched-and lights. I may be wrong, but they are tied directly to the alternators regulator output. I've never blown anything, but I may just be lucky. *shrug
I think youre a little mistaken how the alternator and "regulator" works.

depending on the year of your Honda and Im assuming a newer one, the alternator is actually computer regulated based on current draw sensed inthe sytsem. Either way the regulator does one thing and thats to maintain a regulated voltage AND amperage out of the alternator in order to maintain a proper charge on the battery. Think of the alternator as nothing more that a battery charger and youll be fine.

As far as the rest of the electrical system is concerned, volatage is direct from the battery and split via the ignition switch to different bussbars of the fuse panel(s). The noise on the line is the same noise every other component in the car see's. In youre case youd be correct in saying that your Hondas electrical system is pretty good. You are only gonna see a lot of these voltage spikes and AC ripple and such on cars that are in need of repair. Otherwise most of the time a lot of the problems dont even exist. With proper installation practices I dont think any of these issues would matter.

In my case I think Im gonna run my power and ground circuits direct to the battery itself. Thats where critical electronic compents are powered from so I think Ill follow the same method.
 

SgtB

Member
My apologies for sounding argumentative. That wasn't my intent.

I guess I never looked hard enough. I've got the helms electrical supplement in front of me for my s2000 and I see what your saying. In the charging circuit diagram the output to the fusepanel taps looks separate, but the obvious problem is the tap from the battery to the under hood panel, to the cabin panel....and the regulator isn't what i think as well. As many times as I've pulled everything off that motor and put it back on, you'd think that would have crossed my mind. I'm a gear head and a electronics enthusiast, and I'm honestly surprised how ignorant I am about that part of the circuit. I mess with voltage offsets and COP dwell..etc..etc with tunes but something so simple... Thanks for the correction.

Just to let you know how forgiving the Picaxe's are, I've been running an 08M straight off of my third brake line as a blinker for over a year with only a 7805 on it. I've got an 18x DCI running on a 7805 and a zener too. Like I said: lucky :)
 
Last edited:

chipset

Senior Member
see we learn things everyday lol. You didnt sound argumentitive although you sounded uneducated in the world of automotive electrical systems. Im only in buisness because I understand it better than most if not (and not to toot my own horn) the best in my city. The alternator just adds power to the battery circuit and recharges it. The reason it goes above 12v is to make sure more voltage is going in than coming out.

As far as being lucky.. I dont think so, Most newer cars, especially fuel injected ones have an electrical systems designed for the existence of microprocessors. You arent lucky you just have a car more hospitable to digital electronics.

Now there are some turds on the road that are nothing but scary for digital IC's. These cars though should be crushed and I dont think the owner of one would be adding a push button ignition switch.

You on the other hand might wanna look at my code, PM me for the hardware parts and you could use your start button to do the same thing ;)
 

BeanieBots

Moderator
All I'd like to add to this is that not all cars are involved in accidents but all come fitted with seat belts.
The fitting of a seat belt does not reduce the likelyhood of an accident but it does reduce the consequences.
The same applies to electrical noise suppression.

Also bear in mind, the law does not always follow common sense.
It follows a set of rules which must be adhered to.
 

chipset

Senior Member
which law are you referring to? European laws differ from US laws. TUV regulations dont apply to Americans. What Im getting at is that to even be allowed on a car in Europe the product needs to be TUV certified. That certification follows a stringent set of testing and production rules. Hell you cant even bolt on an aftermarket set of wheel in some countries without it being crash tested... As far as what Im making and who may or may not be using it, I can guarantee it wont be in Europe and it will be at the users risk.

With what Im building the worst of what could happen is the car turning off. Loss of power could be dangerous but then again there are a 1000+ products on the US market for a car that could cause power loss at any time.

Caveat Emptor is the perfect by line for any aftermarket product. I dont have the resources to make sure that anything I put in my car or anyone else may emulate and put in theirs may work right. That meaning that I cant simulate every condition known to man be it heat or cold, voltage transients or crappy alternators. If I can make sure under normal conditions a device I build will work in my car with correct installtion procedures being adhered to then Im happy. More or less if I can make something that performs in a way I want while not bveing baked in an oven or frozen in liquid N2 then Im ok with it. Ive built, installed and sold enough electronic componets for vehicles that Im willing to take the chances. Not only that I have an insurance policy to CMA aka Cover My A$$.

For this project though Im just wanting to make sure that I dont blow the thing up by installing it my car to test it out.
 

Dippy

Moderator
This old chestnut again I see...

I think we have to be a little careful here.
Many of the previous comments are:-
1. Generalised and probably based on ancient cars and the 'worst case scenarios'
2. Carefully written with total novices, know-it-alls, or Google-Experts in mind
- nothing wrong with playing safe is there?

During moments of boredom I have 'scoped a couple of newish cars and found the supplies to be pretty clean - and the only sparkly bits were the plips and plops used by many Engine Diagnostic devices.


I'm sure in most cases a simple fuse/choke/transient-suppressor/diode would be fine before your regulator.
I'm sure you can get away with less in many circumstances and it will work fine.... until Sod's Law comes down and haunts you.
At which point you'll kick yourself that you didn't spend the extra 2 bucks and 10 minutes.

I know nothing about telling Insurance Companies about little boxes you stick in your car.
I know nothing about the PSU design in an EMU/ECU, but I'll eat my hat if its just a 7805 and a couple of Ebay capacitors!!

However, I DO know that many components ARE 'Automotive Rated'.

Example:
"TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements."

I'm sure they didn't just write that for a laugh :)

Check further if you wish... I've got some wallpaering to do. You will find that there are all sorts of 'worst case' scenarios mentioned.

And it ain't rocket science to protect your bits. Screening/Grounding etc. is a separate issue.
Anyway, everyone's an expert so I'll bow to their expertise.
 

chipset

Senior Member
Dippy you couldnt say it better.

I understand what youre getting at with the Google experts and over more making sure the "less experienced" guys dont go about doing things that could mess up their cars ect.

This thread kinda grew into something more than I expected but Ill be the first to say...

IF YOU DONT UNDERSTAND VEHICLE ELECTRONICS, DONT ASK HERE AND DONT MAKE MODULES THAT COULD POTENTIALLY HARM OTHER BECAUSE YOUR CAR STOPPED WORKING UNEXPECTEDLY!!!


ok, with that said and my self confidence knowing that I can most likely make this thing work in a car, I think it'll be safe to have my code loop instead of designing a hardware solution to toggle power to the chip.

If anyone wants to link anything else related to signal conditioning in a vehicle feel free its not my thread anymore lol But Id love to read up on more methods of doing it.
 

Dippy

Moderator
If in doubt try it on the Mother-In-Law's car first.

PS. Whats wrong with a button on the reset pin as mentioned earlier?

Alternatively put the PICAXE in a low-power Nap loop with an IF in it and have a button somehwere.
Or just in a loop if power isn't an issue.
 
Last edited:

chipset

Senior Member
The wholepoint of it was to do what any new luxury car has and no luxury car has a reset switch. Just an ignition button.

Before my divorce I drove an Infinity with the Smart Key technology and I was hooked.

I figured out the RFID part by using this cool little relay from Masterlockhttp://www.mastersentryseries.com/starter/index.shtml

Its a normal Bosch style relay that has an RFID chip built in. I have already bought a few and they work perfectly. Designed correctly, you can have a keyless ignition system that utilizes a single push button and doesnt require a key; just like a luxury vehicle.

Thats the point of this project and thats why I chose PICAXE to begin with. What Ive learned though is this chip is insanely powerful for its cost and size.

From what Ive seen I dont think anything other than a loop running with no outputs engaged will be an issue for a regular car battery. Im figuring in how much current a normal car alarm would pull and a picaxe is nowhere near that amperage draw.
 
Last edited:
Top