Author Topic: picaxe ?  (Read 18769 times)

0 Members and 1 Guest are viewing this topic.

Offline ghurd

  • Global Moderator
  • Sr. Member
  • ******
  • Posts: 442
  • Karma: +22/-0
    • GHurd Solar
Re: picaxe ?
« Reply #15 on: October 16, 2012, 08:07:38 pm »
Also, i have separate wires to power the fet-board and the picaxe, due to the voltage drop when the driver are active, which would make voltage measurement with the picaxe inaccurate if powered from the same cable as the driver.

I don't know about the ICs you guys are using, but sometimes it takes separate wires AND a larger cap than expected or quoted to keep things smooth in DIY.

Some ICs use regular type transistor technology, and switching can make for big draws.  555 can take over a half amp during switching.
Long ago, I heard some styles of fet drivers can act roughly the same way, which could cause unexpected issues (like smoking fet syndrome).

G-

Offline niall

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +16/-0
  • No Personal Text Set by User
Re: picaxe ?
« Reply #16 on: October 17, 2012, 07:29:59 pm »
" like smoking fet syndrome "...mmm..

the ceiling is full now  ..it just wont take any more impaled  fets.... or it will fall down

the cap ( battery ?) is 10,000 uf...  seems best to sample the positive and negative directly of it , but its the ground,s  that may have the devil in the detail....that seems to be the very fuzzy frustrating bit

i think i have the pwm switching down a bit lower now in the new 0m2  pic chip ...more like 500 hz .....the mill is running on the circuit now and doesn't seem to be to bothered either way ...(yet)

i think it could dump at a hz of 200  .....if a relay can have a fair go at 3 times a sec , 200 hz sounds fairly smooth.... ish...

i,m trying to tidy things up this evening ....and maybe etch a pcb ...probably better than vero board ...less wire links 




Offline Cornelius

  • Full Member
  • ***
  • Posts: 57
  • Karma: +7/-0
  • Grimstad, Norway
Re: picaxe ?
« Reply #17 on: October 18, 2012, 01:13:56 am »
Take a look at Frackers controller:

http://www.anotherpower.com/board/index.php/topic,237.0.html

I have to admit that i used his pcb layout as a template when i designed my fet-board... ::)

Offline niall

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +16/-0
  • No Personal Text Set by User
Re: picaxe ?
« Reply #18 on: October 18, 2012, 06:30:50 pm »
indeed , looking at the fet driver pcb is a stop and think moment...

i want to make pcb,s now ...totally convinced ....but getting distracted again i have 3 inkjet hp printers just sitting looking at me and saying that  "we dont work anymore ..sorry "  ..i,ve seen vids on utube of adapted inkjets making nice basic pcb boards ....i know laser is the way .......but

Offline ghurd

  • Global Moderator
  • Sr. Member
  • ******
  • Posts: 442
  • Karma: +22/-0
    • GHurd Solar
Re: picaxe ?
« Reply #19 on: October 18, 2012, 07:39:26 pm »
but its the ground,s  that may have the devil in the detail....that seems to be the very fuzzy frustrating bit

i think i have the pwm switching down a bit lower now in the new 0m2  pic chip ...more like 500 hz .....the mill is running on the circuit now and doesn't seem to be to bothered either way ...(yet)

i think it could dump at a hz of 200  .....if a relay can have a fair go at 3 times a sec , 200 hz sounds fairly smooth.... ish...


Devil's advocate:
Sure.  The ground is always the bad part, because the ground is ALWAYS the bad part, so make it huge and thick.
BUT what goes through the ground also goes through the Pos.
Might try laying some solid #22 (tinned before laying), soldered heavily it on the Pos traces.  In the US, I use solid heavy duty phone wire.  If the Pos traces are large, I use a 2~3 of them, twisted.

I expect the issue may be measured with a simple volt meter from a solid ground at the battery to the PCB.
OR
A solid connection at the input to the farthest Pos terminal on the PCB.
It would be like testing a faulty battery cable.  Any voltage reading is a bad sign. (you knew that.  it is for ref material)


200Hz is plenty smooth enough.  8)
Last I knew, Trace/Xantrex used 166Hz, MorningStar publishes 300Hz (all MS CCs I tested, which is a LOT of various units, read 359~360Hz).

That is for PWM controllers when the battery is at regulation voltage:
Even a cheap meter with HZ can read 360Hz... on the terminals of a 12V 110AH battery being charged by a 50W 12V PV.
If the reading is strange, try it at the controller terminals.
I know they say it can't be done because the battery is like a giant cap, but I do it all the time.
G-

