TTT Microcontroller(s?)

Anything electric, AC or DC

Re: TTT Microcontroller(s?) -- Dimming the lights

Postby bradm » Wed Sep 23, 2015 8:59 am

I'll second the suggestion of using oshpark.com. I have used them many times for my arduino projects. In fact I have a small board order on its way from them now. I use the free version of Eagle CAD for my board design. It's fairly intuitive and outputs the brd file sets that osh park needs.
bradm
Teardrop Inspector
 
Posts: 2
Joined: Sat Aug 22, 2015 4:29 am

Re: TTT Microcontroller(s?)

Postby capnTelescope » Sat Sep 26, 2015 1:01 pm

bradm wrote:I'll second the suggestion of using oshpark.com.

Welcome, BradM. Thanks for the tip, Woodsmith and Brad. I'll strongly consider it.

capnTelescope wrote:... add-on circuitry we "invent"...

Speaking of which, at the end of a long and somewhat confusing thread on the Arduino forum, the following circuit emerged as a candidate for controlling dimmable loads.
Image
Anyone have any input? I found it on the internet, so it must be true. :frightened:

:beer:
I'll burn that bridge when I come to it.

Brad
ImageImageImage

Building the Bed & Breakfast
User avatar
capnTelescope
Lifetime member
 
Posts: 1218
Images: 368
Joined: Sun Jun 27, 2004 3:44 pm
Location: Round Rock, TX

Re: TTT Microcontroller(s?)

Postby troubleScottie » Sat Sep 26, 2015 4:34 pm

Nice suggestion. :thumbsup:

Many questions on the dimmable circuit as a design discussion. Trying to get my head around the feature and see where it might fit in my design.

The engineer in me is always concerned about requirements. Must have, like to have, want to have. [ is this entire arduino project a must have? :thinking: :thumbsup: ;) ;) ]

Obviously, adding a dimmer does not require any real justification or rationale. One can build it because one can.

Since I have not yet to build my trailer and considering only LEDs for lighting, what is the advantage of dimming lights or any other device as opposed to just turning them off? Most lights are not that bright to begin with, typically like a 20-40 watt incandescent. In addition, their power draw is relatively low. As best I can tell most devices eg lights, frig, radio, they are either on or off. Obviously there is the consideration of standby power draw, switches at the device, and convenience (inconvenience) of starting device up again eg radio pre-sets. Is there something that I am missing?

To the point of power saving, what is the power draw of the dimmer? Trying to remember unsuccessfully my 6 weeks working with transistors and op amps 20+ years ago, does the dimmer need power when it is not dimming? Is the power draw when dimming much less than what is conserved? I am guessing in an AC household circuit, the dimmer has significant savings, especially if dimming multiple lights. In an LED 12V DC environment, can the same be said? Can the dimmer be turned off ( from the control side)? Again, little/no practical experience or no way to evaluate.

More questions on design and implementation.
  • What type of pin on an Arduino would drive this? Is 5V sufficient? Might one need a shield to support the dimmer?
  • How many dimmers could the Arduino drive(total power) or more specifically what is the power draw of one dimmer so can manage with power draw of other devices, etc?
  • How many dimmers might one need? One per device? one per fuse? One per power circuit?
  • Can you have one item on a circuit with a dimmer and one without?
  • Would this work no matter the power draw? (max amperage of this circuit on the power side)
  • Which devices might be considered for dimmers -- and which ones in your TD are you planning on using it on? Obviously all LEDs could be dimmed. But which specific ones might you want to add a dimmer to?
  • What percentage of any device's on time would be dimmed? It is is always dimmed, would a smaller version work? If it is almost never dimmed, it the dimmer needed?
  • How much time would any device be dimmed? If this is really small ie 10 minutes per day, is it worth the effort?
  • If there were timers for the devices ie stay on for another 20 minutes, would the dimmer be needed?
  • Would there be other solutions ie a night (very low power) light? (difficult to retro fit, easy to design in)
  • If considering non-LED dimmable lights, is there a significant power saving when dimmed?
  • Can this be applied to AC circuits? (Not sure any device might use this)
Michael Krolewski
Scottish Terrier Fancier
troubleScottie
Donating Member
 
Posts: 358
Images: 16
Joined: Sat Apr 11, 2015 5:02 am
Location: Seattle, WA
Top

Re: TTT Microcontroller(s?)

Postby Dalorin » Sat Sep 26, 2015 6:06 pm

