Pages: [1]   Go Down
Author Topic: Truck Underbody and Footwell Lighting Project  (Read 757 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone, I am new to this forum and before I start I would like to just say a little about myself. I have been an electrician for almost 8 years now, so schematics, diagrams, electronic components, etc, etc, are not foreign to me, what is foreign to me, however, is the arduino and its affiliated programming software. I have been reading quite alot of forum posts here to reduce the chances of me asking a question that was just answered 5 minutes ago in another thread, but if that happens, please forgive me... I tried  smiley-razz. Anyways, below is a block diagram of my project. From reading and searching through other posts, I believe it will work on a hardware level; I am not getting into the programming side yet. If anything is amiss, could be done better, or is just flat out wrong, please, please let me know.



What's going to control what
Its pretty straightforward, the 0-12vdc PWM input (which I will intercept from my trucks dome light) will simply be mirrored to the footwell lights output. Whenever the dome light times out and dims, I would like the footwell lights to do so also (I may add more control later, hence why its only mirroring now). The three 0 or 12vdc inputs will control the underbody lights. The underbody output will be PWM simply for fading in/fading out purposes.


Optocouplers
The schematic I plan on using for the optocouplers can be found here under "method 2". I found this schematic after I found out that the arduino only accepts 0-5v for its inputs.

12vdc power conditioner
The schematic I plan on using for the 12vdc power conditioner can be found here. C2, C3, and IC1 will not be in that circuit as those components are for dropping the voltage. I found this schematic after I found out that hooking up an arduino to an operational car battery, without protection, can be hazardous to its health (due to voltage drops while cranking, and potential voltage spikes while the engine is running)

Arduino Nano
The specs can be found here. Figured I would put this on here just for quick reference.

12vdc power amplifier
The amplifier that I will be using to drive the underbody and footwell lights can be found here


Again, if anything is missing, could be done better, or is just flat out wrong, please don't hesitate to tell me. If you need more information, please don't hesitate to ask, I will do my best to answer.

Thanks for all your time,
HomerJay


**EDIT**

Just a quick question, could I use a bigger capacitor (C1) in the power conditioner schematic to help steady out the voltage for the few seconds the voltage drops while the starter is cranking?
 
« Last Edit: October 28, 2012, 07:42:16 pm by HomerJay » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, if you just want your custom light to turn off when your other light does, it may be easier to have a light sensor stuck on the other light?  smiley-wink
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks OK to me, although where you have 4 wires in places (on the left) you can probably have 3. Ground plus the active signal.

The programming should be straighforward, I would play with doing it with switches and LEDs for now just to get your hand in. How were you planning to read the PWM input? The simplest might be a RC filter that just converts the PWM into 0 to 5V and do an analogRead on that. And for testing on the bench, just use a pot to give yourself the analog input.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, if you just want your custom light to turn off when your other light does, it may be easier to have a light sensor stuck on the other light?  smiley-wink

Thanks for the suggestion. I would prefer to use its signal directly, but that would be a good plan B.

Quote
Looks OK to me, although where you have 4 wires in places (on the left) you can probably have 3. Ground plus the active signal.

Sorry, I should have stated that the LEDs installed are single color LEDs, not RGB. My 12v amp is intended for RGB, but I will be using it as a 3 channel amp instead. I will, however, only be using 2 of the 3 channels, hence the reason why only 2 outputs are shown on the drawing.

Here is the breakdown for those 4 wires... the PWM input is strictly for controlling the footwell lights, the other 3 inputs are for controlling the underbody lights. The 3 inputs for the underbody lights all come from my car alarm ( 1 input for monitoring "LOCK" function, 1 input for monitoring "UNLOCK" function, and 1 input for monitoring "AUTO START" function.) I am using 3 seperate inputs for the same output just for programming flexibility.

Quote
The programming should be straighforward, I would play with doing it with switches and LEDs for now just to get your hand in.

Agreed. I'm not about to spend hours installing it just to find out something is wrong.  smiley-razz

Quote
How were you planning to read the PWM input?

I read that the arduino can natively read PWM inputs via the "PulseIn()" command, would you be able to confirm? If the arduino cannot natively read PWM, would you be able to supply a schematic of an RC filter that would be applicable?

Just one last question for anybody here, I'm only assuming my dome light is PWM controlled. Its a 2009 dodge ram, so I couldn't see why they wouldn't control its dimming effect via PWM. Anyways, would there be a way to confirm its dimming technology without the use of an oscilloscope? <--- it's on my Christmas list, here's for hoping!  smiley-lol

Thanks again for all your time,
HomerJay
« Last Edit: October 29, 2012, 05:16:03 pm by HomerJay » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I read that the arduino can natively read PWM inputs via the "PulseIn()" command, would you be able to confirm? If the arduino cannot natively read PWM, would you be able to supply a schematic of an RC filter that would be applicable?

Well, it can, but this sounds like overkill to just get a light level.

Something like this:



Maybe 4.7K for the resistor and 10uF for the capacitor. Other guys here know more about RC filters than me.

The output is then the average voltage from the PWM input (taking into account the duty cycle), which you could read with a simple analogRead.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Something like this:



Maybe 4.7K for the resistor and 10uF for the capacitor. Other guys here know more about RC filters than me.

The output is then the average voltage from the PWM input (taking into account the duty cycle), which you could read with a simple analogRead.

Ok, sounds good and thanks for the schematic. I'm guessing trying to mirror the PWM signal is harder than it seems, or at least not worth the effort?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you just want to mirror it, why use a processor at all?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to be able to add control later on, I guess you could call that "part 2" of the project. The footwell and underbody lights have been installed on my truck for many months already, this project is just to "spice up" the control aspect of the lights (it also serves to get me acquainted to microprocessors). For instance, I have an in-line rotary PWM dimmer in my footwell lighting circuit, if I add another 2 inputs into the Nano (1 for dimming, 1 for brightening) I will be able to add a nice looking, 2 pole, momentary toggle switch to my dash and be able to delete/remove the ugly "hidden-under-the-dash-and-hard-to-get-to" in line dimmer.

As I am rather foreign to the code that arduino uses, I have no clue as to which method of input (pusleIn() or analogueRead()) is easier to program/manipulate. What would you advise?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

pulseIn is blocking, that is, it waits for the pulse to complete.

analogRead takes 104 uS, but apart from that doesn't block. You can write analogRead to be asynchronous (so it doesn't wait at all but raises an interrupt).

For me, I'd use analogRead, because you can take a reading from time to time (eg. a few times a second) and use that to configure the analogWrite (ie. the PWM output).

I suppose you could measure pulse widths from time to time too, but it seems kludgy to me. For one thing, a PWM input will have a duty cycle, so you would need at least two pulseIn reads (eg. the on cycle and then the off cycle).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

O, ok. Thanks for all your help Nick. Now the only thing left is to wait for my arduino to show up... smiley-razz.
Logged

Pages: [1]   Go Up
Jump to: