PDA

View Full Version : fun with electronics


Hemingray Insulators
12-22-2007, 08:53 PM
gpt a traffic light the other day from an electrical contractor that does a lot of traffic light maintenance for the county. got it hooked up to a contoller i prototyped and hade made into a printed circuit board a while back to change the colors. i gotta get some pics of it on my line tho lol. but anyhow, i like to play with electronics as well as my line lol. which brings me to Clive. I'm looking into geting into micro controllers to play around with, (and eventually make a program to run 2 stoplights (1 in each direction)) and i was wonder what kind of setup you use/ what you'd recomend as a good setup to start out with given i don't have any programming experience other than some PLC ladder logic.

http://i29.photobucket.com/albums/c252/Tshooter/trafficlight007.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlight006.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlight005.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlight004.jpg

Hemingray Insulators
12-23-2007, 07:51 PM
Merry Christmas to you too Swamp. and no, i STILL aint got the shirt printed yet, but i haven't forgotten lol :-)

heres a few pics from today, i decided it was a bit too big for my room, and moved it outside :-)

http://i29.photobucket.com/albums/c252/Tshooter/trafficlightdec232007007.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlightdec232007003.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlightdec232007004.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlightdec232007001.jpg

Hemingray Insulators
12-24-2007, 06:01 PM
i've been playing with the computer a bit lately and found out how to automate my line using the conputers parrallel port, but for some reason the computer doesn't seem to let me program it, so i can only turn on all automated switches or turn them all off. i need to figure out how to seperate the digital outputs, any help clive? lol.

Merry Christmas to all.

Squizzy
12-24-2007, 07:32 PM
Clive will be back in a few days he is having a few days away and the internet is a bit dodgey where he is at the moment.

BigClive
12-27-2007, 11:09 PM
I'm back in the land of technology....

Is that just a 555 clocking a 4017 that you've rigged up? I take it that you're driving reed relays on the PCB and using them to switch the external relays on the DIN rail?

You could do with some proper plastic PCB stand-off's to hold the PCB in place, and a couple of washers will clamp the DIN rail better and an earth connection onto the rail is needed since the metal screws protrude to the exterior of the otherwise double insulated case. (That's your quality control lecture over.) :)

A PIC microcontroller would be perfect for this job. You could use a PIC16F627 and a ULN2803 darlington array to drive the relays. I wrote a bit of machine code for exactly that application a while back when I did a set of miniature traffic lights for the set of a BBC series called PC Alisdair Stiubhart (pronounced PC Alister Stuart) A production in the Scottish Gaelic language.

I don't think anyones tried posting a complete machine code listing on a lineman forum before, so here goes. :D

(Note that Notepad tends to mutilate the tabs a bit!)

;Switch activated LED controller. - CLIVE 7/9/2006.
;Traffic light controller
;With pushbutton sequencing for scale roadway set.

list p=16f627 ; list directive to define processor
#include <p16f627.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file


__CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _LVP_OFF






INLOOP EQU 0X20 ;GENERIC CLOSED INNER LOOP
OUTLOOP EQU 0X21 ;GENERIC OUTER LOOP
SCENE EQU 0X22 ;SCENE COUNTER
SPEED EQU 0X23 ;SPEED SETTING
FLAGS EQU 0X24 ;GENERAL FLAGS

DELTIME EQU 15 ;MAIN DELAY TIME

;INITIALISATION OF REGISTERS AND OPTIONS.
REBOOT NOP
NOP
NOP
NOP

MOVLW B'00000000' ;SET ALL PORT A OUTPUTS LOW
MOVWF PORTA ;MOVE TO PORT A
MOVLW B'11111111' ;SET ALL PORT B OUTPUTS HIGH (DISPLAY OFF)
MOVWF PORTB ;MOVE TO PORT B

MOVLW 0X07
MOVWF CMCON ;DISABLE COMPARATORS

