How do I make a 17 output relay sequencer with Picaxe

Gazza_AU

Member
Hi,

Never used Picaxe before.
How do I make a 17 output relay sequencer with Picaxe?

There are no set values for for relay size or on/off time duration's.
The output Low and High time is set, the cycle is continuous 1 to 17 repeated.
Is there a universal design for this type of general application?

Have too much going on to study and take on the detailed workings of Picaxe.
Looking for some help for the Picaxe/counter and programming.

Picaxe.jpg

Thanks
 

premelec

Senior Member
Welcome to this forum... more detail would be appreciated - if you are switching larger non solid state relays external driver transistors will be needed... what timing accuracy is needed? From your diagram you could even consider using a shift register... Do you want to use serial driver relay boards? Do you have experience in electronic circuits? There is no universal design but a lot of hardware that might do your job. Please give some range of values of what you want to do...
 

Jeff Haas

Senior Member
The picture does look like a project for a shift register. There is a lot of info on the forum to handle these.
 

Gazza_AU

Member
Welcome to this forum... more detail would be appreciated - if you are switching larger non solid state relays external driver transistors will be needed... what timing accuracy is needed? From your diagram you could even consider using a shift register... Do you want to use serial driver relay boards? Do you have experience in electronic circuits? There is no universal design but a lot of hardware that might do your job. Please give some range of values of what you want to do...
Hi Premelec,

I am self taught and get by for basic IC PCB assembly with suitable diagram.
Self taught programming basic in 1979, so I am ok with logic, and, or, if, but not good with transistor outside a simple switch.

Basically I am asking for the easy path, frowned upon by some. Not making a career out of it. :)
The attraction, is ability to change time periods and extending the logic down the track, if needed.

The relays would be chosen for several amps rating, and need transistor drivers.
There are thoughts on spare relay contacts for logic functions, hence the switching choice.

Timing would be in the vicinity of 5 Sec to 5 Minute periods.
Accuracy is not critical, but should not be like 1% out for example.

Not experienced with shift registers, thought they would be similar to a counter.
I have made an extended 555 timer with counter over a decade ago,
cannot remember a hell of a lot about it now.

Thanks for your input
 

Buzby

Senior Member
Looking at the diagram, I don't think a simple shift register is the answer.
A shift register will turn the 'next' bit on at the same time as turning the 'current' bit off, with no gap between.
The diagram shows that between each pulse there is a 'dead time' with no pulse active.

A counter going from 0 to 33, with output pins controlled by counts at 0,2,4,6 .... would give the required pattern, with a couple of pauses to determine pulse width and 'dead time'.

There a plenty other ways, but this is probably easiest to code.

Something like this, it should run on any PICAXE that has enough pins ....
Code:
[color=Navy]#picaxe [/color][color=Black]28X2[/color]


[color=Blue]symbol pulsetime  [/color][color=DarkCyan]= [/color][color=Navy]1500[/color]
[color=Blue]symbol gaptime    [/color][color=DarkCyan]= [/color][color=Navy]1300[/color]

[color=Blue]do
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]0 [/color][color=Blue]then pulsout a.0[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]2 [/color][color=Blue]then pulsout b.7[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]4 [/color][color=Blue]then pulsout b.6[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]6 [/color][color=Blue]then pulsout b.5[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]8 [/color][color=Blue]then pulsout b.4[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]10 [/color][color=Blue]then pulsout b.3[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]12 [/color][color=Blue]then pulsout b.2[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]14 [/color][color=Blue]then pulsout b.1[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]16 [/color][color=Blue]then pulsout b.0[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]18 [/color][color=Blue]then pulsout c.7[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]20 [/color][color=Blue]then pulsout c.6[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]22 [/color][color=Blue]then pulsout c.5[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]24 [/color][color=Blue]then pulsout c.4[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]26 [/color][color=Blue]then pulsout c.3[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]28 [/color][color=Blue]then pulsout c.2[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]30 [/color][color=Blue]then pulsout c.1[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]32 [/color][color=Blue]then pulsout c.0[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    

      inc [/color][color=Purple]b0
      [/color][color=Blue]if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]34 [/color][color=Blue]then
            [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]0
      [/color][color=Blue]endif