I promised myself I wouldn't post on this thread but it's kind of going off in all directions. Take what I have to say with a grain. To each their own.

If you used a micro controller for dimming you would not build a separate circuit for dimming. You would add a fet for 3 amp switching and you would interface it with a pin to implement pulse width modulation. Most modern micros have this ability built in.

A raspberry pi isn't optimal for the needs stated. It is a single board computer that is good for high level tasks like emailing you when someone breaks into your house. It is not 'better' it's simply suited to different tasks. For example it doesn't even have built in adc so out of the box it's useless for things like checking the battery level. But, even if it did have said adc it also has no band gap reference voltage to compare readings against. I love my pi boys. I have three of them. Just wouldn't use them in a camper.

The arduino is okay but the atmel chip on it is inexpensive and programmable just fine on its own.

Personally, I like the Attiny controllers. About 3 dollars buys a lot of microcontroller. And they have built in control registers and commands specifically for tasks like pwm for your dimming and motor speed control. They also come in low power varieties that can run on less than two volts. A USB programmer off eBay will set you back a whopping twenty bucks. Hard to beat.

But whatever. Just tossing things out there. I have some code at home where I made a dimming lantern. I'm out of town right now but I'll try to post something when I get home. It will at least show how to set up the pwm.

I'm more interested in having it check voltage on the battery against the band gap and looking up the current level in a table in memory. Then I can have a segmented led display battery as a percentage.
Dalorin
Teardrop Master
 
Posts: 135
Joined: Wed Dec 31, 2014 4:50 am
Top

Re: TTT Microcontroller(s?)

Postby Dalorin » Sat Sep 26, 2015 6:41 pm

On a side note, if anybody does wind up building a controller board for campers please please please include an onboard 12v regulator and some screw terminals. The led strips do not have built in regulators so 13.5 volts will burn them out. It would be nice to have led strips in the galley.
Dalorin
Teardrop Master
 
Posts: 135
Joined: Wed Dec 31, 2014 4:50 am
Top

Re: TTT Microcontroller(s?)

Postby capnTelescope » Sat Sep 26, 2015 9:04 pm

Dalorin wrote:I promised myself I wouldn't post on this thread but ...

But I bet you're glad you did. :) Welcome aboard.

Dalorin wrote:If you used a micro controller for dimming you would not build a separate circuit for dimming.

My bad, I didn't adequately describe. I guess the circuit might better be called a "driver" :NC for a load greater than the controller pin can handle by itself. The circuit is meant to be driven by a PWM signal off a controller pin. As I mentioned, the thread I found it in was long and filled with Bravo Sierra. There was quite a bit of discussion about whether or not the 20mA Arduino pin could handle the pull up/down load, whether the signal needed a little/lot of pullup, etc. Definitely a lot of "I'm smarter than you are" going on.

troubleScottie wrote:adding a dimmer does not require any real justification or rationale. One can build it because one can.

The justification would be that the controller chip can't drive some of the loads all by itself. See above.

troubleScottie wrote:what is the advantage of dimming lights or any other device as opposed to just turning them off?

Four advantages I see are
    1.) Sometimes we forget to turn them off, but just in case, I don't want to suddenly be plunged into darkness.
    2.) "Dimming" the Fantastic Fan would be a good thing, as it's oversized to a teardrop's needs.
    3.) Some lights I leave on purposely (find it in the dark/no campfire), but they don't need to be full brightness, saving battery capacity.
    4.) If the battery SOC is getting low, the TDCM can perform power saving chores (NOT the same as putting the controller to sleep) to extend battery life. A 50% duty cycle equates to half the battery drain by the peripheral. Ever notice how a LED flashlight doesn't get dimmer, it just dies. Suddenly. Leaving you in the dark.
    5.) Somebody (ahem) might have installed more lumens than necessary.

Okay, five advantages.

troubleScottie wrote:is this entire arduino project a must have? :thinking: :thumbsup: ;) ;)

Of course. :thumbsup: ;)

troubleScottie wrote: what is the power draw of the dimmer?

Lacking any hard numbers, I would say that during the off part of the duty cycle, it would be "very low". Same for just plain Off.

troubleScottie wrote:More questions on design and implementation.