BCF STATUS,RP1 ;MAKE SURE ACTIVITY IS LIMITED TO BANKS 0 + 1
BSF STATUS,RP0 ;SWITCH TO BANK 1

BCF PCON,3 ;MAKE SURE INTERNAL OSCILLATOR IS RUNNING AT LOW SPEED.

MOVLW b'11111111' ;CONFIGURE OPTION REGISTER FOR MAX WDT PRESCALE.
MOVWF OPTION_REG

MOVLW B'00000011' ;SET PORTS TRISTATE REGISTERS.
MOVWF TRISA
MOVLW B'00000000'
MOVWF TRISB

BCF STATUS,RP0 ;SWITCH BACK TO BANK 0

INITIAL ;STARTS WITH MAIN GREEN AND SIDE RED
MOVLW B'01100100'
MOVWF PORTB
CLRF PORTA
CALL BIGDEL
GOTO BUT3

MAIN2RED MOVLW B'11010010'
MOVWF PORTB
BCF PORTA,2
CALL BIGDEL
MOVLW B'00001001'
MOVWF PORTB
BSF PORTA,2
BUT1 CLRWDT
BTFSC PORTA,1 ;TEST BUTTON
GOTO BUT1 ;LOOP IF STILL PRESSED
BUT2 CLRWDT
BTFSS PORTA,1 ;TEST BUTTON
GOTO BUT2 ;LOOP IF NOT PRESSED (WAITING FOR PRESS)

MAIN2GRN MOVLW B'10011011' ;MAIN RED AND YELLOW / SIDE YELLOW
MOVWF PORTB
BCF PORTA,2
CALL BIGDEL
MOVLW B'01100100' ;MAIN GREEN / SIDE RED
MOVWF PORTB
BCF PORTA,2
BUT3 CLRWDT
BTFSC PORTA,1 ;TEST BUTTON
GOTO BUT3 ;LOOP IF STILL PRESSED
BUT4 CLRWDT
BTFSS PORTA,1 ;TEST BUTTON
GOTO BUT4 ;LOOP IF NOT PRESSED (WAITING FOR PRESS)

GOTO MAIN2RED


BIGDEL MOVLW DELTIME
MOVWF OUTLOOP
CLRF INLOOP
BDEL1 CLRWDT
DECFSZ INLOOP,1
GOTO BDEL1
DECFSZ OUTLOOP,1
GOTO BDEL1
RETURN






END ; directive 'end of program'

BigClive
12-27-2007, 11:18 PM
Hmm, and the forum got rid of the rest of the tabs!

That code was written for a small hand-held controller that would change two sets of lights on a cross-roads through their correct sequences at each press of a button. The first press would make the lights go through the sequence to give the main road a green, while the second press would do the opposite.

I'm not sure how the American lights sequence, but ours go:-

Green - amber - red.

Red - red + amber - green.

It would be easy to replace the button sensing routine with a long delay so the lights cycled automatically.

As far as the programming of the PICs goes, I use a PICstart plus myself. It's the official programmer from the manufacturer. Unusually for a proprietary programmer it is very affordable and programs just about every chip in the PIC range. It interfaces directly with the MPLAB development environment which is available for free download from:-
http://www.microchip.com


Now where were we... Oh yeah. Climbing poles and diggin' holes. ;)

Hemingray Insulators
12-28-2007, 12:43 AM
thanks for the info clive.

for christmas i got a BASIC stamp with the book "whats a microcontroller" and have been goin at that on the computer the last few days. its a lot of fun lol. and i think i'm catching on to BASIC. i hear ya about the standoff and such lol, in fact today i just sent in an order for some hardware and electronic parts, and funny you should mention the PIC16F627, i just ordered some of those also lol. i must look into getting a programmer and the software, because playing with the basic stamp has got me a lot more interested in microcontrollers and ore confident that i'd actually be able to program one, as working on the PLC's at Pfizer over the summer in DOS got REALLY confusing, but then again they do have complicated sequences in what we were controlling lol.

