www.robowars.org

RoboWars Australia Forum Index -> Technical Chat

Pic Relay Controller
Goto page Previous  1, 2, 3  Next

Post new topic   Reply to topic
  Author    Thread
Rotwang
Experienced Roboteer


Joined: 15 Jun 2004
Posts: 1589
Location: Vic


 Reply with quote  

PRC development is alive; Waggy is working on one for Robowars 3 as is Moth and Kev Chronos is working on 2 novelty bots, also for Robowars 3. Smile

Post Fri Jan 06, 2006 9:22 am 
 View user's profile Send private message
Knightrous
Site Admin


Joined: 15 Jun 2004
Posts: 8511
Location: NSW


 Reply with quote  

@Grotto: I've been working for a few months on my own picaxe relay on/off and PWM speed controller projects using the 08M PicAXE chip. I have one of my boards in a robot that is currently used for weapon switching. I haven't had any problems with power spikes or the like with my current setup, but it hasn't been in full combat yet. I did find that if you give the 08M too much work, it will get caught up in lag. I had a counting system in my failsafeing code and it caused a few issues I'm still trying to fix. It worked fine on the little test bed, counting and watching the input signals, but when we went to the real thing, it wouldn't failsafe till arond 3 seconds after you killed the TX. If you killed the RX it just stayed on...

I believe it's something to do with the way I've written my code as I've only had about 1 years of on/off self taught programming with the PicAXE chips. If you have MSN, I'd like to catch up with you on there and chat about PicAXE chips and coding. If your not an MSN user, we can just use the PM system on the forums Smile

If your interested in a bit of my code, swing into the build threads and look for my build thread titled "Pulse 50 Speed Controllers - TDT - QLD". Flick to the last page, and you'll see my latest edition of code.
_________________
https://www.halfdonethings.com/

Post Sat Jan 07, 2006 4:02 pm 
 View user's profile Send private message
Spockie-Tech
Site Admin


Joined: 31 May 2004
Posts: 3160
Location: Melbourne, Australia


 Reply with quote  

Here is the current version of the PRC code..