taking them in order:
  • Digital out. Dunno. No shield.
  • One per used digital out pin. Dunno.
  • One per controlled circuit, which may have more than one device.
  • No. everyone on the circuit gets the same PWM
  • Probably an overload/short circuit would fry something. I'm planning a fuse per circuit.
  • Lights: Cabin, running, galley, porch. Plus Fantastic Fan
  • My thought is full brightness at first, time depending on what it is. E.G., Galley light on full for 15-20 minutes then dim for a few, then off. Find in the dark (FITD) 50% for ten hours then off. FanFan 50% always. That kind of thing.
  • Depends on the light/thing. A heavy load would be managed closely with a short time on, short time dim, short time to off.
  • The TDCM is the timer.
  • I'm using existing lights as night lights. YMMV.
  • With PWM dimming, the savings vary with the duty cycle: 100% duty saves none, 50% duty saves half, 25% saves 75%, and so on. Approximately.
  • Won't work with AC circuits.

Dalorin wrote:include an onboard 12v regulator and some screw terminals.

How much parasitic draw will the regulator add? Lots? Little? Proportional to load? I would think that anything intended for automotive use wouldn't need the regulator. Screw terminals needed for sure.

Dalorin wrote:The led strips do not have built in regulators so 13.5 volts will burn them out. It would be nice to have led strips in the galley.

The led strips in my galley have seen as much as 13.1V for short periods without failure. So far. :frightened: I wouldn't want to run them off TV voltages, but they seem perfectly OK with nominal 12V battery voltages. They light up the galley very evenly. Even better than fluorescent lighting. Do it. You'll be glad you did. :D
I'll burn that bridge when I come to it.

Brad
ImageImageImage

Building the Bed & Breakfast
User avatar
capnTelescope
Lifetime member
 
Posts: 1218
Images: 368
Joined: Sun Jun 27, 2004 3:44 pm
Location: Round Rock, TX
Top

Re: TTT Microcontroller(s?) -- 12 volt success

Postby capnTelescope » Fri Oct 30, 2015 8:02 pm

I'm back! Did you miss me? Summer heat finally broke so I could get some sweaty yard work done, LCG X happened and I had to get ready for that and last but not least, my first try at the dimmer/DRIVER circuit didn't work, so I needed some quality time to sort that out.

The driver circuit not working could be attributed to one or more breadboard errors. I'm shocked. :shock: It rained cats and dogs today, so you couldn't get around Austin without a boat. I stayed indoors and got bored enough to jump back into this project. Started the breadboard over from more or less scratch, and wonder of wonders, it worked! :P

Just to recap, the Driver circuit allows the TDCM to dim 12V lights using PWM. This bit of code may or may not explain:
Code: Select all
void setup() {
  // put your setup code here, to run once:
pinMode(2, OUTPUT);
analogWrite(2,0);
}

void loop() {
  // Start off dim and brighten
  for(int i=5 ; i<=255; i++){
    Serial.println( i);
    analogWrite(2, i);
    delay(12); //simulates the time it was taking to perform one loop
  }
 // delay(1000);
// now dimmit, dammit
  for( int i=255; i>=5; i--){
    analogWrite(2, i);
    delay(12);
  }
  //delay(1000);
}


Here's a high altitude view:
Image
The TDCM is running off a 12VDC wall wart, The red LED is there so I can tell if the program is running properly. The thingy trailing off to the left is a piece of 12V RGB strip. It only works when running off the wall wart. The red LED and the 12V RGB should be doing the same thing together in sync. And they do.

BTW, the P-channel FET is an IRF9520, and the Not Pointing iN transistor is a 2N2222.

The upper half of the breadboard is my original 3-way switch simulator, and does not participate in this experiment.

Here's a low altitude shot:
Image

And here's a different angle:
Image

So, what? This successful experiment means that I can now control (relatively) high current 12V DC loads with the TDCM, including PWM control of lights and (FanFan) motors. This project just took a giant step closer to happening.
I'll burn that bridge when I come to it.

Brad
ImageImageImage

Building the Bed & Breakfast
User avatar
capnTelescope
Lifetime member
 
Posts: 1218
Images: 368
Joined: Sun Jun 27, 2004 3:44 pm
Location: Round Rock, TX
Top

Re: TTT Microcontroller(s?) -- 12 volt success!

Postby friz » Tue Aug 23, 2016 8:44 pm

Awesome! Keep up the good work.

Sent from my SM-G900V using Tapatalk
The "Sin Bin"
150133
User avatar
friz
500 Club
 
Posts: 737
Images: 2
Joined: Mon Jan 03, 2011 10:01 pm
Top

Re: TTT Microcontroller(s?) -- 12 volt success!