loop[/color]

Cheers,

Buzby
 
Last edited:

Gazza_AU

Member
Looking at the diagram, I don't think a simple shift register is the answer.
A shift register will turn the 'next' bit on at the same time as turning the 'current' bit off, with no gap between.
The diagram shows that between each pulse there is a 'dead time' with no pulse active.

A counter going from 0 to 33, with output pins controlled by counts at 0,2,4,6 .... would give the required pattern, with a couple of pauses to determine pulse width and 'dead time'.

There a plenty other ways, but this is probably easiest to code.

Cheers,

Buzby

Hi Buzby,

The only other future consideration, was the ability to prevent output/s from going high.
The relay in line to be switched, might offer a high/low logic to the counter.
This is not important, if the lack of information is a problem.

Just thought I should throw it in, as a possible future feature!

Thanks,
Gary
 
Last edited:

Gazza_AU

Member
A counter going from 0 to 33, with output pins controlled by counts at 0,2,4,6 .... would give the required pattern, with a couple of pauses to determine pulse width and 'dead time'.

There a plenty other ways, but this is probably easiest to code.

Something like this, it should run on any PICAXE that has enough pins ....
Code:
[color=Navy]#picaxe [/color][color=Black]28X2[/color]


[color=Blue]symbol pulsetime  [/color][color=DarkCyan]= [/color][color=Navy]1500[/color]
[color=Blue]symbol gaptime    [/color][color=DarkCyan]= [/color][color=Navy]1300[/color]

[color=Blue]do
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]0 [/color][color=Blue]then pulsout a.0[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]2 [/color][color=Blue]then pulsout b.7[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]4 [/color][color=Blue]then pulsout b.6[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]6 [/color][color=Blue]then pulsout b.5[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]=  [/color][color=Navy]8 [/color][color=Blue]then pulsout b.4[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]10 [/color][color=Blue]then pulsout b.3[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]12 [/color][color=Blue]then pulsout b.2[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]14 [/color][color=Blue]then pulsout b.1[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]16 [/color][color=Blue]then pulsout b.0[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]18 [/color][color=Blue]then pulsout c.7[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]20 [/color][color=Blue]then pulsout c.6[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]22 [/color][color=Blue]then pulsout c.5[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]24 [/color][color=Blue]then pulsout c.4[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]26 [/color][color=Blue]then pulsout c.3[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]28 [/color][color=Blue]then pulsout c.2[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]30 [/color][color=Blue]then pulsout c.1[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif
      if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]32 [/color][color=Blue]then pulsout c.0[/color][color=Black], [/color][color=Blue]pulsetime [/color][color=Black]: [/color][color=Blue]pause gaptime [/color][color=Black]: [/color][color=Blue]endif    

      inc [/color][color=Purple]b0
      [/color][color=Blue]if [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]34 [/color][color=Blue]then
            [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]0
      [/color][color=Blue]endif
loop[/color]

Cheers,

Buzby
The programming example, seems very similar to basic.
I should be able to get my head around it with a bit of reading.

Any suggestions for IC and basics on coding to read?

Thanks,
Gary
 

westaust55

Moderator
The programming example, seems very similar to basic.
I should be able to get my head around it with a bit of reading.

Any suggestions for IC and basics on coding to read?

Thanks,
Gary
As per the first line of Buzby's code he is using/proposing a 28X2 part.

As I see it there are 3 options:
1. A larger PICAXE chip such as the 28X2 with sufficient pins
2. Use a small 08M2 and a couple of 74HC595 shift registers cascaded for 16 outputs plus maybe 1 direct PICAXE output.
Need to control the OE pin on the shift registers to get the all low state without reloading the shift registers many times.
3. Use an 08M2 PICAXE and a MCP23017 i2c IO expander giving 16 outputs plus one direct PICAXE pin for the 17th output.