Offline Cornelius

  • Full Member
  • ***
  • Posts: 57
  • Karma: +7/-0
  • Grimstad, Norway
Re: picaxe ?
« Reply #20 on: October 19, 2012, 12:55:35 am »
Ghurd;
I route the positive 'track' outside the board in the form of an AWG#9 wire in my dumpload circuit; there's no reason to have the positive wire (to the dumpload) on the pcb, since it has no active role in the switching circuit itself... Except maybe in a snubber circuit. :)

Offline niall

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +16/-0
  • No Personal Text Set by User
Re: picaxe ?
« Reply #21 on: October 23, 2012, 05:24:18 pm »
hopefully ....i,ll get some king of grip with the ground plane thing if i eventually etch a pcb ...thats going to take a while ...a long while

mean time the pic is running on a cross of Ross,s suggested code and using the pwmduty command option available in the m2 ...thats as close as i can get for now Cornelius.....its all very confusing still

the pic still has free available i/p,s and outputs ...so hooking up a 12v psu fan seemed interesting for extra cooling for the fets ...

i added a thermistor  from and old pc psu ....this is a lot of fun ...the thermistor is floating in air at the minute and is picking up the heat from the desk lamp , the pic senses this heat and trips the fan in a crude pwm  (blinking led option ) ...the fan has a small time delay added so it kindof over cools the thermistor....the fan keeps cycling trying to compensate ...move the desk lamp a little further away and the cycle slows down ....too much fun .. :)     

 

the big heatsink on the fan fet is a bit butch but it keeps it nice and cool ...a trickle of air from the fan works nicely with it ...ish...the fan looks like its running fast but its actually fairly slow ...

code for cooling ...ish ..very ish

symbol volt=w0


main:

readadc10 1,Volt
if volt> 382 then ok
if volt< 382 then cool
 
cool:
high 0
pause 80
low 0
pause 10
goto main

ok:
low 0

goto main

Offline Cornelius

  • Full Member
  • ***
  • Posts: 57
  • Karma: +7/-0
  • Grimstad, Norway
Re: picaxe ?
« Reply #22 on: October 25, 2012, 03:08:31 am »
I also have an 80mm fan cooling the heatsink, but i took the lazy route; the fan are connected to the fet output, so it varies according to the load. ;)
 
Here's my complete current code.:
 
Code: [Select]

Start:
setfreq m4
SYMBOL Volt = w0
SYMBOL Mode = b15
Symbol Temp = w1
Symbol TempLow = b16
Symbol TempComp = b17
Symbol PrevTemp = b18
Symbol Counter = b19
Symbol CompTempBoost = w2
Symbol CompTempMaint = w3
Symbol Duty = w4
Symbol BulkDone = b20
Symbol Elapsed = w5
Symbol ManualOverride = b21
 
Duty = 0    'Set initial Maintenance duty cycle to 0%.
Mode = 0    'Set initial Mode to off/Battery Ok.
BulkDone = 0
Elapsed = 0
ManualOverride = 0
ReadTemp 4, TempLow
PrevTemp = 120   'Set PrevTemp to very high to force a tempcomp
 
'pin1 = Volt
'pin2 = Output (MosFet)
'pin3 = Manual On/Dumpload off
'pin4 = Temperature

Main:
ReadADC10 1,Volt
If TempLow <> PrevTemp Then 'A weakness here; if Templow are 0C at startup,
 GoSub SetTempComp  'variables will not be set...
EndIf
 