Postby Camp4Life » Wed Aug 24, 2016 11:30 am

This is pretty cool! I've been playing with Arduinos for years, but mostly to generate sounds and tones, and for music sequencers. Not sure if I would put something like this in, unless it was just for fun (it always is). My plans are more static automation. Physical switch in door to turn on small LED inside, temperature sensor to control fan speed, light sensor for exterior lights, and a purchased display for voltage monitoring. But building this stuff really is fun!

I saw that you were reading up on putting the board to sleep. This is definitely something you'll want to do since an Arduino running code can consume anywhere between 25-45 mA. This hurts your power savings since you're running lights+arduino when the lights are on, and dimming them only brings your consumption down to what the Arduino is using.

This is when putting the board to sleep and setting a watchdog timer to wake it up will drastically lower its consumption.

Here's a simple method to doing it with code provided : http://jeelabs.org/2011/12/13/developing-a-low-power-sketch/
Here's a really complex method which also involved removing the Arduino's inefficient power regulator and substituting your own for even more efficiency : http://playground.arduino.cc/Learning/ArduinoSleepCode

With either of these methods, you can set your board to wake up and run your loop every 500ms, or however long you want. But remember that if you set it to only check every 1 second, you'll have a delay of up to a full second from the time you flick a switch until the system reacts. If this doesn't bother you, you'll be using so little power that it's laughable. Also, make sure you turn off any pins that you're not using.

The only thing I'm not 100% sure on would be any displays connected to your board. Unless they have their own independent controllers which remember the last state, they might go blank everytime the duino goes to sleep.

Looking forward to what kinds of things you come up with! :thumbsup:

:beer:
Camp4Life
Teardrop Master
 
Posts: 223
Images: 4
Joined: Mon Aug 08, 2016 3:49 pm
Location: Edmonton, Alberta, Canada
Top

Re: TTT Microcontroller(s?) -- 12 volt success!

Postby friz » Fri Sep 02, 2016 6:11 pm

Not to rush you guys, but I should be ready to beta test a TDCM at Xmas time. Just ordered a TD kit today.

Sent from my Altair 8800 using Tapatalk
The "Sin Bin"
150133
User avatar
friz
500 Club
 
Posts: 737
Images: 2
Joined: Mon Jan 03, 2011 10:01 pm
Top

Re: TTT Microcontroller(s?) -- 12 volt success!

Postby 8 » Mon Oct 17, 2016 9:55 pm

Why did I have to come across this post? Here are some Arduino uses I wrote up for myself on the subject four years ago.

    Thermostat for AC, maybe later heat, control mixing fresh air
    Monitor humidity, temperature(inside air, outside air, fridge, freezer, water), voltages (solar, battery, AC)
    Control window shades (I considered having servo controlled window shades)
    maybe control battery charging (solar/ac)
    and don't forget the fart sensor (http://www.sparkfun.com/commerce/produc ... ts_id=9404) to increase ventilation as needed
    control fan speeds
    control led lighting brightness and color
    spin the stereo around so it can be used both in the cabin and in the galley (servo or stepper motor controlled)
