Smart Solar Switch help.

Projects that are not for RC, but are cool and worthy of development.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Progress! Just a few program tweaks and I may be good to go at last.
ImageUploadedByTapatalk1363210576.598952.jpg
SM


Sent from my iPod touch using Tapatalk.

User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Smart Solar Switch help.

Post by jhsa »

Lookin' good ;)
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

Looks very professional . I like it.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Thanks guys. I hope to have it finalized by this weekend. Ran out of lab time until then.
SM


Sent from my iPod touch using Tapatalk.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Referring to the original posted program and info.

I could use a little more advice. I'm doing the final programming tweaks.
The divider values I used for both the sun detect and voltage monitor are 100k and 30k, the 30k to ground. I used 5% resistors.
The sun detect for now will be 12-14v or 0(zero). It comes from a master solar detect I can tap into.
The current divider values FYI detects sun in the input is 11.05 volts or greater and no sun if lower than 9.97v. I'm leaving this divider and program values as they are now for this setup.
The relay on or off detect voltages with the original program values and my divider values are as follows. I was able to use the serial monitor function and so I'm listing these also.
12 volts input battery buss,
If 11.82v ( serial return value 539) relay ON.
11.27v (serial return value 518) relay OFF.
My final values I would like to have as a starting point are,
Relay ON 12.3v or greater.
Relay OFF 11.9v or less.

In reading up on the analog input I learned that the input of 0-5v = 0 to 1023.
Where I'm currently stuck is the battery detect value verses the hysteresis value to be able go detect the 12.3 and 11.7v and switch my relay on or off.
Currently I'm using a 5 second delay value for testing but I'll make that 3600000ms(1 hour) again as defined in the program.
Thanks
SM



Sent from my iPod touch using Tapatalk.

User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Smart Solar Switch help.

Post by gohsthb »

I can figure this out better tomorrow when I am back at my computer.
-Gohst

Sent from my LG-P999 using Tapatalk 2
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

I got a guestimate coming in a few minutes. typing it up now
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

try these values:
#define BATTERY_THRESHOLD 595 // will depend on the voltage divider
#define BAT_HYSTERISIS 20

I didnt test them but here is how I derived them.

1. took the 2 values you gave me and determined the resolution. It is the same thing gohsthb came up with earlier. I just used .02
11.82/539 = 0.0219294991
11.27/518 =0.0217567568

2. compute value needed to get the requested threshold of 11.9v
11.9/.02 = 595

3. determine range of hysteresis 12.3 - 11.9 = .4 volts
4. compute value needed to get the requested threshold of hysteresis
.4/.02 = 20

hth
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Now that's service!
Thanks do much for hanging in there with me. This math and explanation is the part that I needed to get my thinking correct and it all gets documented.
SM


Sent from my iPod touch using Tapatalk.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Here are the program values in currently going with for the battery detection.
A value of 542 (serial return of 565)gives me a relay on at 12.34 volts and a relay off at 11.86v (serial return of 546). I'm using a hysteresis value of 27.
I did this using a fluke 77 meter to measure these values. My sun values are on at 11v and off at 9.98 and since that input as mentioned will see over 11v or 0 volts I left it alone for now.
The timer is set for 12.3v s+1 hour and the reset button does reset the timer.
I didn't do the math yet to see how it worked out compared to the actual bales I used but I'll do that next. It does work as planed on my variable bench PS so I'm ready to install it for a test run. With all the sun we've been having it may not do anything for a awhile, and that's a good thing.
I can monitor the solar battery levels 24/7 from anywhere using the Internet because of a ham radio link into a global IGate.
I can also send a off or on function from my home as a backup but I want this to be an automatic operation.
It'll be interesting to see if it all actually works as planed.
I'll post updates in case anyone wants to follow the outcome. It's been a fun project and I have learned from it thanks to all the help here.
SM




Sent from my iPod touch using Tapatalk.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

cool. glad it's coming along. Monitoring it from the internet is far out.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Now I'll have time to find the board we talked about Randy. Got a call to work Sunday so I finished just in time. More hobby money, but less time for hobbies.
SM


Sent from my iPod touch using Tapatalk.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

Dont worry bout that. it's just another thing to add to my 'I might need that one day' collection. I can tell you're thinking about it much more than I am :) I havent worked a Sunday since my company went through bankruptcy. There's pluses and minuses to everything.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