The decision needs to be made on the hardware before code can be written as the scheme for all 3 options are completely different.


EDIT:
The PICAXE outputs, the 74HC595 outputs, and the MCP23017 outputs can each drive 20 mA.
So depending upon the relay coil current and voltage transistors may not be required.

Those three IC do have max total IC current limits of the order of 95 mA (typical for many PICAXE chips) 70 mA and 125 mA respectively.
Since the diagram indicates only one output on at a time total chip current is virtually not a problem in this case.

If “drivers” are required, rather than 17 discrete transistors (each with a free wheeling diode),
an option is to use two off ULN2803 ( low side) or UDN2984 (high side) switching packages each capable of driving 8 relays plus they include the necessary diode across the relay coil then a single transistor plus diode for the 17th relay.
 
Last edited:

lbenson

Senior Member
Note that you can run Buzby's code (which looks like Basic because it is--PICAXE Basic) in the simulator--PE5 or PE6. There you can fiddle with the timing and see if you can accomplish what you want before you even have a real picaxe chip.
 

erco

Senior Member
If you want to get tricky, these high-sensitivity one-coil latching relays only require a brief pulse (20mA@5V). One coil polarity latches relay, reverse coil polarity to unlatch: http://pdf1.alldatasheet.com/datasheet-pdf/view/197272/OMRON/G6HU-2.html

Even without any extra hardware, just by multiplexing coil/pin combinations, 6 pins could control 15 relays. 7 output pins could control 21 relays, so even just a 14M2 handle do your job. Pity that these relays are hard to find now. They used to sell for 99 cents (!) at the Electronic Goldmine a few years back. I hoarded a bunch of them somewhere.

Edit: WOW, obsolete and $19 each: https://www.amazon.com/OMRON-ELECTRONIC-COMPONENTS-G6HU-2-DC5-SIGNAL/dp/B011NKJQ1Y

Time to find mine and sell them on Amazon...
 
Last edited:

westaust55

Moderator
indeed PICAXEs are programmed in BASIC - a reduced BASIC. Buzby's code gives you a good start and erco's suggestions a whole lot to think about... ;-0 In any case have fun!
Why is PICAXE BASIC deemed to be "reduced Basic" ?
Compared to the original Dartmouth BASIC of 1964, PICAXE BASIC is pretty darned extensive.


Sure, there are versions of BASIC with floating point math and other enhanced programming structures.
But the PICAXE commands allow accept to almost all of the core PIC hardware and where not using peek/peeksrf and poke/pokesrf it is possible to gain access to some of those other capabilities as others here have demonstrated.
 

premelec

Senior Member
You are correct - as usual - my bad - having used PBASIC - QBASIC etc - though never visual BASIC - I forgot my roots... How about Classic BASIC? or unencumbered BASIC? ;-0
 

Buzby