i'm to the point of where i've picked up basic quite quickly, and an now just building stuff on a breadboard to use with the stamp, and writeing out on paper what i think the programming would be and writeing it to the stamp and see if it works. it's easier than i thought it'd be. now lets hope the lanuage to program PIC's isn't too difficult.

thanks again on the advice clive, and yes you are correct, i have a 555 clocking into a 4017 with transistors drveing the reeds.

when i had the PCB printed i was using reeds to control one of those toy traffic lights with 7w bulbs, so the .5A 125v contact rateing was plenty suficient, but when i got this light i found only the red aspect had a newer LED module, the green and yellow were both 40w bulbs, i figured i ought to put in some external relays;) to switch the 120

BigClive
12-28-2007, 03:17 PM
You were using a DOS program to load the PLC's???

If you decide to use the much easier BASIC to program your PIC's then you can find BASIC interpreters that will do the code for an ordinary processor on the 'net. A lot cheaper than buying STAMP modules which are basically just PIC's on a PCB anyway. I use machine code myself because it's what I started off with and can run the processor to it's limit.

I guess the reason the traffic light has a red LED panel is because the green LEDs were much more expensive a while back and the yellow panel is considered to be on for such a small amount of time that the economy in using an LED panel is lower. Here they are using more and more LED lights.

I can thank the union (EETPU back then) for getting me into microprocessors. They ran a few basic electronics courses for electricians and one of them covered programming a Heathkit computer in hex. It was one of those situations where I had bits of data from here and there but they put the jigsaw together and it all suddenly made sense.

Orgnizdlbr
12-28-2007, 06:20 PM
You were using a DOS program to load the PLC's???

If you decide to use the much easier BASIC to program your PIC's then you can find BASIC interpreters that will do the code for an ordinary processor on the 'net. A lot cheaper than buying STAMP modules which are basically just PIC's on a PCB anyway. I use machine code myself because it's what I started off with and can run the processor to it's limit.

I guess the reason the traffic light has a red LED panel is because the green LEDs were much more expensive a while back and the yellow panel is considered to be on for such a small amount of time that the economy in using an LED panel is lower. Here they are using more and more LED lights.

I can thank the union (EETPU back then) for getting me into microprocessors. They ran a few basic electronics courses for electricians and one of them covered programming a Heathkit computer in hex. It was one of those situations where I had bits of data from here and there but they put the jigsaw together and it all suddenly made sense.

scuse me gents....mind speaking english......http://ww3.powerlineman.com/lforum/images/icons/icon12.gif

BigClive
12-28-2007, 06:51 PM
Well y'know, I know a good few linemen who can tackle electronic stuff with dignity.....

Orgnizdlbr
12-28-2007, 06:57 PM
Well y'know, I know a good few linemen who can tackle electronic stuff with dignity.....

This old dog is too old to learn any new trickshttp://ww3.powerlineman.com/lforum/images/icons/icon12.gif I hope you enjoyed your Holiday Clive!!

BigClive
12-28-2007, 11:13 PM
Nah, you're never too old to learn new tricks. They just have to catch your interest and away you go.

The holiday was a nice break, but the lack of Internet access did cause a level of desperation. My parents live in a fairly isolated rural part of the island.

I took a short video clip of the local beach.

http://www.youtube.com/watch?v=-CJLRREhTA0

Orgnizdlbr
12-29-2007, 12:22 AM
Nice looking scenery, that water looked mighty cold..........!!

BigClive
12-29-2007, 04:01 PM
Nice looking scenery, that water looked mighty cold..........!!

Well I certainly wasn't going in for a swim. I don;t think that's the sort of beach I'd EVER want to go for a swim at. There's no sand at all. Just piles of pebbles all stacked up in a series of steep banks by the tide.

It's a very popular beach for bikers to have wild barbecues at during the TT races.

Hemingray Insulators
01-24-2008, 10:12 PM
got another traffic light lol.