I wrote that list before the Raspberry Pi was released. I still would pick an Arduino over a Pi. The Pi is better suited to running things like a web server to control my 3D printer. Actually, I would consider an ESP8266 (https://www.adafruit.com/product/2471) for the WiFi capability and the ability to program it with the same Arduino IDE. You could skip the GPS and just log WiFi hotspots it comes across. It requires less power to pick up WiFi than GPS and it is quicker too, but the coverage is not as good. You could upload the data to data.sparkfun.com. If I were to stick with the Arduino, I would program the bare chips to save money and if I needed more I/O, I would connect a few together.

Bluetooth or WiFi could link to a smart phone with custom app for a nice remote control and display.

Of course, I never worked on this because I never finished the camper itself. The Harbor Freight trailer ended up getting made into a utility trailer and I bought a popup as my family grew. Yesterday, I bought a bigger popup to replace the smaller one I sold two weeks ago since it was getting crowded for five people in it.

On a side note, I recently got a ride in a 3D printed jeep (this one http://web.ornl.gov/sci/eere/amie/ ) and I was thinking the build process would be good for a teardop camper. Since it is plastic, there are no worries about rot and it is dent resistant. (If you respond to the jeep/3d printing comment, please start a new thread)
It's not fun and games until someone loses an eye.
Visit my blog ... http://www.64ox.com
User avatar
8
Teardrop Advisor
 
Posts: 75
Images: 3
Joined: Tue Jun 16, 2009 8:39 pm
Location: Central Florida
Top

Re: TTT Microcontroller(s?) -- 12 volt success!

Postby capnTelescope » Mon Oct 31, 2016 12:45 am

Hey, all:

My apologies for not posting anything here in over a year. I am happy to see some recent contributions. This project's priority status slipped to "Put It Off Til Later" (PIOTL) on my Teardrop to do list.

friz wrote:Awesome! Keep up the good work.

A belated thanks, Friz.

Camp4Life wrote:you can set your board to wake up and run your loop every 500ms, or however long you want.

I read somewhere that a tenth of a second (100ms) reaction time from sensor switch closure to "lights on" is fast enough that our poor addled brains will perceive the action as "immediate". We would still be sipping from a fire hose, I think. I'm going to go with that number and see how it works out.

8 wrote:Bluetooth or WiFi could link to a smart phone with custom app for a nice remote control and display.

That is a fantastic idea. :thumbsup: :applause: That is also entirely beyond my realm of expertise. :( I delegate this sub-project to 8. Anyone want to help 8 do a simple app? Android, please.

friz wrote:Not to rush you guys, but I should be ready to beta test a TDCM at Xmas time. Just ordered a TD kit today.

Friz's build journal can be found at http://www.tnttt.com/viewtopic.php?t=67288

8 wrote:... fart sensor...

:rofl: What'll they think of next?

8 wrote:control fan speeds

I've got a 3 speed FanFan that's plenty fast on Low. My thought is to set an output pin to a 50% duty cycle into an H-Bridge or some other appropriate circuit, and control the fan's Off/L/M/H like normal.

8 wrote:spin the stereo around ...

I'll put that on the list for my next build. :NC
I'll burn that bridge when I come to it.

Brad
ImageImageImage

Building the Bed & Breakfast
User avatar
capnTelescope
Lifetime member
 
Posts: 1218
Images: 368
Joined: Sun Jun 27, 2004 3:44 pm
Location: Round Rock, TX
Top

Re: TTT Microcontroller(s?) -- 12 volt success!

Postby friz » Fri Dec 09, 2016 12:43 pm

I may take up the cause. I have been looking into a proper switch panel for the tear and haven't found anything i like with dimming features to keep the power consumption to a minimum. I think I will start with an Arduino clone and some MOSFET's for a few bucks and start playing after I finish the structure. Hope to be close the end of this month. Keep in mind, my needs are simple, so I probably won't do anything too elaborate.

Friz
The "Sin Bin"
150133
User avatar
friz
500 Club
 
Posts: 737
Images: 2
Joined: Mon Jan 03, 2011 10:01 pm
Top

Re: TTT Microcontroller(s?) -- 12 volt success!

Postby capnTelescope » Thu Dec 29, 2016 4:46 pm

friz wrote:I may take up the cause.

Please feel free. :thumbsup:

friz wrote:... after I finish the structure. Hope to be close the end of this month.

It would be very interesting if you posted some pix on your old build thread when you're done. Lot of folks are interested in that CLC kit.

friz wrote:I think I will start with an Arduino clone and some MOSFET's for a few bucks and start playing after I finish the structure. ... Keep in mind, my needs are simple, so I probably won't do anything too elaborate.

Good plan. :thumbsup: Once I put a lite load on that circuit I found, it would dim down to about 50%, but no lower. Now I'm kinda stumped. :fb OK, strike "kinda."

Once you get "something simple" working, it's "easy" to add on from there.
I'll burn that bridge when I come to it.

Brad
ImageImageImage

Building the Bed & Breakfast
User avatar
capnTelescope
Lifetime member
 
Posts: 1218
Images: 368
Joined: Sun Jun 27, 2004 3:44 pm
Location: Round Rock, TX
Top

Re: TTT Microcontroller(s?)

Postby edgeau » Thu Dec 29, 2016 5:34 pm

I'll chime in as I just found this thread. I was already planning to use an Arduino to control winding down stabilizing legs and auto level the Teardrop. Just have to finish building the Teardrop first....

Sent from my ZTE T84 using Tapatalk
User avatar
edgeau
500 Club
 
Posts: 509
Images: 2
Joined: Sun Nov 13, 2016 8:21 am
Location: Gold Coast Australia
Top

PreviousNext

Return to Electrical Secrets

Who is online

Users browsing this forum: No registered users and 7 guests