TTT Microcontroller(s?)

Anything electric, AC or DC

TTT Microcontroller(s?)

Postby capnTelescope » Sat Aug 29, 2015 3:10 pm

Why? Because we can.

I have seen some interest, by others and myself, in using a microcontroller, such as an Arduino, in their trailer build for one thing or another. So far, I haven't found any implementations. :( I haven't gotten going, either.

The goal of this thread is to create a collaborative effort to find uses of such a system and to bring them into being.

My background includes about a dozen credit hours in Electrical Engineering, 40-odd years ago. Careers #1 and 2 involved the use of several manufacturing-related computer systems, and writing code to support their use. Career #3 found me as an ASE certified automotive Master Technician, where I learned the principles of modern computer-controlled automotive systems. I will not make any claim that I was particularly good at any of these. This all gives me enough hands-on background to believe that, with your help and encouragement, I can take on this project and make it work while sharing the results.

As things progress, I'll use this page for a Table of Contents, Glossary and Appendices.

Looking forward to your contributions!
:beer:



edits:
Features
First implementation
  • Assume lighting control using existing switches. Add the ability to conserve battery power by automatically dimming an individual light after a predetermined time. Add a second dimming level and turn light off after the second dimming times out. Lights that have timed out can be relighted simply by turning the switch off then back on.
  • Similar to lighting control, put the water pump on a short timeout to reduce the chances of a flood if plumbing fails. No power savings here.
  • Slow down the Fantastic Fan (there's a whole topic for that) using a motor controller controlled by the microcontroller. :roll: Using PWM to control the speed will save battery power proportional to the off portion of the pulse cycle.

    Second
  • Output to a display panel.
  • Monitor battery usage in real time, discharge and charge.

    Later
  • Remote control
  • Security system, at least intrusion alarm. Add GPS and WiFi to report location in case of trailer theft.
  • Tell time, temperature, humidty, sunup, sundown, moon phase, other?, ...
  • Ability to monitor clean water levels
Last edited by capnTelescope on Thu Dec 29, 2016 4:52 pm, edited 14 times in total.
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: Microcontroller for a TTT--Brainstorming System Requirem

Postby capnTelescope » Sat Aug 29, 2015 3:16 pm

BRAINSTORMING SYSTEM REQUIREMENTS

First things first. We need to establish the scope of the project. What problems do we want to solve? What bells and whistles do we want?

One technique that generates great ideas is called Brainstorming. The idea is to generate a lot if ideas in a short time. The sky is the limit. If something pops into your brain here, post it! Evaluations and criticisms come later.

Your ideas should be "I want the controller to ..." or "I want to be able to push a button and ..." or whatever else tickles your fancy.

Here's a few ideas to start the ball rolling:

* I want the controller to ...Monitor battery status in real time, discharge and charge.

* I want the controller to ...control lighting. Multiple switches controlling one light. Adjusting light levels based on time of day, ambient light, other? Dimming or turning forgotten lights off after a while.

* I want the controller to ...Conserve battery usage

* I want the controller to ...tell time, temperature, humidty, sunup, sundown, moon phase, other?, ...

* I want to be able to press a button on my smartphone and get a beer delivered to me at the campfire. In 1 minute or less. Without having another mouth to feed. Or getting slapped upside the head. :lol:

Let's get some ideas on the table so we can figure out what we need to do. Got it? Good. Let's hear your thoughts.
: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?) -- project description

Postby capnTelescope » Sun Aug 30, 2015 1:32 pm

Okay, 50-some views, no input. At least there's interest. *I* will forge ahead. Anyone that gets the urge to chime in is most welcome to.