Note that this is presently set for use of opto-couplers on the Servo Inputs, which means it times an active *low* pulse (since Opto's invert the signal).

To use it without Opto's, change the second parameter on each of the pulsin caommands to a "1" (look for a 1 or high input). eg. pulsin 0,1,chan1 'get Radio Control Channel 1 pulsewidth.

Our present idea is to use small logic-level relays on the outputs which then switch the coils of the larger motor relays, and use a Receiver battery to completely isolate the PicAxe and Receiver from the Robots main power batteries which are subject to the big spikes when two relays, 2 or 4 motors start, and a 100+ amp load spike hits the power supply.

The next event should see how well this idea works.. Wink

Also, note the quadrant diagram comments (the messed up formatting bit - it works in a monospaced font), doesnt correspond to the code exactly, since Rick (Moth) changed the side-stick movements to only drive 1 motor at a time to make the side steering less twitchy..

code:

;--------------------------------
; PRC - Pic Relay Controller - v4.0x
; Copyright Nov 2004 Brett Paulin
; Oct04 - Hysteresis Bug Fix by Ajax
; Dec04 - Failsafe Trigger Points re-tuned
; May05 - Pulse-in inverted for Opto-isolaters
; May05 - Quadrant control adjusted to reduce main turn rate
; May05 - Channel_3 mask bug fixed by Moth
; written for PicAxe 18X micro
; www.robowars.org
;--------------------------------

setfreq m8

;-General Definitions
symbol   failsafe_trig = 3
symbol   failsafe_max = 12

;-RC Channel Definitions
symbol   fail_low  =60     ; (old 60)  failsafe below here
symbol   fail_high =240   ; (old 240) failsafe above here
symbol   low_on    =120   ; (old 120) low activate point
symbol   low_off   =135   ; (old 135) low deactivate point
symbol   high_off  =175   ; (old 175) high deactivate point
symbol   high_on   =180   ; (old 180) high acticate point

;--- Memory Register Usage Definitions
symbol   failsafe_float=b0   ; current block error rate
symbol   ch1mode=b1      ; channel 1 mode
symbol   ch2mode=b2      ; channel 2 mode
symbol     ch3mode=b3      ; channel 3 mode
symbol     outpins=b4      ; output pins data
symbol   start_flash=b5   ; startup led flash

symbol   chan1 = w3     ; b7  + b6    - channel 1 timing word value
symbol   chan2 = w4     ; b9  + b8    - channel 2 timing word value
symbol   chan3 = w5     ; b10 + b11   - channel 3 timing word value
;--- I/O Pin Definitions
symbol    ch1_fwd     = %00000001   ; binary bit patterns to mix in
symbol   ch1_mid     = %00000000 ; to output pins for relay/led
symbol   ch1_bck     = %00000010 ; activation / deactivation
symbol   ch2_fwd     = %00000100
symbol   ch2_mid     = %00000000
symbol   ch2_bck     = %00001000
symbol    ch3_fwd     = %00100000
symbol   ch3_mid     = %00000000
symbol   ch3_bck     = %01000000

;- Mixing Mask Definitions
symbol   ch1_mask    = %11111100   ; which bits should be masked off
symbol   ch2_mask    = %11110011 ; for logical OR mixing process
symbol     ch12_mask   = %11110000
symbol     ch3_mask    = %10011111   ; Fixed potential bug here ---------
symbol   failsafeout = %00010000

failsafe_float = 11

flash_led:               ; Flash the fail safe Led at startup
   for start_flash = 1 to 20
   let pins = failsafeout
   pause 400
   let pins = ch1_mid
   pause 400
   next start_flash

;--------------------------------

main_loop:

setfreq m4               ; Reduce cpu speed as command has probs

   pulsin 0,0,chan1  'get Radio Control Channel 1 pulsewidth
   pulsin 1,0,chan2   'get Radio Control Channel 2 pulsewidth
   pulsin 2,0,chan3   'get Radio Control Channel 3 pulsewidth

setfreq m8               ; Double cpu speed for rest of prog

   if chan1 < fail_low or chan1 > fail_high then goto failsafe
   if chan2 < fail_low or chan2 > fail_high then goto failsafe
   if chan3 < fail_low or chan3 > fail_high then goto failsafe

   failsafe_float = failsafe_float - 1 MIN 1   
   if failsafe_float > failsafe_trig then goto shutdown
   if failsafe_float < failsafe_trig then goto chan1_test
   goto shutdown

;**********
chan1_test:
   if chan1 < low_on then chan1_low
   if chan1 > low_off and chan1 < high_off then chan1_mid
   if chan1 > high_on then chan1_high
   if chan1 > high_off and ch1mode = 0 then chan1_mid
   if chan1 > low_off and ch1mode = 255 then chan1_mid
   goto chan2_test

chan1_low:
   ch1mode=0      ; channel 1 is low (full back)
   goto chan2_test
chan1_mid:
   ch1mode=127      ; channel 1 is centered
   goto chan2_test
chan1_high:
   ch1mode=255      ; channel 1 is high (full forward)
   goto chan2_test


;**********
chan2_test:
   if chan2 < low_on then chan2_low
   if chan2 > low_off and chan2 < high_off then chan2_mid
   if chan2 > high_on then chan2_high
   if chan2 > high_off and ch2mode = 0 then chan3_mid
   if chan2 > low_off and ch2mode = 255 then chan3_mid
   goto chan3_test

chan2_low:
   ch2mode=0      ; channel 2 is low (full back)
   goto chan3_test
chan2_mid:
   ch2mode=127      ; channel 2 is centered
   goto chan3_test
chan2_high:
   ch2mode=255      ; channel 2 is high (full forward)
   goto chan3_test


;**********
chan3_test:

   if chan3 < low_on then chan3_low
   if chan3 > low_off and chan3 < high_off then chan3_mid
   if chan3 > high_on then chan3_high
   if chan3 > high_off and ch3mode = ch3_bck then chan3_mid
   if chan3 > low_off and ch3mode = ch3_fwd then chan3_mid
   goto mixing

chan3_low:
   ch3mode=ch3_bck
   goto mixing
chan3_mid:
   ch3mode=ch3_mid
   goto mixing
chan3_high:
   ch3mode=ch3_fwd


;******
mixing:
   outpins = pins                  ; get current pins state
   outpins = outpins & ch12_mask            ; mask off current ch 1 + 2 output state

   if ch1mode=0   and ch2mode=127 then bkwd      ; check channel 1 and 2 modes
   if ch1mode=127 and ch2mode=127 then stp      ; and determine 9-point quadrant
   if ch1mode=255 and ch2mode=127 then fwd      ; position

   if ch1mode=0   and ch2mode=255 then bkwd_right
   if ch1mode=127 and ch2mode=255 then right
   if ch1mode=255 and ch2mode=255 then fwd_right

   if ch1mode=0   and ch2mode=0   then bkwd_left
   if ch1mode=127 and ch2mode=0   then left
   if ch1mode=255 and ch2mode=0   then fwd_left


;-------------------------------
fwd:                           ; mix in appropriate ouput state
   outpins = outpins | ch1_fwd
   outpins = outpins | ch2_fwd
   goto mix_done
   
fwd_right:
   outpins = outpins | ch1_fwd
   outpins = outpins | ch2_mid
   goto mix_done
                     ;       1F & 2F
fwd_left:                  ;           Fwd
   outpins = outpins | ch1_mid      ;1M & 2F           1F & 2M
   outpins = outpins | ch2_fwd      ;Fwd_left   |   Fwd_right
   goto mix_done            ;      \  |  /
                     ;       \ | /
stp:                     ;1B & 2F   \|/    1F & 2B
   outpins = outpins | ch1_mid      ;left ------|-----right
   outpins = outpins | ch2_mid      ;         /|\
   goto mix_done            ;       / | \
                      ;1B & 2M /  |  \  1M & 2B
                     ;bkwd_left  |   bkwd_right
right:                  ;
   outpins = outpins | ch1_fwd      ;         bkwd
   outpins = outpins | ch2_mid      ;    1B & 2B
   goto mix_done            ;
                     ;
left:                     ;"full rate" turns removed from
   outpins = outpins | ch1_mid      ; left and right quadrents to
   outpins = outpins | ch2_fwd      ; improve driveability
   goto mix_done
   
bkwd:
   outpins = outpins | ch1_bck
   outpins = outpins | ch2_bck
   goto mix_done

bkwd_right:
   outpins = outpins | ch1_fwd
   outpins = outpins | ch2_bck
   goto mix_done

bkwd_left:
   outpins = outpins | ch1_bck
   outpins = outpins | ch2_fwd

mix_done:
mix_aux:
   outpins = outpins & ch3_mask      ; mix in current weapon channel state
   outpins = outpins | ch3mode

   let pins = outpins
   goto main_loop            ; then loop around and do it all again

;--------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------
;What do if a failsafe occurs
failsafe:

   failsafe_float = failsafe_float + 1 MAX failsafe_max

   if failsafe_float > failsafe_trig then goto shutdown
   goto main_loop

shutdown:
   let pins = failsafeout
   goto main_loop



_________________
Great minds discuss ideas. Average minds discuss events. Small minds discuss people

Post Sat Jan 07, 2006 4:32 pm 
 View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Knightrous
Site Admin


Joined: 15 Jun 2004
Posts: 8511
Location: NSW


 Reply with quote  

@Brett: How much of an effect has upping the chip to 8Mhz? Also, with the Min/MAX commands, where did they come from, I can't find them in the list of known picaxe commands Confused
_________________
https://www.halfdonethings.com/

Post Sat Jan 07, 2006 5:46 pm 
 View user's profile Send private message
Knightrous
Site Admin


Joined: 15 Jun 2004
Posts: 8511
Location: NSW


 Reply with quote  

@Brett: Having just implimented the Min and Max functions into my code, it's seemed to have fixed the problem of the picaxe going into limbo counting pulses and it now failsafes Smile Going to test out how the testbed works when running at 8Mhz. I'm sure glad there are some professional programmers around here, otherwise I'd still be swearing Razz

I have a question for anyone who has been playing with picaxes. I'm currently looking at setting up a dead stop failsafe setup for my controllers. Having done some experimenting, I'm looking at switching the 08M on/off via the reciever. I was playing with my multi-meter checking the voltages that are given on the signal on the RX. I found that when you turn the transmitter off, the RX stops sending voltage/signals down the signal wire. So my idea is to use the low voltage on the signal lead to trigger a transistor, which turns the main power onto the 08M chip from the 5v regulator. So if the RX battery is unplugged or your TX is turned off, the whole board shuts down.

In my experimenting, I found my Hitec RX gives 1.80v at full forward, 2.45v at center stick, 3.08v at full backward and no voltage when the TX is turned off. Anyone see anything obviously wrong with my idea? I'm sure it will work, but peer review is really helpful sometimes.

Opps, Double Post Razz
_________________
https://www.halfdonethings.com/

Post Sat Jan 07, 2006 8:57 pm 
 View user's profile Send private message
Grotto



Joined: 30 Aug 2005
Posts: 38
Location: Morisset NSW


 Reply with quote  

Many many thanks for the code Mr Spock Very Happy
I'll get around to checking it out when I get a chance.

TDT,
You can find the MIN % MAX functions in the "Mathematics"
section of the doco somewhere, thay are mathematical
functions not actual commands and so are listed in the cammand
list. Basically the functions work as follows
X + 1 MAX Y = X=X+1 but will be set to X=Y if X>Y
X - 1 MIN Y = X=X-1 but will be set to X=Y if X<Y
I hope this is understandable to you, its the way I think... Cool

Also, the powering a picaxe (or anything) from the channels
as you suggest wont work (easily) as the voltage you are reading
is a PWM average. Its actually turning on & off really quick.
So your picaxe would be turned on&off at the same speed.
ie not terribly effective. Crying or Very sad

BUT, I am also a Hitec user too and I have one
channel on the RX that isnt used by the TX, Channel 7
on my Laser7 (6 channel) rig. It outputs a clean(checked with
an oscilloscope) and stable 4.8-5.0v voltage when the TX is on,
and 0v when its off. I use this for my Failsafe channel signal
to both to my pics and to the motors & weapon systems
(as a secondary level of redundance). I dont know how
much power(ma) it can supply, so I only use it as a
signal line (ie <1ma per device) .

Depending on your rig, you may have the same "spare"
channel.

Assuming you dont have access to an oscilloscope
you should be able to check with a multimeter that the
V+ wire is at EXACTLY the same voltage as the signal wire,
and IF your multimeter has a Frequency meter, the signal
wire should read 0.00hz.
[[if Spockie could verify my logic here, Ive had a CRO
for so long its hard to remember being without one Embarassed ]]

If this pans out for you, you can use your transistor idea,
BUT I would suggest feeding the signal (directly) to an un-used
input of the picaxe and having a software failsafe, because
just powering the pic down may leave/activate weapons
by accident. Twisted Evil


Let us know how you go...
Troll
_________________
"The future is not set. There is no fate but what WE make."
........CEO Cyberdyne Systems

Post Sun Jan 08, 2006 4:39 am 
 View user's profile Send private message Send e-mail
Knightrous
Site Admin


Joined: 15 Jun 2004
Posts: 8511
Location: NSW


 Reply with quote  

Ah, thats right, the RX gives out a PWM signal. Totally slipped my mind Razz I would probably bung a capacitor on there to smooth it out, but then the cap might keep the transistor on that little bit after I've killed the RX.

I've got software failsafe working to an acceptable standard, it works perfectly at about 70% of the time and the other 30% it lags behind for around 1/2 - 1 second before shutting off. I'll keep tweaking and playing with the code and see what I can get done.
_________________
https://www.halfdonethings.com/

Post Sun Jan 08, 2006 10:13 am 
 View user's profile Send private message
the moth
Experienced Roboteer


Joined: 21 Dec 2004
Posts: 130
Location: Melbourne


 Reply with quote  

O.K. so I should come to the forum more often ...
Nope the thread and the PRC are not dead - I've just been off doing other things .

I have built a Ver II of the PRC which will be "blooded" in combat tomorrow at "Judgment day 2006" . Changes for this version are :

Minor software alterations (nothing significant ) my current version is 4.3 - email me at rickp@allsuburbs.com if you need it

The PRC-2 and radio receiver is being powered from three alkaline non rechargeable cells for a voltage of about 4.6v - I have lots of these and that’s why I used them , 4x rechargeable would produce similar results . The outputs go directly into a 2003 driver chip as per ver 1 but the 2003 is also now being powered from the cells . Each of the outputs of the 2003 are connected to the mimic led's as per V1 but they are now also connected to a 5v relay . The 5v relay contacts then activate the main drive relays . This provides full electrical isolation of the radio receiver and PRC2 from the main drive circuit . I have tried many different combinations of power grouping but I have settled on this one for tomorrows fight .

PRC2 notes of interest .

YES the high frequency decoupling cap is very important - defiantly over the back of the micro if possible. A mid and low frequency cap on the power rail doesn’t hurt either ( I'm using all three)

Consider putting the board in a earthed metal box as RF noise can be a problem
My bot (Vincent) uses 5 noisy drill motors and in full battle all 5 will be running , the resultant RF noise kept resetting the micro until it was put into a RF protected enclosure

The micro will probably run fine at 8mhz all the way thru , but you will need to change some values . I put the drop back to 4mhz in the code , just in-case the 8mhz was adding to the radio problems .

I am presently playing with V5 of the software that has a "inverted" function using a fourth radio channel but register limitations are getting in the way . I will not use V5 in "Judgment day" as its unstable . (don’t ask for it )

I will update my success or failures after "Judgment day 2006"

Enjoy Moth
_________________
Some people pass cars - some people get passed by cars

Post Sat Jan 14, 2006 1:02 am 
 View user's profile Send private message Send e-mail Visit poster's website
the moth
Experienced Roboteer


Joined: 21 Dec 2004
Posts: 130
Location: Melbourne


 Reply with quote  

Well not a great event for my robot , but the important things I needed to test on the PRC2 were completed before the nasty gremlins appeared . The PRC2 competed as stated and during the Saturday performed with only a few minor glitches . The 3 aa cell battery pack provided ample power for a event with no sigh of power loss to the micro or receiver boards . Response time during combat was as good a direct drive with the added isolation of the receiver and micro boards . At one time the robot ran for over a hour in continuous combat / demo's displaying only minor problems and stopping only for main drive battery changes . While this was good for testing it had the disadvantage of subjecting my highly experimental PRC2 board to mammoth jarring and shocks . Unfortunately by Sunday the board refused to run stability and we retired disappointed .

Where to from here ? … Any software at or above 4.0 is stable but some have minor adjustments for problems specific to my robot . The next version including the invert function will not become available for some time as it and another feature will require a rewrite of the code . I will finalize the basic initial software and specs soon . Hopefully a prototype board will become available in the next 6 months (possibly sooner) as I have only just started discussions on board layout and production and the new board will hopefully cure the final few glitches. The PRC board will support some basic configurations and its cost will be decided by the options you build it with . A inbuilt 12v to 5v power supply will allow you to power it from the robots main power and it will then power the receiver alternatively you will be able to power it from the receiver battery pack and not build the power supply . Mimic LED's will be optional and the output can be taken from the uln2003 chip direct or built with the 5v relay option for isolation . The only LEDs that will need to be there are the power and failsafe led's . The minimum component count will be something like a Picaxe-18x micro the 2 LED's , 5v Ps and a uln2003 .Cost will depend on what you want

I wont post again unless something new happens …

Enjoy Moth
_________________
Some people pass cars - some people get passed by cars

Post Mon Jan 16, 2006 12:22 am 
 View user's profile Send private message Send e-mail Visit poster's website
Totaly_Recycled
Experienced Roboteer


Joined: 15 Jun 2004
Posts: 1346


 Reply with quote  

mine sucked im ditching it for my home made controler

Post Wed Jan 18, 2006 11:38 pm 
 View user's profile Send private message
the moth
Experienced Roboteer


Joined: 21 Dec 2004
Posts: 130
Location: Melbourne


 Reply with quote  

What actually sucked ? (now is the time to mention problems )
_________________
Some people pass cars - some people get passed by cars

Post Fri Jan 20, 2006 8:19 pm 
 View user's profile Send private message Send e-mail Visit poster's website
Knightrous
Site Admin


Joined: 15 Jun 2004
Posts: 8511
Location: NSW


 Reply with quote  


quote:
mine sucked im ditching it for my home made controler


Andrew found that there was a loose solder connection to the 12v regulator that supplied power to the relays. Andrew is now retracting previous statements about Aaron's design and code.... Razz
_________________
https://www.halfdonethings.com/

Post Fri Jan 27, 2006 7:47 pm 
 View user's profile Send private message
Totaly_Recycled
Experienced Roboteer


Joined: 15 Jun 2004
Posts: 1346


 Reply with quote  

didnt have any thing bad to say about the deshighn or code i only said the one i built sucked Very Happy the next ones will be better as you have a nice soldering iron now and I wont have to use that big branding iron lol . It was like useing a hedge trimmer to shave a beard lol its a wonder i dint get the whole lot soldered together

Post Fri Jan 27, 2006 8:32 pm 
 View user's profile Send private message
wilko



Joined: 25 Sep 2005
Posts: 133
Location: Ballina N.S.W


 Reply with quote  

i dont spose anyone has a working pic axe controller i could purchase Confused
_________________
WHEN YOU GO TO COURT YOU'RE TRUSTING YOUR FATE TO TWELVE PEOPLE
WHO AREN'T SMART ENOUGH TO GET OUT OF JURY DUTY

Post Fri Aug 25, 2006 10:51 pm 
 View user's profile Send private message Send e-mail Visit poster's website
NMO
Experienced Roboteer


Joined: 16 Jun 2004
Posts: 486
Location: Melbourne


 Reply with quote  

A few of us are currently working on various picaxe designs, however at this stage there deffinetly in the experimental stage.

Post Sun Aug 27, 2006 10:56 am 
 View user's profile Send private message
  Display posts from previous:      

Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 2 of 3

Goto page Previous  1, 2, 3  Next

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Last Thread | Next Thread  >
Powered by phpBB: © 2001 phpBB Group
millenniumFalcon Template By Vereor.