![]() | ![]() | ![]() |
| | #16 |
|
Well i would go RS232 over USB any day. You don't need the high data transfer rates of USB and RS232 will run hundreds of metres over cheap cable, and it's easier because you don't need a USB PIC. RS232 also leaves open an option of using any cheap old PC as a dedicated solar display terminal you can have in the house and leave it running. For data storage I think simple is best, like just using the PIC internal eeprom. You only need to record min/max and 24 hourly averages, so the 256 bytes of eeprom in a 16F886 should be plenty. You might even be able to record 15 minute averages. A potential killer for this project would be feature blow-out, ie trying to make it do way too much and/or too perfect at the start then it just gets too hard and stalls. I think pommie was on the right track, a minimal setup with a PIC 16F886 and a display and 4 buttons, then make it display volts/amps and turn the load on and off. And see where it goes after that. | |
| |
| | #17 |
|
Hi, I am new to this forum and decided to jump in when the subject of micro based controller design cropped up. I've built a few MPPT and array trackers for my off grid summer house using Atmel AVR and the current project involves combining the two. I agree "creeping featurism" is the number one fatal disease these type efforts succumb to so struggle to keep mine as simple as possible. Limited pin count of my Mega8/328 platform helps in this respect. At present I have rs232 interface in lieu of display/kbd but that may change if pins are left over once basic functions are implemented. Flash is used for logging because there's just so much more available (20-30k/1-2yrs) compared to EE. I look forward to seeing how this PIC based design evolves, specially regarding feature selection. Thanks for listening. | |
| |
| | #18 |
|
Hi John, Welcome to the forum mate, I'm sure with this project you'll be keen to share some of your expertise with your past knowledge of RE stuff. Anyway I've setup my big breadboard with a 16f886, lcd, 4 buttons and a 4:1 voltage divider. The input voltage will come thru AN0 The LCD is hooked up as upper portB bits for data in 4 bit mode, RA4 is the RS pin RA5 is the 'E' pin. I haven't worried about the RW pin. I did get my ICD2 clone to see the pic on the breadboard OK, so the software I'll be using is Oshonsoft Basic and hopefully I can get Eric to chime in as the man IS the guru with this basic software. As this project is for my son for his caravan he is going to learn along side with me. I will be setting up a 12 volt array using 4 of my 6 volt 105AH AGM's and the PV input will be 2 off 12 volt 45 watt panels. With all the rain we've had this week I'll be digging a trench from the van to the shed and when my shed array's are full and dump the load I'll setup that power to go in for extra charge. As the batteries are well over 6 years old and I have a few fail in my shed array, I will setup individual monitoring of each battery. Then if one fails it will give an alert and that will make it easier to find the suspect one. I will be doing several of these charge controllers to suit my RE needs and I'll log each one in this thread. When other members get started on theirs feel free to add them in this thread also. Hopefully we can make this charge controller project thread a good resource for anyone that is keen to learn and make their own. In the spirit of open source and member support I'm sure we can make this project a top resource for RE and a valued addition to this great forum. Regards Bryan
__________________ " The only way to avoid human error is to avoid the use of humans" | |
| |
| | #19 |
|
As promised, here is a menu system in BoostC. The example menu that is implemented is, Code: Main Menu
Display
volts amps in
In from panel
8.1V 2.3A
volts amps out
Out to Battery
12.2V 1.5A
Generated Today
Generated Today
123456W
Dumped Today
Dumped Today
4321W
Weekly Stats
Today 37kWh
Today-1 43kWh
Today-2 41kWh
Today-3 45kWh
Today-4 34kWh
Today-5 50kWh
Today-6 27kWh
Control
Charging on/off
Charging on/off
on
Allow Dump
Allow Dump
True
Options
Set Baud Rate
2400
4800
9600
19200
Set voltage
Voltage 12V
Voltage 24V
Voltage 36V
Voltage 48V
BoostC does not have ROM pointers or ROM structures greater than 256 long and so I implemented the menu data as a memory object using pragma data directives. All menu variables are held in EEPROM so they are persistent. The hardware details are, 16F886, 16*2 LCD, 4 push buttons and 4 diodes. LCD connections, data to b6-b2, RW to gnd, EN to b1 and RS to A7 - this is to keep the ICP pins (b6,7) and Int0 (b0) free. The diodes connect to the data pins (anode) and then to the push buttons. Other side of the push buttons goes to A6. At the moment, it is still compilable with the free version of BoostC and there is a whole 50 words of program space free. The full version of BoostC would allow the other 6K (of 8k) to be used. In it's current form it is not really usable but could be chopped down to implement a programmable battery charger. If anyone could put this circuit together in Proteus or some other simulator and get the code running that would be fantastic. A video (like AtomSoft's here) would be awesome. I may convert this to Swordfish Basic over the next few days as I think this would be easier for people to use. What do people think? Mike. Bryan, if you need me to make a hex file for your board let me know your layout. Last edited by Pommie; 27th September 2009 at 05:46 AM. | |
| |
| | #20 |
|
Started in with a 16F887 because that was on hand. 16F, 18F no diff to me. Have tested part of the program, mainly the voltage control mode of the charger. The hardware PWM (CCP1/RC2) is used to generate a programmable voltage reference. The PWM voltage reference is then fed into the C1IN+/RA3 pin of the C1 comparator. A pot working between Vdd (4.85V in my case) and Vss simulates a voltage output (Vout) from a supposed 4x divider from the charger output. The Vout is fed into the C1IN-/RA1 pin. The C1OUT/RA4 pin then outputs the setpoint to the, yet to be determined, switching transistor. I realize that this is only a small part of the scheme. Hopefully I'm on the right track. May need some boundary checks or clamps in there, as the voltage output misbehaves near the top and bottom rails. Also a bit of a glitch, or bounce? on the rising and falling edges. May keep the OSC1/RA7 and OSC2/RA6 pins handy if more PWM resolution is required through an external crystal. Code: 'GCBasic Program for solar powered swithmode battery charger 'Test Voltage control mode 'with programmable PWM voltage reference as C1IN+ 'and simulated voltage out 4 x divider output as C1IN- 'Tested 9/26/2009 'Chip model #chip 16F887, 8 #config _INTRC_OSC_NOCLKOUT 'setup lcd #define LCD_NO_RW ;tied to gnd #define LCD_IO 4 #define LCD_DB4 PORTB.3 #define LCD_DB5 PORTB.2 #define LCD_DB6 PORTB.1 #define LCD_DB7 PORTB.0 #define LCD_RS PORTB.5 'No #define LCD_RW PORTC.6 #define LCD_Enable PORTB.4 #define led1 PortE.0 #define led2 PortE.1 #define led3 PortE.2 'Set the pin directions dir led1 out dir led2 out dir led3 out 'dir portA.0 in 'setup comparator C1IN+/RA3 for programmable PWM reference voltage 'and C1IN1-/RA1 from charger output voltage divider 'C1OUT/RA4 sent to switch mosfet transistor gate Set C1ON On 'set comparator C1 enable bit Set C1OE On 'set output to C1OUT pin (RA4)/clear bit if internal only Set C1CH.1 Off:Set C1CH.0 OFF 'select C12IN1- (RA1) to C1Vin- dir PortA.4 out 'Enable C1OUT comparator output dim count as word Main: Count = 0 Do while Count <= 5000 HPWM 1, 8, 191 'measured 3.6V by DVM (i.e. 4 x 3.6V = 14.4V) count += 1 Loop Count = 0 Do while Count <= 5000 HPWM 1, 8, 175 'measured 3.3V by DVM (i.e. 4 x 3.3 = 13.2V) count += 1 Loop goto Main | |
| |
| | #21 |
|
Nice work Pommie! I think the options also needs to incude the load dump setpoints, that is the main operating feature after all. Will Swordfish basic allow the whole 8k?Nickelflippr- wouldn't it be easier to turn the load on/off in software? The ADC already knows the battery voltage so doing it in software means it's easy to adjust high/low battery setpoints (ie the hysteresis) and also allows the option of a programmable time delay which might be prudent between dump cycles etc. | |
| |
| | #22 |
|
The menu data is just a test to see if the menu system works. I don't think it will be very suited to this purpose but a cut down version may be useful. I think Swordfish will allow all the ROM to be used but we would have to switch to an 18 series chip. If I get time over the next couple of days I'll swap the 886 for a 18F2620 and get it working in Swordfish as I think this will provide greater flexibility. Mike. | |
| |
| | #23 |
|
Can you post a normal schematic for me? Im working on LCD init right now since in Proteus its kinda retarded heh
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 27th September 2009 at 01:49 PM. | |
| |
| | #24 |
|
What you have is correct and it looks like it is almost working. Maybe the delays are wrong. Try dropping the speed to 4MHz with osccon=0x61; Or, even 0x51. Thanks for this. Mike. Last edited by Pommie; 27th September 2009 at 04:01 PM. | |
| |
| | #25 |
|
Heh it was my fault actually i didnt set the OSC in Proteus lol ti was using 1mhz heh stupid Jason heh How do the button work? I have had much time to look through code but buttons confuse me here. They dont seem to work
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #26 |
|
From D4 to D7 are back, up, down, enter. So pressing the bottom button should move the > character down and pressing the rightmost button should enter that sub menu. Edit, the top line "Main Menu" doesn't do anything, it is just a heading. Edit2, as they are arranged your buttons are like a joystick, good choice. Mike. Last edited by Pommie; 27th September 2009 at 04:16 PM. | |
| |
| | #27 | |
| Quote:
Dump cycles in what way? The HPWM controls the frequency of the output, which no doubt will be important. In GCBasic the HPWM 1, 8, 191 means CCP1 or channel one, period approximately in khz, and 8 bit duty cycle value. If Dump cycles, as in Dump load for X period, then back to float voltage for X period, than that's yet another part of the program. Willing to try out whatever methodology offered up .
| ||
| |
| | #28 |
|
Pressing buttons dont do anything are you setting it as input afterwards? Ill have to look through the code
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #29 |
|
It works fine with the real hardware, does Proteus handle the internal pullups correctly? Mike. | |
| |
| | #30 |
|
not sure im going to see if its the diodes. when i press button the light doesnt change.
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
|
| Tags |
| based, charge, controller, pic |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Pic Based Servo Controller and Free Control Software! | hvlabsdotcom | Robotics Chat | 12 | 27th December 2008 07:10 PM |
| PIC based PID controller | Shohadawy | Micro Controllers | 1 | 24th September 2008 09:59 AM |
| Really Simple PIC Based IR (InfraRed) Controller | deanbayley | Electronic Projects Design/Ideas/Reviews | 1 | 12th November 2007 03:00 PM |
| PIC based Intelligent Garden Light Controller | dragonaga | Electronic Projects Design/Ideas/Reviews | 6 | 28th September 2005 10:28 AM |
| Project needed, Stepper motor controller PIC based | lompa | Electronic Projects Design/Ideas/Reviews | 1 | 11th October 2004 07:57 PM |