If Time = 5 Then
 SerTXD("V:", #volt, " D:", #duty, " M:", #Mode, " TL:", #TempLow, 13, 10)
 Time = 6
EndIf

If Time = 10 Then
 ReadTemp 4, TempLow
 SerTXD("V:", #volt, " D:", #duty, " M:", #Mode, " TL:", #TempLow, 13, 10)
 If BulkDone = 0 AND Mode = 1 Then
  Let Elapsed = Elapsed + Time
 EndIf
 Let Time = 0
EndIf

If Pin3 = 1 AND ManualOverride = 0 Then
 BulkDone = 1
 ManualOverride = 1
 Pause 500 'Pause here to avoid on/off in one go.
 Goto Main
ElseIf Pin3 = 1 AND ManualOverride = 1 Then
 BulkDone = 0
 ManualOverride = 0
 GoSub DumpOff
EndIf

If Mode = 1 AND BulkDone = 0 Then
 If Elapsed >= 3600 Then '1 Hour
  BulkDone = 1
  Let Elapsed = 0
 EndIf
EndIf

If Volt <= 540 AND BulkDone = 1 Then
 BulkDone = 0
 ManualOverride = 0
EndIf
 
If BulkDone = 0 Then
 If Volt >= CompTempBoost AND Mode = 0 Then
  GoSub BoostDump
 EndIf
ElseIf BulkDone = 1 AND Mode <> 2 Then
 If Volt >= CompTempMaint AND Mode = 0 Then
  GoSub MaintDump
 ElseIf Mode = 1 Then
  GoSub MaintDump
 EndIf
EndIf
 
If Volt <= 563 AND Mode > 0 AND Duty <= 202 Then ' 13,20V
 GoSub DumpOff
EndIf

If Volt > CompTempMaint AND Mode = 2 AND Duty < 1015 Then
 Gosub PwmUp
EndIf

If Volt < CompTempMaint AND Mode = 2 AND Duty > 202 Then
 GoSub PwmDown
EndIf

If Volt > CompTempBoost AND Mode = 1 AND Duty < 1015 Then
 Gosub PwmUp
EndIf

If Volt < CompTempBoost AND Mode = 1 AND Duty > 202 Then
 GoSub PwmDown
EndIf
Goto Main
 
SetTempComp: 'Find TempComp Voltage
If TempLow >= 25 And TempLow <= 29 Then '0,0V comp @ 25-29c
 TempComp = 0 '14,4V, 13,2V
EndIf

If TempLow >= 20 And TempLow <= 24 Then '0,15V comp @ 19-24c
 TempComp = 6 '14,55V, 13,35V
EndIf

If TempLow >= 15 And TempLow <= 19 Then '0,30V comp @ 15-19c
 TempComp = 12 '14,7V, 13,5V
EndIf

If TempLow >= 10 And TempLow <= 14 Then '0,45V comp @ 10-14c
 TempComp = 19 '14,85V, 13,65V
EndIf

If TempLow >= 5 And TempLow <= 9 Then '0,60V comp @ 5-9c
 TempComp = 25 '15,0V, 13,8V
EndIf

If TempLow >= 0 And TempLow <= 4 Then '0,75V comp @ 0-4c
 TempComp = 31 '15,15V, 13,95V
EndIf

If TempLow >= 129 And TempLow <= 134 Then '0,90V comp @ -5--1c
 TempComp = 38 '15,3V, 14,1V
EndIf

If TempLow >= 135 And TempLow <= 140 Then '1,05V comp @ -10--5c
 TempComp = 44 '15,45V, 14,25V
EndIf

PrevTemp = TempLow
CompTempBoost = 616 + TempComp '14,4V baseline.
CompTempMaint = 581 + TempComp '13,6V baseline.
Return
 
PwmUp:
Duty = Duty + 1 Max 1015
PwmDuty 2, duty
Return
 
PwmDown:
Duty = Duty - 1 Min 202
PwmDuty 2, duty
Return
 
MaintDump:
If Mode <> 1 Then
 pwmout 2, 255, 202
 Duty = 202
EndIf
Mode = 2
Return
 
BoostDump:
pwmout 2, 255, 202
Mode = 1
Duty = 202
Let Elapsed = 0
Return
 
DumpOff:
pwmout 2, Off
Mode = 0
Duty = 0
Return

The code - as is, are not suitable for a windgen because it's not fast enough; i use it with solar.
The reason it's not fast now, are that i run it at 4MHz, and the ReadTemp command uses up to 750mS to execute (to communicate to the Dallas 18b20 temp sensor). In addition, the SerTxd command also uses some time, even when limited to every 5 sec. (ReadTemp are executed every 10sec.)
 
The function of the code are as follows:
If Voltage are below 12.7V the output are off, and a flag for bulk charge are set.
As long as the voltage are under 14.4V +/- temperature compensation, the code keeps the voltage at 14.4V for an hour before switching to maintenance mode at 13.6V.
 
If the voltage drops below 13.2V, it turns off the dumpload, and turns it on again at 13.6V.
 
It sends a log line every 5 sec., and reads the temp every 10 sec.
 
It checks pin 3 for manual override, forcing bulk charge on or forcing it into maintenance charge.
 
I'm sure the code can be optimalized, so everyone; feel free to comment... ;)
 
Edit:
The voltages are temperature compensated in 5 deg. celsius step. (0.15V/5deg. for 12V battery.)

Offline niall

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +16/-0
  • No Personal Text Set by User
Re: picaxe ?
« Reply #23 on: October 25, 2012, 04:44:09 pm »
i think i like the lazy route better  :)....less bits to go wrong

drools over  code .... :P

the wind picked up a bit the last two days , with peaks of about 600w from the mill.....getting a bit better for testing with then ...some interesting problems showed up at that level ...not the best of instrumentation gear available  (sound card scope , multimeter and a small led tapped on the pic output ( that bit seems very useful )... oddly ...listening to the fet frequency is useful as well

pic pwm running at about 250hz  ( i think ) ..pic clock speed 8m ...mill at 48v...dump 1k 

at low power things seemed fine , nice even  , but at higher power levels the pic pwm was going out of sync with the mill , kind of chasing the mill a little , the pic pwm led was picking up a bit of flicker...i thought this might have been a problem with pic sensing the voltage and tried a few things with the v divider but to no avail

next was to up the pic clock to 16m as you mentioned Cornelius...doubling the pwm by default , so now at 500 hz pwm ( i think )...much much better , now the pic pwm stayed in sync with the mill ,even in partial furling ...nice smoother led brightness transition ...

i had another 10,000uf cap , so i added that too.....it did effect  things as well  ...instead of a slightly " buzzy " noise from the fets now i had more of quieter "whine " ...sounds a lot better

setting pwm frequency in the pic is a bit of a pain ...i,d rather look at the scope and actually see something....

at a 10m time setting i have 5 wave forms...5 * 100 should mean 500hz  ... is this right ?   

(also managed to touch the fets live and got a little nip of 50v pwm ..... this was not a good idea at all  >:()     

 



     

Offline ghurd

  • Global Moderator
  • Sr. Member
  • ******
  • Posts: 442
  • Karma: +22/-0
    • GHurd Solar
Re: picaxe ?
« Reply #24 on: October 25, 2012, 09:21:39 pm »
Here's my complete current code.:
Start:
(lots of stuff, then more stuff, and after that more stuff)
Return
 
If the voltage drops below 13.2V, it turns off the dumpload, and turns it on again at 13.6V.

... everyone; feel free to comment... ;)

Newton's 5th Law:  Code = Ghurd Headache
(Newton's 4th law:  No wind for 3 days when you need wind)
I am impressed you guys are doing this.
To me, it is something akin to leaning to speak Icelandic.  I probably could, if I wanted to bad enough!

Why 13.2V?  Seems quite low, even with 750mS delay.


but at higher power levels the pic pwm was going out of sync with the mill , kind of chasing the mill a little , the pic pwm led was picking up a bit of flicker

(also managed to touch the fets live and got a little nip of 50v pwm ..... this was not a good idea at all  >:(

"but at higher power levels the pic pwm was going out of sync with the mill , kind of chasing the mill a little"?
I do not understand what that means.  Care to rephrase it for the rest of us (or just for me)?

"the pic pwm led was picking up a bit of flicker"?
"i,d rather look at the scope and actually see something"?
At 250HZ?  Might want to put a $3 HF HZ meter on that to see what it says.
Personally I can (formerly could?) sometimes see >120HZ LED flicker, IF my eyes, the conditions, and duty cycle, are just right.  I didn't think most people could see that high HZ.

20Voc solar bites me bad.
50V battery gives me nightmares.
G-

Offline rossw

  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 879
  • Karma: +35/-0
  • Grumpy-old-Unix-Admin
Re: picaxe ?
« Reply #25 on: October 26, 2012, 04:47:25 am »
At 250HZ?  Might want to put a $3 HF HZ meter on that to see what it says.

Probably because it's PWM, and as such the frequency should remain the same.

Quote
Personally I can (formerly could?) sometimes see >120HZ LED flicker, IF my eyes, the conditions, and duty cycle, are just right.  I didn't think most people could see that high HZ.
I certainly could see 100Hz easily. But only from the edges of my eye. There is a pretty standard trick to seeing much higher frequencies, and thats to put your fingers out and move your hand side to side between the source and your eye. Move faster or slower until you can "see" your fingers stationary rather than as a blur. Stroboscopes are SUCH cool things :)

Offline niall

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +16/-0
  • No Personal Text Set by User
Re: picaxe ?
« Reply #26 on: October 26, 2012, 08:25:09 am »
sorry heres another go ... ???...i dont really understand it myself either

when the mill hits 48v the pic trys to vary the duty cycle to clamp the voltage and hold the rpm
if the voltage goes to 48.5 , it increases the duty even more , so the led slowly increases in brightness ...100% duty cycle = full on led ( the mill furls out at about 80%)

i think the flicker was something like this...

when the pic was running at a low duty everything seemed fine ..the led would light up to a low level and reflect any changes ...but once it got to about 30% duty it started to give spikes in brightness , it seemed to be missing its que ...then waking up a fraction to late and overcompensating ( pulling the mill down more that it needed to ) ....over compensating is a better description than out of sync ...i think ...ish   

the pic has 100 linear duty steps to choose from ...somewhere it was missing a section of 10 or 20 and then getting a bit flustered and adding the missing 20 in the wrong place ....the threshold is 48v but sometimes it would drag down mill to 46v ...the code should,nt really allow that to happen ...

today is a good wind day (the first) ....so i,m keeping a close eye on the mill 

the clock speed can go to 32m but this again would double the pwm frequency ....   


Start: setfreq m16
       SYMBOL Volt = w0
       symbol niall= w1
       

init:   
       pwmout pwmdiv64,C.2,150,000       ;start pwm
Main:
    readadc10 4,Volt                     ;sample input volt

i think its the "150" bit that would need a tweak .....not sure about that either       

Offline Cornelius

  • Full Member
  • ***
  • Posts: 57
  • Karma: +7/-0
  • Grimstad, Norway
Re: picaxe ?
« Reply #27 on: October 26, 2012, 03:31:00 pm »
Quote
Why 13.2V?  Seems quite low, even with 750mS delay.

Ghurd;
I assume you're referring to where i turn off the dumpload?
Because my dumpload consists of some ceramic heat elements with a fan behind, and the fan stops turning below a duty of 20 in my code, so the result are that my dumpload draws a minimum of 6A.
My battery bank are 1060Ah of Rolls S-4000 batteries, so they can handle 6A without the dump. :)
 
And the 750mS are just the time the ds18b20 takes to respond to the 'ReadTemp' command.

Niall;
Use the 'pwmout...' wizard under the PicAxe, Wizards menu to get the right pwm numbers for the frequency you want...

That 'chasing' you're describing are normal, and the delay will be greater at slower cpu speeds. The delay will also be greater with more code the picaxe has to perform each cycle...
I think it would be hard to get a 100% steel control over the voltage with a 08m2, because the voltage from a mill could rise very fast in a gust. If your voltage doesn't vary more than a couple of volts around 48V, your dumpload should be pretty safe.
And since you have furling, the windmill should be protected as well... ;)
 
Edit:
Actually, the picaxe have 1024 steps on the duty command, but it's frequency dependent... I think 61Hz are the lowest frequency one can choose to get 1024 steps; next are 244 etc... (multiply with 4 each time.)

Offline ghurd

  • Global Moderator
  • Sr. Member
  • ******
  • Posts: 442
  • Karma: +22/-0
    • GHurd Solar
Re: picaxe ?
« Reply #28 on: October 26, 2012, 08:36:11 pm »

I assume you're referring to where i turn off the dumpload?

Because my dumpload consists of some ceramic heat elements with a fan behind, and the fan stops turning below a duty of 20 in my code, so the result are that my dumpload draws a minimum of 6A.
My battery bank are 1060Ah of Rolls S-4000 batteries, so they can handle 6A without the dump. :)
 
And the 750mS are just the time the ds18b20 takes to respond to the 'ReadTemp' command.


"I assume you're referring to where i turn off the dumpload?"
Correct.  Now I understand that part of the concept.

If temp comp is 750mS, and code hz is relaterd to pic effort,
couldn't that step be skipped 999 of 1000 times?
Not like a 50, 500, or 5000 lb bank (suitable to the system) is going to change temp much in 1 minute.
I don't know. Maybe it is better to go 750ms for some reason related to the chip or program stuff.
Just throwing it out there.
G-

Offline ghurd

  • Global Moderator
  • Sr. Member
  • ******
  • Posts: 442
  • Karma: +22/-0
    • GHurd Solar
Re: picaxe ?
« Reply #29 on: October 26, 2012, 09:00:20 pm »
Probably because it's PWM, and as such the frequency should remain the same.

I certainly could see 100Hz easily. But only from the edges of my eye.

For me, there was a Hi and Lo point where duty cycle simply made it look dimmer/brighter.  May have been C issues.
Anyway, it was duty cycle related.

I 'could' see 120Hz easy, maybe I still can but haven't done anything like that with 60Hz grid and simple circuits since my eyes got old.

For a few years, some FL and HID at some BigBox stores (mall, Lowe's, Home DePot, burrito joint that McDs used to own, that cheap low-quality china jeans store usually in the mall, etc) made me dizzy and ill.
Maybe they still do, but I don't spend so much time in those places lately.
G-