Senior Member
... The only other future consideration, was the ability to prevent output/s from going high.
Do you mean it needs to inhibit all 17 at once, or should each relay be individually inhibited ?
If individual control is needed then you will need some way to select the outputs to be affected.
You might use a keyboard for this, or 17 switches. ( You could maybe multiplex the switches with the relays, that way you won't need more pins. )

What is the purpose of this unit ?. If we know that we might have more pertinent suggestions for a solution.

Cheers,

Buzby
 

Gazza_AU

Member
If “drivers” are required, rather than 17 discrete transistors (each with a free wheeling diode),
an option is to use two off ULN2803 ( low side) or UDN2984 (high side) switching packages each capable of driving 8 relays plus they include the necessary diode across the relay coil then a single transistor plus diode for the 17th relay.
I found these Optocoupler Relay Boards available in 16 and Singles to make 17 Channels, unfortunately they only have Single Pole.
http://www.ebay.com/itm/5V-1-2-4-6-8-Channel-Relay-Board-Module-Optocoupler-LED-for-Arduino-PiC-ARM-AVR-/142221802900?var=&hash=item211d147d94:m:mgidqMrJiTHNbrjTs8R7sKw
I will need to shop around for DPST Relays.

The ULN2803 or UDN2984 package will keep things tidy if I cannot find a suitable relay board.
Either way, the output circuit will be very simple from here.

As per the first line of Buzby's code he is using/proposing a 28X2 part.

As I see it there are 3 options:
1. A larger PICAXE chip such as the 28X2 with sufficient pins
2. Use a small 08M2 and a couple of 74HC595 shift registers cascaded for 16 outputs plus maybe 1 direct PICAXE output.
Need to control the OE pin on the shift registers to get the all low state without reloading the shift registers many times.
3. Use an 08M2 PICAXE and a MCP23017 i2c IO expander giving 16 outputs plus one direct PICAXE pin for the 17th output.

The decision needs to be made on the hardware before code can be written as the scheme for all 3 options are completely different.
The PICAXE choice is a little more difficult.

PICAXE-28X2 - (3V Version???) AUD incl freight $12 http://www.ebay.com/itm/Brand-New-Genuine-PICAXE-28X2-3V-Verson-Pack-of-1-UK-Seller-SALE-/182444486763?hash=item2a7a89f06b:g:IcEAAOSw3xJVVuxB

PICAXE Chip SMD PICAXE-08M2 AUD incl freight $12 http://www.ebay.com.au/itm/PICAXE-Chip-SMD-PICAXE-08M2-Microcontroller-Microprocessor-/291550783128?hash=item43e1c7e698:g:t94AAOSwu4BV4Iqq

What are the board options for PICAXE-28X2 vrs PICAXE-08M2.
I might not be using the best search terms to find suitable PCB.
Is it best to buy a ready made board, or make it yourself?

Found this for 08M2 version - AUD incl freight $28 (With 08M2 Chip)
STIK-AXE KIT#2 - PICAXE08M2 PICAXE Project+Programmer+Spider Cable - NEW
http://www.ebay.com.au/itm/STIK-AXE-KIT-2-PICAXE08M2-PICAXE-Project-Programmer-Spider-Cable-NEW-/172572251337?hash=item282e1b94c9:g:ui0AAOSw2GlXEbp9

Found this for PICAXE-28X2 - AUD incl freight $12
RKP28c Compact Project PCB designed for PICAXE-28X2 & Genie-E-28 Self Build Kit.
http://www.ebay.com.au/itm/RKP28c-Compact-Project-PCB-designed-for-PICAXE-28X2-Genie-E-28-Self-Build-Kit-/182307855665?hash=item2a72651d31:g:4WQAAOSwjVVVlDj9

Not sure exactly what I am looking at, or what I need?

Cheers
 
Last edited:

westaust55

Moderator
The PICAXE choice is a little more difficult.

PICAXE-28X2 - (3V Version???) AUD incl freight $12 http://www.ebay.com/itm/Brand-New-Genuine-PICAXE-28X2-3V-Verson-Pack-of-1-UK-Seller-SALE-/182444486763?hash=item2a7a89f06b:g:IcEAAOSw3xJVVuxB

PICAXE Chip SMD PICAXE-08M2 AUD incl freight $12 http://www.ebay.com.au/itm/PICAXE-Chip-SMD-PICAXE-08M2-Microcontroller-Microprocessor-/291550783128?hash=item43e1c7e698:g:t94AAOSwu4BV4Iqq

What are the board options for PICAXE-28X2 vrs PICAXE-08M2.
I might not be using the best search terms to find suitable PCB.
Is it best to buy a ready made board, or make it yourself?

Found this for 08M2 version - AUD incl freight $28 (With 08M2 Chip)
STIK-AXE KIT#2 - PICAXE08M2 PICAXE Project+Programmer+Spider Cable - NEW
http://www.ebay.com.au/itm/STIK-AXE-KIT-2-PICAXE08M2-PICAXE-Project-Programmer-Spider-Cable-NEW-/172572251337?hash=item282e1b94c9:g:ui0AAOSw2GlXEbp9

Found this for PICAXE-28X2 - AUD incl freight $12
RKP28c Compact Project PCB designed for PICAXE-28X2 & Genie-E-28 Self Build Kit.
http://www.ebay.com.au/itm/RKP28c-Compact-Project-PCB-designed-for-PICAXE-28X2-Genie-E-28-Self-Build-Kit-/182307855665?hash=item2a72651d31:g:4WQAAOSwjVVVlDj9

Not sure exactly what I am looking at, or what I need?

Cheers
That 3V 28X2 parts is an older and somewhat obsolete part from a time when there were separate 3V and 5V parts.
http://www.picaxe.com/What-is-PICAXE/Superseded-Parts/
Now you buy a single 28X2 (and 40X2) that covers the entire range.

In Australia you can buy the newer 28X2 from:
Altronics: http://www.altronics.com.au/p/z6127-picaxe-28x2/
Willtronics:https://www.wiltronics.com.au/product/6906/picaxe-28x2-chip-marked-pic18f25k22/

Prices might seem higher but consider that the obsolete Ebay part with postage is GBP4 + GBP5.5 = 9.50 (AUD$15.50) and may take longer to reach you.
If you are happy to buy the older part then buy directly from the PICAXE store for just GBP1 +postage
http://www.picaxestore.com/index.php/en_gb/axe010x2-3v.html



If you are new to PICAXE then I sugegst to consider buying the genuine AXE-27 cable.
http://www.picaxestore.com/index.php/en_gb/axe027.html
Yes some folks do buy USB to serial quite cheaply that DO work but quite a few also end up here with problems to be resolved.
If you buy the cable and some chips direct from the PICAXE store in the UK then with the combined postage it will likely cost no more.


Since you are looking to possibly have other parts beside the PICAXE one option is to build your circuit on some strip board (veroboard) with everything on the same board.
You just need to include the 3.5 mm stereo socket and a few resistors for programming and plus a voltage regulator (unless 4.5V battery powered)
 
Last edited:

stan74

Senior Member
Maybe wire the relays so the 1st turns on the next which turns off the previous and it would ripple through the series.
 

westaust55

Moderator
Maybe wire the relays so the 1st turns on the next which turns off the previous and it would ripple through the series.
Hard wired?
That would need relays with at least 4 contacts:
1 to "seal" and hold itself closed
1.to energize the next relay coil
1 to cause the previous relay to drop out (break the sealing circuit), and
1 to operate the "load"

That scheme would have no timing capability for the on and off durations unless one spent a lot of money on timing relays with independent timing to each contact.

Far simpler to use a PICAXE as the central sequencer/controller.
 

premelec

Senior Member
@Gazza_AU - you can use 2x the SPST relays and switch two at once... 2x more relay drive power but gets you going fast... ;-0 Since the relay boards are SPDT you can work out a binary tree and use the off side of the contacts to select as long as you have 34 on or off contacts at the out side...
 
Last edited:

erco

Senior Member
Hard wired?

That scheme would have no timing capability for the on and off durations unless one spent a lot of money on timing relays with independent timing to each contact.

Far simpler to use a PICAXE as the central sequencer/controller.
I got money on Stan and his old engineer friend getting it all worked out. Probably over a pint or two. :)
 