http://i29.photobucket.com/albums/c252/Tshooter/trafficlights21jan2008003.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlights21jan2008005.jpg
http://i29.photobucket.com/albums/c252/Tshooter/trafficlights21jan2008001.jpg

Hemingray Insulators
02-26-2008, 05:02 PM
hey clive........i'm working on designing the "next generation" traffic light controller for controllin lights........i want to have 16 outputs, RYG north/south, RYG east/west RYGarrow turn N/S, RYG turn E/W and pedestrian signals N/S, E/W, and am gonna use a micro controller (PIC16F57).
was wondering if ya knew anything about optoisolated triac drivers:
I'm looking here in a product catalog and see: Bilateral triac driver, Random Phase triac driver, and Zero crossing triac driver all are DIP-6's. i already have 800V 10A triacs that i want to use when i get the money to have PCB's made and such, but am not sure about the opto drivers. i dont know what the different kinds are or what would work best, so was hoping you could shed some light on them lol.
it'll be a while before i actually make it, as i still haven't got a PIC programer yet or anything............but i like usein expressPCB when i'm board and makin up PCB designs for fun lol............and thats how the 1st type of light controller i made came about lol.........
also there are AC solid state relays that take an optoisolated 3-30vdc input, that are like $4 or so.........while i think if i got the triacs and drivers would be cheaper, but either method is cheaper than going with a seperate relay and socket for each output lol..............just some things i was wondering about..............thats all.

BigClive
02-26-2008, 07:42 PM
Using a triac optoisolator for a simple resistive load is really easy. You simply connect the triac side of the optoisolator (either way round) in series with a 150 ohm resistor between the main triacs MT2 and Gate terminals. That way when the opto triac turns on it passes current into the gate of the main triac until it turns on and effectively shunts out the opto triac.

You can choose between a zero-crossing detect opto triac or an ordinary one. The difference is that the zero detect one will only turn on round about the zero crossing point of the mains sinewave. This means that you are less likely to get switching noise like clicks and pops from any audio equipment.

For controlling awkward loads like transformers or capacitive droppers you need to use a bit more circuitry to help ensure that the main triac does latch on.

The solid state relays are pretty affordable when bought from surplus stores and save a lot of wiring up. They are basically the above circuit, but optimised for inductive loads and with a current regulator on the input to the opto triacs LED.

You should still consider relays too though, since they are technically more fun than the triacs, and your application isn't going to require 24/7 operation anyway.

Have you drawn up a sequencing chart for your lights?

Hemingray Insulators
02-29-2008, 11:23 PM
thanks for the helpful info Clive. is the 150 ohms according to the 220 mains you have or our 120 here in the US? also, because all the triacs are suplied from the same source is it possible to have 1 resistor suplyinging a "buss" to the opto's? or is a seperate resistor for each triac the preffered method? they sound pretty easy to use. lol, i had just recently learned they need drivers lol, cuz i had it hooked up to a couple 555 circuits and the leads hooked to outlets with christmas lights pluged in, and i only measured 60V on the outlet and not the normal 120. soon found out it was because the wave out of the 555 is only + it only drives the + half cycle lol. giving half the voltage...............thats when i figured out that i need to use a driver for it lol. funny things can happen when you are "expirimenting" lol.

BigClive
03-01-2008, 05:42 AM
The 150 ohm should be good for 120V as well. You would need a separate 150 ohm resistor for each triac, but they are only common quarter or half watt ones anyway.

Depending on the triac you have it may take a lot of current to turn it on. Typically 50 to 100mA. There are also four "quadrants" you have to consider when turning on a triac. They relate to the polarity of MT2 to MT1 and also the polarity of the gate with reference to MT1. Some of the more modern triacs have sacrificed one of the phase firing quadrants to make the components more robust. Or to cut a long story short, use an opto-isolator or connect MT1 of your triacs to the positive rail of your circuitry and pull the gate negative, since they prefer being turned on with negative gate drive.

Yeah, sorry guys. More technobabble. :rolleyes: