Looking for guidance.

Hi, this is my first post on the forums after 3 years of playing with my Arduino Uno, I have been studying the workings of the atmel AVR chips for the last year trying to plan for my first real world application project. hear is the gist of what I'm doing;
I have an 88 Ford Bronco II witha 2.9l V6 and tons of off road goodies,
I tore everything out this summer including the dash and wiring harnesses
the motor has been mostly rebuilt while I was still working professionally at an automotive electrical shop.
Most of the wiring has been re built from scratch to better fit the vehicle for the new goodies and custom dashboard.
Everything has been simplified and I'm now up to the point of putting together the power wires for ignition control and auxiliary power for radio and light. I have a Viper alarm that has a few auxiliary outputs that can drive small currents to ground. I want to make a control module that can interface with this alarm to remote start the truck and control things such as the ignition switch (momentary on toggle switch for start, Keyless ignition system) and power for lighting and radio equipment (sequential power), as well as possible PWM control for the cooling fans and input from digital temp sensors around the truck.
I already have a lot of parts in stock in my lab at home hear. I can order parts from Mouser, Sparkfun, Radioshack, and Fry's Electronics. I do have a mediocre background in Electronics and programming, I'm not above using C to program this, but I am limited on resources. I'm also not above doing things a little differently so long as the basic ideas are still there.