Here's what I hope to accomplish, more or less by priority:

    * My Tear has 6 lights controlled by 9 switches that I want to monitor and control, If I stagger off to the campfire and leave the lights on, I want them to quit waiting for me to come back, and dim themselves. Very similar to how your car's interior lights don't turn off immediately after you close the door. The porch and cabin interior lights have 3 and 2 switches respectively. I don't care where I turned them on, I want to be able to turn them off at any of their switches. Wiring a 2 or 3-way switch circuit is not possible without a lot of rewiring. Ain't gonna happen. Also manipulate time until dim, based on battery state of charge

    * Also, I have a water pump that I don't want left on all the time. It's shown a certain talent for popping a connection and running merrily while flooding the galley. No bueno. :( I think I've fixed the root cause, but belt and suspenders.

    * Monitor battery state of discharge. Not just battery voltage, but monitor current amp-hour draw vs. time. I'll be able to get not just amp-hours of use, but amp-milliseconds. 100 amp-hour battery * 3,600,000 milliseconds per hour = 360,000,000 amp-milliseconds. .

    * Monitor battery charging progress. Kinda the opposite of discharge monitoring.

    * Remote control

    * Security system, at least intrusion alarm.

    * Control the Fantastic Fan speed. Maybe even by sensing indoor/outdoor temperature.

    * Beer on demand. :D

I have chosen to use the Arduino Mega 2560, to get plenty of memory and I/O ports.

As I go, I'll be breadboarding and testing. And reporting in. Stay tuned! :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
Top

Re: TTT Microcontroller(s?) -- project description

Postby MtnDon » Sun Aug 30, 2015 3:58 pm

I'm watching, but I'm also probably staying simple in our CTC.

Although....
* Monitor battery state of discharge. Not just battery voltage, but monitor current amp-hour draw vs. time. I'll be able to get not just amp-hours of use, but amp-milliseconds. 100 amp-hour battery * 3,600,000 milliseconds per hour = 360,000,000 amp-milliseconds. .

* Monitor battery charging progress. Kinda the opposite of discharge monitoring.


....Combine that into one readout. A state of charge readout in % of battery available. This is already done by meters like the Bogart Trimetric used by many with off grid PV solar systems. For those with a Midnite Solar charge controllers they can include a Whizbang Jr. and get the SOC on their CC.

~~~~~~
OTOH, I have come close to the end of my project list..... :thinking:
Our 6x12 deep vee nose cargo trailer camper conversion... viewtopic.php?f=42&t=58336

We have a small off grid cabin we built ourselves in the NM mountains; small PV solar system; 624 watts PV, Outback CC & inverter/charger ... http://countryplans.com/smf/index.php?topic=2335.0
User avatar
MtnDon
2000 Club
2000 Club
 
Posts: 2199
Images: 24
Joined: Sun Aug 19, 2012 10:57 pm
Location: New Mexico
Top

Re: TTT Microcontroller(s?) -- project description

Postby MtnDon » Sun Aug 30, 2015 4:05 pm

Hmmmm.... which main board are you selecting? I see some differences in price on ebay and other direct from China sites, available on amazon for much more and other sites for even more$. ???

(I am an old and rusty electronics tinkerer, basher. Many moons ago I built all sorts of things.)
Our 6x12 deep vee nose cargo trailer camper conversion... viewtopic.php?f=42&t=58336

We have a small off grid cabin we built ourselves in the NM mountains; small PV solar system; 624 watts PV, Outback CC & inverter/charger ... http://countryplans.com/smf/index.php?topic=2335.0
User avatar
MtnDon
2000 Club
2000 Club
 
Posts: 2199
Images: 24
Joined: Sun Aug 19, 2012 10:57 pm
Location: New Mexico
Top

Re: TTT Microcontroller(s?) -- project description

Postby bdosborn » Sun Aug 30, 2015 6:03 pm

Interesting thread. A battery monitor is on my bucket list but I was going to use a Raspberry Pi (since I already have one for Rasplex). I've done just a little poking around the interweb but here is a post I saved for a solar charge controller:

http://www.rustynailworkshop.com/archives/315

Bruce
2009 6.5'X11' TTT - Boxcar
All it takes is a speck of faith and a few kilowatts of sweat and grace.
Image
Boxcar Build
aVANger Build
User avatar
bdosborn
Donating Member
 
Posts: 5492
Images: 767
Joined: Wed May 05, 2004 11:10 pm
Location: CO, Littleton
Top

Re: TTT Microcontroller(s?) -- project description

Postby WoodSmith » Sun Aug 30, 2015 7:35 pm

This is on my list of things to incorporate in my future build, I've done a few projects with Arduinos and have a Raspberry Pi and Beagle Bone Black (BBB) waiting for me to find time to play with them as well. I'll be happy to brainstorm and even help as best I can, following the builds here has taught me a lot.

Brainstorming:
Consider using either R-Pi or BBB - More powerful than (base level anyway don't know about the Mega) Arduino and...
Consider looking around for an open source home monitoring package that runs on the R-Pi or BBB
Consider Including WiFi access to whatever controller you decide to use, this would allow you to have an interface that you can access without plugging in.

Security could include Door Position Switches (DPS) to monitor if any of the doors have been opened.
DPS can also be added to windows and Fantastic fan to know the state of those.
I agree on including temperature and humidity monitors, I think it would be valuable to know both of these data points for INSIDE and OUTSIDE.
Agree on monitoring battery state, charge, discharge.
Agree on displaying time, sunup and sundown might be useful, but since we have lights in the camper, I dunno.
Would definitely be nice to be bale to turn on and off lights (and ALL electric loads) via the controller, will require lots of relays and probably some rewiring.
Consider adding ability to monitor clean water levels and even flow rates. http://www.adafruit.com/search?q=fluid&b=1
Consider including a GPS receiver to monitor position.
Add an accelerometer to identify movement.


More detailed thoughts on some of the above more unusual suggestions (GPS and accelerometer) If you can put this thing in "I'm away" mode in a campsite, the accelerometer should be able to let you know if anyone came around and so much as kicked the tires. This obviously there would be some calibration required to know what was a windy day vs a hard pull on a door. GPS would allow you to alert if the trailer moves from it's location. This would be more useful at home when it is parked long term but in range of your home WiFi. It's happily monitoring battery levels and temps, then the bad guys hook up and start pulling it away. The GPS should register a change in location prior to losing signal on the WiFi, and can send you an alert. If you want to spend a little more, you could add a transmitter which would make this even more useful on the road. As long as the trailer has a cellular signal, it can transmit its current location. To save battery, you can only turn on the transmit function when the trailer is moved after a "SIT, STAY" command without an "OKAY" command. (Excuse me while I have a little fantasy about a stolen trailer transmitting its location and the cops actually find and NAIL a trailer thief.) http://www.adafruit.com/search?q=cellular&b=1 If this becomes a feature, including a local battery for the controller that charges from the main would be perfect, so if the baddies disconnect the battery, you are still running.

Once you can control all the lights, its dead simple to define various lighting states.
'Stargazing" - all lights off.
"Nightlight" - porch light and a dim interior (if desired).
"WhatThe...WasTHAT?" all outside lights on full, inside lights off.
If you want to go really crazy with the lights, you could put individually addressable RGB LED's in each fixture and be able to control the color and intensity of each light.http://www.adafruit.com/products/1559

Well, I think that I have dumped most of my thoughts, and my buddy is waiting for our Sunday walk, but I look forward to hearing what you come up with.

Glen
Glen Smith
Build Journal
WoodSmith
Donating Member
 
Posts: 213
Images: 40
Joined: Tue Mar 29, 2005 11:07 pm
Location: RTP NC
Top

Re: TTT Microcontroller(s?) -- project description

Postby ukewarrior » Sun Aug 30, 2015 7:38 pm

I have done a lot of hobby related electronics including PCB board design.
Professionally, I work as a master engineer for HP.

I have a hobby of 'extreme' Christmas lighting and there is a large group of folks in this hobby.
We have designed many boards for our specific use.
We control both AC and DC loads safely and effectively.

So... I believe I can be of some help in this effort in both hardware and software design.

I suggest that one or two specific use cases be the focus and that a project be done.
I encourage others to join in.

I do agree with the use of the Arduino platform. They are cheap and well used and documented.
It's an excellent starting point. I wouldn't say it needs to be a mega or an UNO until the final product is known.
It's amazing to me that I can buy UNO's on aliexpress, shipped to me for under $4.

The nice thing about this type of effort is that a group buy of the specific parts can be done whereby everyone can benefit from the economies of multiunit purchase power. That is how we run our Christmas site. (http://www.doityourselfchristmas.com)
It's a very effective model.
ukewarrior
Donating Member
 
Posts: 107
Joined: Tue Apr 21, 2015 3:19 pm
Top

Re: TTT Microcontroller(s?) -- project description

Postby bdosborn » Sun Aug 30, 2015 8:29 pm

How about an Arduino energy meter, it seems like there's plenty of people that have already built some:
Image
http://www.instructables.com/id/ARDUINO-ENERGY-METER/?ALLSTEPS#more-anchor
Image
http://openenergymonitor.org/emon/guide

Bruce
2009 6.5'X11' TTT - Boxcar
All it takes is a speck of faith and a few kilowatts of sweat and grace.
Image
Boxcar Build
aVANger Build
User avatar
bdosborn
Donating Member
 
Posts: 5492
Images: 767
Joined: Wed May 05, 2004 11:10 pm
Location: CO, Littleton
Top

Re: TTT Microcontroller(s?) -- project description

Postby capnTelescope » Sun Aug 30, 2015 9:40 pm

All right! That's what I'm talking about. Thanks all for speaking up.

MtnDon wrote:I'm watching, but I'm also probably staying simple in our CTC.

Simple is better. Like I said in the first post, "because we can." Actually, this shouldn't be too unsimple. I wired my trailer with this project in mind. Each load has its own hot & ground wire. Each switch has its own two wires, and all this wiring comes together on the left side of my galley where it is more or less accessible.

ukewarrior wrote:I do agree with the use of the Arduino platform. They are cheap and well used and documented.

That's basically why I chose Arduino. It's for a camper. It's supposed to just sit there. It's not like I'm trying to use it to run a gas engine and juggle 4 balls in the air.

MtnDon wrote:Hmmmm.... which main board are you selecting? I see some differences in price on ebay and other direct from China sites, available on amazon for much more and other sites for even more$. ???

It's an "Arduino Mega 2560" popularly priced from China. I can't tell for sure if it's genuine or not. It says right on the board that it's made in Italy, but that could just be diligent copying. I'll get a pic up here soon. I also got one of these for a readout. 4 * 40 character lines. I had the display working a while back, and it wasn't too hard to make it do stuff.

MtnDon wrote:Combine that into one readout. This is already done by meters like the Bogart Trimetric used by many with off grid PV solar systems.

The Trimetric is what gave me the idea of real time amp-hour calculation. The trailer has one of those Drok volt/ammeter units measuring off a shunt resistor. The shunt is sized for 75mV at 50 amps, which doesn't seem to give a good resolution at low current draws. I've got some resistor wire that can redo the shunt for better resolution at 10-20 amps, which is probably more than everything on at once would draw.

WoodSmith wrote:This is on my list of things to incorporate in my future build

:thumbsup: We'll get the hard parts out of the way for you. BTW, Woodsmith magazine is one of my regular reads.

WoodSmith wrote:Security could include Door Position Switches (DPS) to monitor if any of the doors have been opened.

Got that, too. Regular home security reed switches in the doors. I haven't wired them into my electrical system, as yet. Tried once and failed. I wasn't sure if it was my wiring error or the switch didn't work. :thinking: Probably the former. Also got a rescued siren from a car alarm somewhere around here.

WoodSmith wrote:Consider adding ability to monitor clean water levels

I'm using a clear filler tube with a small fishing bobber in it. Where I can't see it. :x

WoodSmith wrote:Consider including a GPS receiver to monitor position.

Your suggestions on security are all good. I had a thought or two about having a GPS in the trailer, but couldn't think of a really good use for it on something that's sitting still. But if some rat b**tard stole the trailer, that would make some sense. Since sunrise/set depends on location, that would be another use.

ukewarrior wrote:I have a hobby of 'extreme' Christmas lighting

There's 4 or 5 on my little street. My first Christmas in this house, they went ga-ga. Including the next door neighbor. I decided it was a good thing after all, because I decided to let all of them go big and bought a set of Malibu Lights for the front walkway that go year-round. You learned useful skills :thumbsup: and I didn't. :(

While I was writing all that,
bdosborn wrote:How about an Arduino energy meter, it seems like there's plenty of people that have already built some:
Image


I think I'm good to go, Bruce:
Image

Flip side, where it says "Made in Italy."
Image

ukewarrior wrote:I suggest that one or two specific use cases be the focus and that a project be done.
I encourage others to join in.

Agreed. Our first mission will be the lighting control I addressed in a previous post.

Anyway, thanks again to all for jumping in. This should be fun.
: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
Top

Re: TTT Microcontroller(s?) -- project description

Postby troubleScottie » Sun Aug 30, 2015 10:29 pm

I have some questions on the switch controls:

First how do you control these switch. Are they wifi or are you piggy packing the control feed via the existing wiring ( only applies to AC ??)

Otherwise you need to run at lease a wire if not a pair to every switch. There could be a lot of issues with reaching switches given the most likely wiring scenarios ie a single loop with one or more switches including the light in each loop. There would not be any place for a control feed to the switch.

If you have the luxury of wiring everything over: each light would be a home run (power/ground) and each switch would be a home run (control/ground) to the controller which would apply power depending on settings.

Second, how big is a controlled switch? There are some areas where a relatively larger switch would fit eg bulkhead. Some places eg side walls have trouble containing even a rocker switch.

Third, doing the quick and dirty internet search, these switches seem very pricey. Granted this might be isolated to only some circuits eg cabin, porch lights and water pump. Do you have a reasonable source for what the actual switch could be or would be?


Being a techie guy, I would like to see a real time summary of battery activity. I too was looking for something along those line. My experience with real-time sampling is basically non-existent. I know it can be done, but how eludes me. You want someone to write 100,000 lines of code to run an application or database or you need a database design, I am your guy. I too would be interested in this project.
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?) -- project description

Postby capnTelescope » Sun Aug 30, 2015 10:38 pm

Here's a quick tour of the lighting on my teardrop.

In the galley, I have a control panel where I can control all the lights except the cabin light:
Image
The three rockers on the wall control the white galley work light, the porch lights, and the red LEDs in the next pic. The black box has the volt & ammeter. The ammeter lies. Also switches for the water pump, running lights, and backup lights.

On the hatch, for a galley work light, there are two strips of double-row white LEDs that probably draw 2-3 amps, and there's a single strip of red leds for preservation of night vision.
Image
Each of these has its own rocker switch you see in the first pic.

Porch light with LED bulb on both sides of the trailer:
Image
These are controlled by switches next to both doors and a third switch in the galley. Both porch lights are on or off together.

All LED running lights on a switch for finding it in the dark.
Image

Two 18-watt LED modules for backup lights, campsite lighting and night baseball:
Image

Cabin lighting. Dome and cabinet lights are on the same switch. You can see the double rocker switch at the right edge of the pic.
Image
There's a double rocker by both doors that control the cabin lights and the porch lights.

So, as it is now, to turn off the porch lites or the cabin lights, you have to turn them off at the same switch you turned them on at. Not that that's such a huge inconvenience, but it requires user training. :roll:
Last edited by capnTelescope on Sun Aug 30, 2015 11:27 pm, edited 3 times in total.
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?) -- project description

Postby capnTelescope » Sun Aug 30, 2015 10:56 pm

Hi Scottie, welcome aboard.

I hope the post above will answer many of your questions.

troubleScottie wrote:each light would be a home run (power/ground) and each switch would be a home run (control/ground) to the controller which would apply power depending on settings.

Done! :thumbsup: No rewiring needed. :D

troubleScottie wrote:First how do you control these switch. Are they wifi or are you piggy packing the control feed via the existing wiring ( only applies to AC ??)

Presently, the lights are all controlled by the switches you see in the photos, wired up the Old School way.

In the new system, the switches will go to the Arduino as sensors. The Arduino will have to figure out what to do when a switch changes state, and turn on (or off) the appropriate light(s).

No wifi or RF yet but they will go on the list.
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?) -- project description

Postby GerryS » Mon Aug 31, 2015 5:24 am

Might be interesting to see if you could use Zigby and an Arduino shield. The Zigby switches I've seen are all 120, but that's just a power supply away....

I did a quick search, but don't see any low voltage switches :(. This approach would allow bidirectional communication and control. Add a cheap data only cell (I recently saw one for that had a small data plan for this type of application) and a GPS shield and you've got a tracker as well...

I thought about doing this same thing to ours, and decided that I wanted to get away from technology when camping, not use more of it.

Watch your parasitic load...an Arduino probably won't shorten your weekend by much, but for long periods of storage you could kill a battery...
User avatar
GerryS
1000 Club
1000 Club
 
Posts: 1178
Joined: Wed Apr 21, 2010 9:19 pm
Location: Central Indiana
Top

Re: TTT Microcontroller(s?) -- project description

Postby Dale M. » Mon Aug 31, 2015 8:02 am

Dont take this wrong, and I an a electronics tinker too, but with a teardrop and camping for me its taking a vacation from all this, and by NOT having all this stuff on board it makes upkeep and staying on top of whats going on loss of a chore... The tear drop should be kept simple.... Its a place to sleep, and prepare food, and shelter from a storm, nothing more, by adding all this stuff you are turning it into the home you are trying to escape from... Funny thing is as I get older I am finding I need a lot of technology less... A lot of it is based on "we have ability do this" not on "need"...

Just wait till your "HALL 2020" decides to not unlock your door one dark and stormy night after your nocturnal trip to the restroom...

No thanks, I can sleep at night and not worry about the winking blinking lights....

Dale
Lives his life vicariously through his own self.

Any statement made by me are strictly my own opinion.
You are free to ignore anything I say if you do not agree.

Image
User avatar
Dale M.
2000 Club
2000 Club
 
Posts: 2693
Images: 18
Joined: Thu Jun 09, 2005 8:50 pm
Location: Just a tiny bit west of Yosemite National Park
Top

Next

Return to Electrical Secrets

Who is online

Users browsing this forum: No registered users and 9 guests