I finally installed the charge switch project. I added a master bypass and everything in on connectors so it can be removed for future work. It's set to take over and disconnect the RC battery charging stations if the supply source batteries go below 11.84v and keeps it off until 12.3 or greater + 1 hr. so far with the sun we're having now the lowest voltage has been 12v and as high as 12.8. My bench testing confirmed that the the detection circuits work but with the current sun and voltage levels it may not put my project into operation until a really overcast day. The purpose of all this is added insurance that the battery supply will never get below 11v. In the past 10v or lower was possible. The new smart lipo chargers all have voltage pumps in them that can sometimes still work below 11 volts and just keep dragging the source voltage lower and lower. This should stop that and I'll modify the on off values after I see what the ranges end up being. I can monitor the battery levels 24/7 thanks to a ham radio link to the Internet along with Wx data.
Thank you all again for getting me this far.
ImageUploadedByTapatalk1364053000.029326.jpg
I also found and just joined a local robotics club and also a Arduino club. Both are are about 25 miles away and meet once a month. My first meeting is Sunday and another Thursday. I understand they also have a splinter group that build, program, and fly Quads. Looks like I'll be a busy person if I keep up with the projects here and all the other clubs I've joined this week.
SM


Sent from my iPod touch using Tapatalk.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Smart Solar Switch help.

Post by jhsa »

Good on you showmaster.. I'm sure you'll be having a lot of fun..
By the way, your installation looks very clean... :)
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Thanks,
The black box if off center so I can plug the USB cable into the bottom of it.
The led on the left is red when the charge panel is off. The center yellow detects the sun is up so the panel can arm itself, and the right green indicates the charge panel is turned on. The red reset button resets the 1 hr hold off of it being armed after the battery voltage has recharged above 12.3 volts. The far right toggle is a run/bypass switch that removes my switch from the circuit and normals it to the original not so smart circuit. This is the panic switch in case I'm not around and it acts up or fails. I hate those phone calls to go to the field at the wrong times or too early! Every design that is used by others always needs a bypass.
Learned the hard way!
So far it's been 24 hours and no phone calls so I think it woke up this morning and turned the charge panels on for everyone, that or they lost my phone number?
SM
SM


Sent from my iPod touch using Tapatalk.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Update in case you're following my progress?
Well I've had my first setback after 24 hours of operation. It's all works except that when the master solar switch switches on the external charging panels at first light, the surge on the battery buss sends the UNO into what I think is the timer mode.
The UNO is powered before the master solar powered cutoff SS relays.
Besides arming the external charging panels the same buss has a few other electronics on it. I believe the large caps put a large spike on the buss as they first charge. This spike gets into the UNO and messes with its programming.
If I hit the reset button on the pin defined in the program everything starts working as usual.
I pre regulate the UNO power rail down from 12v to 8 volts and that's fed to the UNO that regulates it down to 5 volts. I would think this would condition the UNO power buss enough to isolate it from power spike issues?
The analog inputs are another thing.
I use the 12 volts from the main 12v power buss for measuring when the UNO executes its programming. I'n dividing the 12 volts down with a 100k and 30k divider.
I did read that the analog inputs are very high input impedance and I should stay under 10k total. This high impedance and high resistance divider may be what's going on.
I may try 10K and 3K to keep the ratio but lower the resistance on the analog pin. Maybe adding a .1 ufd cap as well.
Hopefully I can reproduce this on the bench and fix it. I was able to reproduce it when installed.
Today is the first robotics club meeting and they use Arduino's and Thursday is my first Arduino club meeting. They both say they have lab and teaching sessions and I should bring my project.
I'm looking forward to it and bringing my project to share.
When I finally get this all working I'll draw up the diagrams of it and the charging stations and master solar switch for any one that wants to install it at their field. If we had shore power at the field this would not be needed.

5 years ago we had 2 batteries and a few solar panels. Now with electric everything being flown we're up to 20 batteries and 60 Amps of solar panels with another 40A to be added. The first 60A is used up every hour just to power the lipo chargers being used, so we need another 40A to charge the main batteries. I don't think we'll ever get ahead so this smart UNO switch is needed to cutoff the lipo charging panels/stations when the main batteries need a good recharge and then go back on line.
Anyone have a good idea for a moon charge panel? No drain on the system after dark because of the master sun detect switch we have now.
It's there because we found out that homeless were plugging in at night and couldn't figure out why we we saw the batteries as low as 10.5 after dark.
I believe they now use it for cell phones during the day but its there for everyone and we don't ask.
SM


Sent from my iPod touch using Tapatalk.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

