Pages: [1]   Go Down
Author Topic: Car battery voltage regulation for ATtiny85 (and other MCs)  (Read 1126 times)
0 Members and 1 Guest are viewing this topic.
Wyoming, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 14
CPEN student, UNO owner
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So my tachometer project is working good up until I try to power the ATtiny85 with my motorcycle's 12V battery. I Am using an LM7805 5V regulator to get down to the proper voltage. The problem is that my outputs (LED's) freak out and do random things when I power it from the battery if the bike is running. If I connect everything to my motorcycle except use a 9V DC wall adapter and run that through the regulator it works fine. The same goes for swapping the supply with a 9V battery. I have been looking into voltage regulators and the only thing I can see that I am doing wrong is I'm not putting a couple tiny capacitors between the Vin and ground and Vout and ground on my regulator like this: http://thedasdet.deviantart.com/art/5v-Regulator-358912063

I think I am getting huge spikes of voltage from my battery which causes my regulator to fail (even though it is rated up to 18V, and I didn't think a car battery spikes as much as 50% over itself). But then if that happened, wouldn't my MC get fried? I don't know. All I know is that there is noise or some kind of interference coming from my motorcycle battery only when the bike is running.

Attached is my crudely drawn schematic.

Thanks a lot!


* schematic.png (17.83 KB, 1276x768 - viewed 64 times.)
« Last Edit: May 12, 2013, 10:27:57 pm by vikingbush » Logged

Wyoming, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 14
CPEN student, UNO owner
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I just came across this. Although he didn't actually build it yet (or say anything about that) I really think he knows what he is doing. Should I go ahead and build this?

http://www.ecircuitslab.com/2011/07/car-battery-monitor.html



* Car+Battery+Monitor+Circuit+diagram.jpg (175.89 KB, 978x1026 - viewed 110 times.)
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The voltage regulator needs the input and output capacitors to work effectively.  There will definitely be a lot of high frequency noise coming across the 12v from the distributor cap.  You will probably need a 12v inline noise filter before the regulator.  I would also recommend a 0.1uF decoupling capacitor across the VCC and GND pins on the ATtiny85.

http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 583
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You need at least a 100uf cap on input side of the LM7805 in this application as well as a 0.1uF on the output.  Also, as already suggested put a 0.1uF across Vcc and Gnd of the ATtiny.  If you can get a hold of a 50mH to 100mH choke rated at twice the current your circuit draws would also be very nice and quite possibly a requirement.  I am assuming your circuit draws less than about 100-200ma.  Those 4-amp automotive radio filters are pretty bulky.

BTW, what kind of bike is it?
« Last Edit: May 03, 2013, 02:41:12 pm by BillO » Logged

Facts just don't care if you ignore them.

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2808
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are a myriad of solutions for that kind of noise which comes from the electronic ignition... But I'd try a Buck mode converter and shielded wiring to sensors.. Grounded AT the Controller, Only. There are buck mode converters that can take 60 to 80V 10 MS spikes available and If I was REALLY worried I would kick it back to whatever voltage I needed. The reason why it works is the switch and the energy storage inherent in the coil and capacitor used as the storage elements..
In the 1980's I was designing radio/intercon interfaces for offroad racing and that was something that worked well... They can be had for 2 - 3 dollars on Ebay.. "Free Shipping Too",,,

Doc
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2808
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An LM3914 would be a much better deal as a voltage monitor and can easily be expanded to a spread type of meter that reads a small range of voltages...
There are some relevant app notes in the data sheet and I'm Sure that Mr Google has a big lot of answers if the data sheet doesn't,
Data sheet attached...

Doc

* LM3914N.pdf (371.18 KB - downloaded 8 times.)
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Wyoming, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 14
CPEN student, UNO owner
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I went ahead and built my regulator, there it is below. It worked alright when I just had it on a breadboard but I haven't got to try the board on my bike since it's a little too late to be revving my bike up.

Also, for everyone saying that I need a 0.1 uF across Vcc and GND, well there already is one. The 0.1 uF capacitor's pos and neg nodes are on the same nodes as if I were to put one there distinctly.

You need at least a 100uf cap on input side of the LM7805 in this application as well as a 0.1uF on the output.  Also, as already suggested put a 0.1uF across Vcc and Gnd of the ATtiny.  If you can get a hold of a 50mH to 100mH choke rated at twice the current your circuit draws would also be very nice and quite possibly a requirement.  I am assuming your circuit draws less than about 100-200ma.  Those 4-amp automotive radio filters are pretty bulky.

BTW, what kind of bike is it?

It's a 1996 Ninja ZX6.


* 942093_613008712060641_2047830144_n.jpg (38.23 KB, 719x539 - viewed 33 times.)
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 583
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, let us know how it works out.  The ZX6 electrical system, while not really clean, would be cleaner than something like a KTM EXC.  If it still gets upset, the choke would be the next thing to try.  Something like this:


* BikePS.jpg (26.92 KB, 765x339 - viewed 49 times.)
Logged

Facts just don't care if you ignore them.

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 29
Posts: 2239
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would still include ZD1 and D1 per the schematic in your second post. ZD1 protects you from high voltage spikes and D1 protects from reverse voltage spikes. The parts cost just pennies.
Logged

Northants - UK
Offline Offline
Full Member
***
Karma: 1
Posts: 241
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have blown up 78L05 regs before by not using input capacitors, Capacitors are a must end of. The theory goes one 10+uF and a 100nF each side but i see that these days many dispense with the 100nF - no comment there I'm not such an expert.

You can use an lm7809 for your 9V - whats the problem ?
Logged


Wyoming, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 14
CPEN student, UNO owner
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I typed a long reply and it was rejected...

It worked fine save for some coding tweaks while my motorcycle was just sitting on its stand in my garage doing some rev tests. But upon actually taking it out and riding it, the thing kept restarting (I have a short startup sequence of the LEDs) and freaking out.

So I have come to the conclusion that my motorcycle's (1996 Kawasaki Ninja ZX6) electrical system is so unstable that no sort of digital electronics can run off it.

On a side note, I found a guy that did an LED tachometer on youtube but he did not use a microcontroller, used a frequency to voltage converter straight off the ignition coil, and used some LED drivers.
http://www.youtube.com/watch?feature=player_embedded&v=Z5WAXkjszhw#!
Logged

Offline Offline
Edison Member
*
Karma: 20
Posts: 2106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have blown up 78L05 regs before by not using input capacitors

Really? how?
Logged

Pages: [1]   Go Up
Jump to: