Questions about my project. (Arduino controling accessories)
Moderators: adafruit_support_bill, adafruit

Questions about my project. (Arduino controling accessories)

by theonlyski on Tue Nov 27, 2012 12:06 pm

Hey guys, finally thinking about upgrading the rats nest of a design currently in my truck to handle the accessory and air system. Currently I have a Freeduino with a relay shield and another PCB project board that handles a few connections to my truck's accessories.

I have the 20x4 ( display connected via the i2c backpack ( Working great and looking great, but too bright. Going to want to dim this down and hopefully control it with the dimmer switch in the truck (running thru a voltage divider and PWM the back-light off the result).

I want to create a custom board using an ATmega 168/328 that will replace the Freeduino. Using this guide ( ... /?ALLSTEPS) to make a stand alone Arduino controller. I want to run 3 relays using the digital out pins, have 3 switch inputs, have 3 analog sensors (one for pressure, one for temp, one for voltage from dimmer switch on a voltage divider) and have the output going to the LCD.

So far, everything seems to be working fine, just a rats nest of wiring and I want to clean it up. Here are my questions:

1) If I use a ULN2803 for the outputs to drive low current relays, do I need to have a resistor in line between the digital pin and the input on the 2803? It looks like I don't, but I want to make sure. I know I needed one for the transistor setup I had first, but it seems like the Darlington Array doesn't need it.

2) Would I be better off separating the PWM LCD to a different (smaller) AT chip that is solely dedicated to that function? I think I will be fine using the 168/328 but I'd like to be sure.

3) Where would be a good source to get one board etched up that can pull an Eagle file and not cost an arm and a leg? Talking about possibly a 5"x5" board (though I'm pretty sure I can shrink that.

I know about the analogRead having issues with multiple sensors and how to counter them, that's already on my list of things to change with the code. Currently only running one sensor so it doesn't seem to be an issue.

Ideally for this project, I will:

Build the Arduino circuit and test

Connect the 3 digital out pins for the relays and one PWM pin for the LCD controller to the ULN2803 and test

Incorporate current sketch and test

Add PWM using the voltage divider from the dimmer switch and test (and tweak and tweak and tweak)

Then build the board in Eagle and find someone to make it real

Assemble and final test
Posts: 3
Joined: Sun Apr 15, 2012 12:01 am

Re: Questions about my project. (Arduino controling accessories)

by JStorto on Wed Nov 28, 2012 12:04 am

Answer to number 3).
If lead time is not a concern you can get a finished product at $5 a square inch and you get 3 copies.

Becuase of the size of your board you may also want to look at But the shipping can get ya.
User avatar
Posts: 8
Joined: Wed Sep 19, 2012 7:58 pm

Re: Questions about my project. (Arduino controling accessories)

by adafruit_support_bill on Wed Nov 28, 2012 7:25 am

As for 1 & 2:
1) ULN2803s have internal resistors on the inputs. No external resistor is needed to drive from logic levels.
2) If you have an available PWM pin, use it. No need for a separate chip.
User avatar
Posts: 30822
Joined: Sat Feb 07, 2009 10:11 am

Re: Questions about my project. (Arduino controling accessories)

by theonlyski on Wed Nov 28, 2012 1:11 pm

Thanks guys!

Now I need to get in the wiring and see how the dimmer switch is working on the truck and figure out a voltage divider for it.

I am probably going to have the ULN switching the relays at +12V DC so the LCD dimmer will have to come off of the PWM pin direct. From what I've found this isn't a problem as the LCD is only drawing about 33-35mA.

Would the dimmer circuit be as simple as (barring any tweaking that I determine to do):

Code: Select all | TOGGLE FULL SIZE
analogWrite(LCDPWMPin, analogRead(DimmerPin) / 4);

Or would I be better suited doing it the long way?
Code: Select all | TOGGLE FULL SIZE
brightness = analogRead(DimmerPin) / 4;
analogWrite(LCDPWMPin, brightness);


I know this would probably be better suited for the Arduino thread, but I hate making new threads if I don't have to.
Posts: 3
Joined: Sun Apr 15, 2012 12:01 am