maybe add a delay to the sketch so that it doesnt monitor the analog input until after the system is up for 1 minute ? Maybe by then the voltages will have stabalized ?
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Great idea.
I did go to the robot club meeting today and discussed the same idea. There's was to take 10 samples and take the average, not just one. Also use 10K and 3K for divider values to keep the pin impedance low. It was felt that that any large spike was getting into the analog input and not the Arduino power buss even though it's the same source. I done need the sun detect A0 input and was also trying it through the same divider values to the 12 vt buss. It too may be taking the spike into the Arduino ?
I'm thinking of using it to trigger the delay and adding a large cap shunted by a bleed resistor, and add series resistor to slow down the transition to high from a low. I could rewrite the code (I hope with help) to use the A0 high to start the timer to ignore everything for 10 seconds, or use a digital input instead. Same idea just 0 or +5 volts.
I'll see what I can figure out over the next few days.
My next new Arduino club meeting is next Thursday so maybe I'll learn more. Great news is in 4 weeks 5 miles from me will be an actual Arduino teaching meeting for a slight charge. I'm signing up for that!

I also bought a USB 8 Ch logic analyzer at the meeting for $30. It's new from china and had all the clips and cables needed. I saw it demoed and hope to hook it up ASAP. I'll post more about it when I do.
Thanks again for your comments.
SM


Sent from my iPod touch using Tapatalk.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

ShowMaster wrote:. There's was to take 10 samples and take the average, not just one.
that's a good idea too. This problem is one that is hard for me to diagnose remotely. You've got a good handle on where the spike is coming so I'm sure you'll get it.
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Smart Solar Switch help.

Post by gohsthb »

Actually take an average of a power if 2 sample, so something like 8. Then the processor can do the divides by shifting bits! Which is more efficient.
-Gohst

Sent from my LG-P999 using Tapatalk 2
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

That bit shifting really confused me until I realized it was just an efficient form of multiplication or division.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

I could use an example. I'll look it up, thanks.
SM


Sent from my iPod touch using Tapatalk.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

http://arduino.cc/en/Tutorial/Smoothing

but this uses 10 samples which isnt a power of 2, hence they use division. I dont know how big a deal it is in your simple sketch but like gohsthb, bit shifting is more efficient.

In order to have a sample size of 8 and use bitshifting to find the average.
I didnt test this but with the code above you would change :
"const int numReadings = 10; "
to
"const int numReadings = 8; "

and

"average = total / numReadings;"
to
"average = total >> 3;"

http://arduino.cc/en/Reference/Bitshift
ReSt
Posts: 1581
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Smart Solar Switch help.

Post by ReSt »

What I use for similar situations is to measure for a certain amount of time and only if all samples are below/above the compare value I will take that as success.
Set a flag when you start measuring. Every miscompare resets the flag. If you end up with the flag set, your condition is fulfilled.

Reinhard
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Smart Solar Switch help.

Post by jhsa »

phheeww, I will have to learn chinese someday :o :P
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Smart Solar Switch help.

Post by ShowMaster »

Thanks everyone. I understand the concept now I just have to read up on how to write it. Im saving all the ideas so keep them conning.
This is a picture of the Saleae 8ch logic analyzer I bought. I saw it being used on the UNO at the meeting and came wot a USB and some push pin cables that plug into the UNO board or prototype board.
ImageUploadedByTapatalk1364222314.607902.jpg
All this is not exactly on target as far as tx modifying but all my projects are related to RC. I saw many robotic projects at this first meeting but there were several quads so I know I'm still around RC.
I did meet one person that writes for SERVO magazine and is a ham radio operator. Another stocks and sells parts and test equipment most robotic builders need. Best of all he's 10 miles from me.
I also met the club founder and main programming instructor. She's very active in gaming programming and robotics with many degrees. I'm looking forward to actual class time.
Annika
ImageUploadedByTapatalk1364222464.775334.jpg


Sent from my iPod touch using Tapatalk.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Smart Solar Switch help.

Post by rperkins »

Cool. if the firmware on your analyzer leaves you wanting to try something else.
http://hardware.slashdot.org/story/12/0 ... c-analyzer
http://sigrok.org/wiki/Main_Page

There are lots of clones of the saleae, so it must be good :) .

I've got a open bench logic sniffer. It has a limited recording depth, whereas the saleae is streaming. It can run the sigrok also but I havent put it on there. I've really only used it twice since I got it a year ago, but nice to have in the toolbox. Probably will break it out when I try to decode some IR protocols.
http://dangerousprototypes.com/docs/Ope ... ic_Sniffer
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Smart Solar Switch help.

Post by gohsthb »

I have a Saleae 8 channel also. Although it looks nothing like yours, you must have gotten an old one. I really like mine and use it all the time. The software has a few different protocol analyzers. The auto baud for RS232 has troubles figuring out the correct speed, so keep that in mind.
-Gohst
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Smart Solar Switch help.

Post by Kilrah »

I think he has one of the copies that have appeared, certainly looks a lot less good ;)

Post Reply

Return to “Other Electronic Projects”