Gazza_AU

Member
@Gazza_AU - you can use 2x the SPST relays and switch two at once... 2x more relay drive power but gets you going fast... ;-0 Since the relay boards are SPDT you can work out a binary tree and use the off side of the contacts to select as long as you have 34 on or off contacts at the out side...
I was keeping this as an option, those relay boards are just to cheap to knock back.
Jump wires across two inputs should not create any problems?
 

premelec

Senior Member
I was keeping this as an option, those relay boards are just to cheap to knock back.
Jump wires across two inputs should not create any problems?
The inputs of the 8 relay boards are opto-isolators - could be paralleled with same voltage... The 16 relay boards i think are serial input of some sort - I've never used those... could drive a serial board with a 08M2!
 

stan74

Senior Member
17 cam switches, a disk with a bump. The relay idea was
1st relay energised through n/c on relay 2 who's coil is energised through n/o on relay 1.
relay 3's coil is energised through n/o on relay 2...and so on.
...from looking at the original post jpg
There's more than 1 way to skin a rabbit...is there actually more than 1 way to skin a rabbit?
 
Last edited:

Gazza_AU

Member
Thanks to everybody for the help.

I was very surprised to recognizing Picaxe code as similar to Basic.
Because I purchased a ZX80 37 years ago by mail, from UK when I was about 14years old.
I was the only person in school that new anything about computers, nerd or trendsetter?