enough of the introduction. here is what I have so far;
(issue 1)
I have 2 (two) NTE251 NPN Darlington Power amp transistors(Datasheet http://www.alliedelec.com/images/products/datasheets/bm/NTE_ELECTRONICS/70215952.pdf) for controlling the main cooling fan, which pulls about 16 amps continuous and no more then 30 amps and start. Will I be able to use this part to PWM the fan? what would be the best way to wire that? will i need a driver for the transistor from the AVR?

(issue 2)
I would like to be able to read signals from the 10-14 volt wiring on the truck, such as Tachometer, Vehicle Speed Sensor, Voltage output from alternator etc. What is needed in order for me to safely read these inputs on the arduino? do I need to order any special parts or can I use any fo the basic stuff I already have? (I have standard transistors and a few of these https://www.sparkfun.com/products/314 as well as a ton of standard parts)

(issue 3)
I have a few ATtiny84 and ATtiny85 chips in my inventory with (2) 16mhz crystals to change the speeds. I want to use these where i can rather then use the one ATMega328P I have on my uno board. If I do have a use for these in the design should I go about programming these without the arduino boot loader? I heard that if you forgo the boot loader you save a bit of space and speed. I don't feel that the program will be too large. I want to use my arduino uno for ISP of the ATtiny chips as they are in the prototyping stage in case I need to tweak the code or debug in my beta stage. Alpha stage will be in the lab.

(issue 4)
I want to add Audible tones for feedback into the project. either through a small speaker behind the dash or through the stereo speakers somehow. Is there a way to produce more complex sounds rather then square wave tones from the arduino? I'm thinking more like door chimes and audible warnings for temps and such. is this doable or do I have to stick with the crappy tone library?

I know this is a lot to read, I appreciate who ever looks at this. your time is valuable to me as this project is 5 years in the making and its finally coming together. I would love to be able to get all these resources together into on project and share it as open source hardware and software when the project is finally at a polished and releasable stage. something i can put together as a kit for others looking for a similar device for their project car or truck.

Issue1: The transistors should be fine. The AVR should be able to drive them directly. See schematic

Issue2: I would use a 7,5V zener diode and a voltage divider in order to bring down the cars voltage range to the 0..5V range for the arduino. The provided schematic gives you a 0 reading for 7,5V in and a 1023reading for 14,75V in.

Thank you, I will take a look at the schematic in the lab later.
Do you think the transistors will do fine running a high current load such as the cooling fan with PWM? the datasheet says they are for low frequency switching only. but I'm not sure if the PWM i'm dealing with is above that spec. my guess is probably not.
I might add in some safety measures to be safe such as a shunt diode and such.

I appreciate your time and quick response. I'll let you know how it goes.

I have another thing to add to this, I want to be able to put the AVR on a low power consumption stand by mode so that the module does not drain the battery down over time. I want the AVR to be able to come on to full power though as soon as a signal from the alarm is sent to one of the pins on the AVR. I haven't had a chance to play with any of the different power modes of the Atmel chips but i thought i read something about an external interupt pin waking the AVR from standby mode. is this true?

The switching frequenct is no problem. Normally arduino outputs a PWM signal at about 490Hz which is quite low. What you should do (i forgot) is put a freewheeling diode over either the motor or the transistor. I suppose that is what you meant. You culd also experiment with increasing the value of the base ressitor of the transistor (increasing it).

The Arduino is sensitive to voltage spikes on the power supply and any inputs connected to it. Cars are hostile electrical environments and can cause a lot of noise due to conducted transmission of noise generated by the ignition system and other power consumers, and radiated transmission. If you're going to use an Arduino in this environment then you need to enclose in in a Faraday cage and protect every wire coming into it against voltage spikes. You will also need to protect it from contamination and mechanical vibration. It would be sensible to keep it away from temperature extremes too.

What PeterH said. You're going to want to buy a bunch of optoisolator chips.

I've just started using ATTinies myself. Be aware that a lot of the libraries for Arduino flat out do not work on ATTiny. So you may find yourself finding alternate libraries or writing your own.

for pwm outputs this high it is best to use optocoupler, and you will have to amplify this signal with some darlington as thebase current is pretty high at 30 amps

PeterH:
The Arduino is sensitive to voltage spikes on the power supply and any inputs connected to it. Cars are hostile electrical environments and can cause a lot of noise due to conducted transmission of noise generated by the ignition system and other power consumers, and radiated transmission. If you're going to use an Arduino in this environment then you need to enclose in in a Faraday cage and protect every wire coming into it against voltage spikes. You will also need to protect it from contamination and mechanical vibration. It would be sensible to keep it away from temperature extremes too.

EDIT; Please don't read what i write hear as being snippy or with attitude, I do not come with the pretense of knowing everything.
I just want to let everyone know that I have already taken that fact into consideration and that I'm at another stage in the design processes. Power always comes first.

Already accounted for, Like I had mentioned previously I worked as an electrical specialist at a mechanic shop for a few years. the boss was a master mechanic specializing in electrical. I learned a lot there. this whole module is going to be inside the truck under the dash and the final circuits will be potted and sealed, I already have the darlington pair optocouplers, I'm thinking about using those on most of the analog inputs, as for the output I doubt I will need them there since everything will be driven by an electro-mechanical relay except for the NTE251 Darlington Transistors for the cooling fan. if you open up a cars ECU there isn't much more then an array of diodes for every input and output and the aluminum case being grounded. with the AVR being isolated from all the inputs I don't see much of an issue. I will post updates as I go on to let you know what I find and what results I get.

As for using the ATtiny chips I am not so worried about using special libraries as most of this is just simple control programming, if i divide the work up amongst the different chips for different tasks and have basic communication between them I can avoid loading them up with too much code. Or am I going about this with the wrong idea?

these are just my basic design principles, if you guys think I might be wrong feel free to tell me I'm wrong and provide examples. I'm here to learn more then anything. and thanks for the replies.

shooter:
for pwm outputs this high it is best to use optocoupler, and you will have to amplify this signal with some darlington as thebase current is pretty high at 30 amps

Even with the NTE251 being a darlington with internal shunt resistors? I was wondering if I needed to add a driver of some kind, would a 3904 or 3906 BJT work to drive a little more current to the NTE251? or something much larger? keep in mind I will be using two of these NTE251's in parallel to give myself room and to ensure I have redundancy in case one fails. both should be driven on and off at almost the exact same time.

EDIT: This will all be obsolete of course If someone convinces me of a better way to drive the fan. I am considering the use of Logic level MOSFETs at this time.

SargentSeven:
As for using the ATtiny chips I am not so worried about using special libraries as most of this is just simple control programming, if i divide the work up amongst the different chips for different tasks and have basic communication between them I can avoid loading them up with too much code. Or am I going about this with the wrong idea?

That's certainly a valid approach. Whether to use one big ATmega or several ATtinies is more of a philosophical question -- both work fine, so do it the way you like.

I kind of favor one big Atmega myself, but there are plenty of arguments to splitting functions into multiple chips for large projects -- response time, redundancy, etc.

tylernt:
-- response time, redundancy, etc.

that right there is the biggest part of the design, redundancy. If one piece of the puzzle fails the rest of the module will continue to function. Last thing I want is for the truck to turn off while driving. or the cooling fan to stop turning while I'm running in the desert. I think I might add a bypass of some kind but I am not so sure about the idea, I don't want someone to be able to start my truck easily without using the alarm remote to disarm. maybe something like a valet button hidden somewhere.

You sound like you know what you're doing but just FYI, Atmel chips have a watchdog timer. If a software error (or certain types of hardware error) causes the chip to stop responding for a few milliseconds, the watchdog will reset (reboot) it. It's already there so it's free to use, so regardless of single chip or multiple chips you may want to consider using the watchdog.

tylernt:
You sound like you know what you're doing but just FYI, Atmel chips have a watchdog timer. If a software error (or certain types of hardware error) causes the chip to stop responding for a few milliseconds, the watchdog will reset (reboot) it. It's already there so it's free to use, so regardless of single chip or multiple chips you may want to consider using the watchdog.

Actually I was reading about that in the datasheet and was curious as to how I could implement that into the code, in case something goes wrong it will see it and reset the chip. Or if I understand the document right, I can even have the watchdog timer send a signal to an external circuit to reset everything in sequence and display an indicator of an error. like some kind of failing point diagnostic LED. I haven't yet thought up a system for debugging or error handling but I wasn't sure yet if the code would be that heavy to need it.

If anyone can point me in the right direction for figuring out a way to play better sounds with the arduino or a chip that can do the work for the arduino that would be awesome. I'm getting all the peripherals together in the code right now. I ordered a few Atmega328P's from mouser along with heat sinks for my power transistors. I think I may use one 328 for the central control unit and a couple ATtiny AVRs for things like the light control and power functions as a fail safe. I think I can use the software serial library on the tinys for single pin communication between AVRs.

A New issue appears!

I now need a new way of controlling the LED bulbs that run off of 12 volts throughout the truck. the turn signals and tail lights I was planning on controlling with a simple arduino circuit consisting of (4) tip122 darlingtons, the current draw of each bulb is in the range of 0.19 amps and 0.06 amps @ 13.3 volts. however, I discovered that the swithback LED turnsignals I have require a common ground to operate. the positive side is where I need to have the control leg. What can I use to PWM these on the positive side without much more then a small transistor or MOSFET and a few resistors for protection? do I need to order some logic level MOSFETS? or will the TIP 122 do positive control rather then the usual negative control? anything I'm looking at is talking about inductive loads. which I am not working with. I'm not as familiar with MOSFETs as I probably should be.
Thanks! :slight_smile:

NOTE: i realize I should reword all of this to make it more clear. I will work on it after work tomorrow. for now I'm hitting the sack.

For the watchdog, see: Watchdog in Arduino Library - or at least support by bootloader - Project Guidance - Arduino Forum

Only way I know of to get better tones is a WAV/MP3 shield or breakout board. Or perhaps an external circuit of your own design -- should be able to make a nice sine-wave generator with a handful of caps, resistors, and linear BJT transistors. You can switch it on and off with a digital pin or perhaps even modulate the pitch with a PWM pin.

EDIT: See http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/

As for high-side switching, I don't know much about MOSFETs but there are plenty of others here that do.

tylernt:
For the watchdog, see: Watchdog in Arduino Library - or at least support by bootloader - Project Guidance - Arduino Forum

Only way I know of to get better tones is a WAV/MP3 shield or breakout board. Or perhaps an external circuit of your own design -- should be able to make a nice sine-wave generator with a handful of caps, resistors, and linear BJT transistors. You can switch it on and off with a digital pin or perhaps even modulate the pitch with a PWM pin.

EDIT: See http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/

As for high-side switching, I don't know much about MOSFETs but there are plenty of others here that do.

Thank you very much for the helpful information. I went ahead and created a topic in the power control section asking about MOSFETs and Darlington pairs. maybe someone will come up with some useful information there.