My memory of 37 years ago is shot, but I remember Basic as being very self explanatory.
Over the days since posting my question, I found there was very little programing information in the downloaded PDF's.

I find the omission of line numbers interesting.
then, goto,
Symbol skip:
; is very interesting!

Questions1:
Can I use symbol to skip around code like this,

if b0 = 0 then skip0
if b1 = 0 then pause gaptime : pulsout a.0, pulsetime : pause gaptime : endif
skip0:

if b0 = 1 then skip1
if b1 = 1 then pause gaptime : pulsout a.1, pulsetime : pause gaptime : endif
skip1:


; Also is the task ok starting with> pause gaptime :(Instead of> pulsout a.1, pulsetime :


Questions2:

Let b0 = b1
Is this code a valid preload?
Will b0 be loaded with the value of b1 only at the time of loading?
Or will this cause the two outputs to operate as one in lock step?

---------------

That covers my questions.
Unless anyone has suggestions for Programming Books or Code Simulation Software.

Gary.
AU
 

premelec

Senior Member
Use the syntax check in the editor to see how well the PICAXE understands your code...
If b0=b1 only at the start that doesn't carry throughout. There's no likely utility to having one
variable always equal another - you'd just lose use of one variable ;-0 Note the use of symbols...
Keep after it - the language is simple but the proper [as the editor judges] use is essential...

Code:
symbol pulsetime = b5 
symbol gaptime = b4
Main:
if b0 = 0 then skip0


if b1 = 0 then
  pause gaptime  
  pulsout c.0, pulsetime 
  pause gaptime
  endif
skip0:

if b0 = 1 then skip1
if b1 = 1 then
 pause gaptime
  pulsout c.1, pulsetime
  pause gaptime
  endif
skip1:
goto main
 

Gazza_AU

Member
I did not include a full working code for the example, was not thinking.
Should have put some symbols and stuff in so it made sense.
Downloaded the editor to have a play!

Just to confirm we are on the same page!
Let b0 = b1

So after this code b0 will be load with the value of b1.

A following piece of code:
inc b1

will increase the value of b1 by +1.

xxxxxxxxxxxxxxxxxxxxx

I have been writing different codes after leaving here knowing it was basic based.
If the above is correct, my codes should work.
Time to do some shopping.

Cheers,
Gary
 

premelec

Senior Member
If you put your code in the editor and Simulate you can track what happens to variables... you can transfer a value from one variable to another as you indicate...
 

Gazza_AU

Member
If you put your code in the editor and Simulate you can track what happens to variables... you can transfer a value from one variable to another as you indicate...
Using 5V 1/2/4/6/8 Channel Relay Board Module Optocoupler LED for Arduino PiC ARM AVR
http://www.ebay.com.au/itm/142221802900?_trksid=p2057872.m2749.l2649&var=441288921246&ssPageName=STRK%3AMEBIDX%3AIT

Just thinking about what voltage battery pack would be needed.
Not sure of the minimum voltage for the Relay board and Picaxe?


Can I use this USB to Serial PicAxe cable on Ebay

FTDI USB to serial PicAxe download programming cable 3.5mm jack replaces AXE027
http://www.ebay.com.au/itm/FTDI-USB-to-serial-PicAxe-download-programming-cable-3-5mm-jack-replaces-AXE027-/252805285427?hash=item3adc5e8633:g:vZ4AAOSwqu9VE-jQhttp://www.ebay.com.au/itm/FTDI-USB-to-serial-PicAxe-download-programming-cable-3-5mm-jack-replaces-AXE027-/252805285427?hash=item3adc5e8633:g:vZ4AAOSwqu9VE-jQ

Instead of this Genuine one from http://www.picaxestore.com/index.php/en_gb/axe027.html

Any differences I need to consider?
 
Last edited:

premelec

Senior Member
Using 5V 1/2/4/6/8 Channel Relay Board Module Optocoupler LED for Arduino PiC ARM AVR
http://www.ebay.com.au/itm/142221802900?_trksid=p2057872.m2749.l2649&var=441288921246&ssPageName=STRK%3AMEBIDX%3AIT

Just thinking about what voltage battery pack would be needed.
Not sure of the minimum voltage for the Relay board and Picaxe?
It doesn't say what the required voltage and current are... looks like regulator chip on the board - likely 12vdc - looking closer at ebay picture indicates relays may be 5volt so regulator would be to 5v... current will be 16x individual relay current max...
but can be driven by 5v to optocoupler...

Can I use this USB to Serial PicAxe cable on Ebay

FTDI USB to serial PicAxe download programming cable 3.5mm jack replaces AXE027
http://www.ebay.com.au/itm/FTDI-USB-to-serial-PicAxe-download-programming-cable-3-5mm-jack-replaces-AXE027-/252805285427?hash=item3adc5e8633:g:vZ4AAOSwqu9VE-jQhttp://www.ebay.com.au/itm/FTDI-USB-to-serial-PicAxe-download-programming-cable-3-5mm-jack-replaces-AXE027-/252805285427?hash=item3adc5e8633:g:vZ4AAOSwqu9VE-jQ

Instead of this Genuine one from http://www.picaxestore.com/index.php/en_gb/axe027.html

That's been discussed at length - some work and some don't - I've had good luck with CH340 chip units to D9 connector to use my 10 year old programming cable...

Any differences I need to consider?
make sure seller guarantees that it will work...
 
Last edited:

Gazza_AU

Member
It doesn't say what the required voltage and current are... looks like regulator chip on the board - likely 12vdc - looking closer at ebay picture indicates relays may be 5volt so regulator would be to 5v... current will be 16x individual relay current max...
but can be driven by 5v to optocoupler....
I am sticking to sequences that only have one output high at a time.
There is also the delay between each high.

You would think the 5v optocoupled relay board would work of 4.5v?
Otherwise I might need a 5 volt regulator.

I like the idea of Battery powered for the total separation and UPS.
If anybody can offer more info on the minimum operating voltage for relays boards: http://www.ebay.com.au/itm/142221802900?_trksid=p2057872.m2749.l2649&var=441288921246&ssPageName=STRK%3AMEBIDX%3AIT

For a Power Supply
How about Portable 5V/2A Mobile Power Supply USB Battery Charger 18650 Box w/ Dual Output
http://www.ebay.com.au/itm/Portable-5V-2A-Mobile-Power-Supply-USB-Battery-Charger-18650-Box-w-Dual-Output-/161855595064?hash=item25af586238:g:kFQAAOSwA4dWG3bJhttp://www.ebay.com.au/itm/Portable-5V-2A-Mobile-Power-Supply-USB-Battery-Charger-18650-Box-w-Dual-Output-/161855595064?hash=item25af586238:g:kFQAAOSwA4dWG3bJ

It needs 4x 18650 lithium ion rechargeable batteries!

If I understand this correctly it will charge batteries when connected to PC via USB?
And outputs 5v through USB cable? I have never used a phone.

Perhaps someone else can clarify how these battery holder/chargers work?

EDIT: I have decided to use a regulator which will free up the available choice for higher Voltage Battery types
 
Last edited:

premelec

Senior Member
Probably work on 4.5 v - the battery bank units have an up converter to 5v - it takes a minimum current to start the up converter and then a minimum to keep it running - they charge the internal 3.7v lithium battery from USB port OK but a bit slow... there are variations in different units and not usually spec'd - empiricism is your friend. The battery bank also keeps the internal Li cell from over discharging... a necessity for long life of this type battery.
 

Gazza_AU

Member
If you are new to PICAXE then I sugegst to consider buying the genuine AXE-27 cable.
http://www.picaxestore.com/index.php/en_gb/axe027.html

Since you are looking to possibly have other parts beside the PICAXE one option is to build your circuit on some strip board (veroboard) with everything on the same board.
You just need to include the 3.5 mm stereo socket and a few resistors for programming and plus a voltage regulator (unless 4.5V battery powered)
Hi westaust55,

Purchased: 5V 1/2/4/6/8 Channel Relay Board Module Optocoupler LED for Arduino PiC ARM AVR
http://www.ebay.com.au/itm/142221802900?_trksid=p2057872.m2749.l2649&var=441288921246&ssPageName=STRK%3AMEBIDX%3AIT
Each 5V 1-Channel Relay interface board, needs 15-20mA Driver Current.
Only one Relay will ever be in operation at the same time!

I am starting account with Picaxe Store.
AXE027 PICAXE USB Download Cable;
http://www.picaxestore.com/index.php/en_gb/axe027.html

My Question for Picaxe Community is: what Voltage Regulator is included with "PICAXE-28X2 Module - AXE201"?

What is the AXE201 Voltage Regulator Max input volts?
What is the AXE201 Voltage Regulators Maximum current

Quote: "Max total IC current limits of the order of 95 mA (typical for many PICAXE chips)"

I ask because the AXE201 regulator might be able to power the 17 Channel Relay Board Module as well.
Or; could the AXE201 regulator be changed to bigger version.
Could be a tidy solution, I am assuming the PICAXE-28X2 Module has all required components??

PICAXE-28X2 Module - AXE201
http://www.picaxestore.com/index.php/en_gb/picaxe/picaxe-chips/picaxe-modules/axe201.html

Quick Overview
A PICAXE-28X2 module.
This module contains a PICAXE-28X2 (PIC18F25K22) chip, voltage regulator,
download socket, and reset switch in a convenient 28 pin (0.6") format.
Ideal for breadboarding work.

Can anybody tell me what voltage regulator is used in PICAXE-28X2 Module?

As mentioned, I taught myself basic from a book with ZX80 imported from England that year.
I purchased expansion and speech synthesizer, programming artificial intelligence into a machine.
No more then a parrot compared to Today.

I always wanted a multi-relay output for the ZX80 and never got one.
I will make these relays do all these past thoughts, and a lot more.

Thanks,
Gary
 
Last edited:

hippy

Technical Support
Staff member
I do not know what part number the regulator is but the AXE201 section in Manual 1 indicates "5V 500mA LDO" however, it might not be wise to run it to its limits, especially at higher input voltages. The maximum input voltage in is stated as 12V.
 

Gazza_AU

Member
I do not know what part number the regulator is but the AXE201 section in Manual 1 indicates "5V 500mA LDO" however, it might not be wise to run it to its limits, especially at higher input voltages. The maximum input voltage in is stated as 12V.
Thanks hippy, did not know the info was in a manual.

So I need a rechargeable battery cell of at least 5v plus the drop across regulator?
500ma from regulator, minus 95 mA for PICAXE chip, would leave 400ma for Relay Board/s.
Looks good to order.

What is a common rechargeable Battery cell/pack for a suitable voltage?
 
Last edited:

hippy

Technical Support
Staff member
500ma from regulator, minus 95 mA for PICAXE chip, would leave 400ma for Relay Board/s.
Not necessarily. That the regulator is rated at 500mA does not mean that it and the board are capable of sustaining that amount of current. I do not know what the maximum rating is.
 
Top