All,
I am working on a project where I have adapted shelving bins by covering the top permanently with acrylic and making an acrylic door which is attached to the top by two open sprung hinges. The door is held closed by a magnetic catch. A push solenoid is then energised to push the door off the magnetic catch and the hinge takes over to fully open the door. I am using a PICAXE 28X2 as there will be 11 of the shelving bins and this number could potentially increase. The solenoid is 12Vdc and 3W. Each bin has its own barcode which will be scanned in order to open that bin. The idea is to have the barcode scanner feed the information to the PC and the PC send this information to the PICAXE through the serial.
I am new to the world of electronics but I have dived in, could anyone tell me if there are any mistakes in my code or schematic (Note: The inductor would not translate to the PCB in DesignSparkPCB so I have used an LED in the schematic instead to represent the solenoid. Also the NFET is supposed to be a MOSFET IRL520 as shown in Manual 3)? Any other suggestions would be appreciated
Andie
Just realised I forgot to change the values for the resistors so where it says 1K pretend it says 10K
I am working on a project where I have adapted shelving bins by covering the top permanently with acrylic and making an acrylic door which is attached to the top by two open sprung hinges. The door is held closed by a magnetic catch. A push solenoid is then energised to push the door off the magnetic catch and the hinge takes over to fully open the door. I am using a PICAXE 28X2 as there will be 11 of the shelving bins and this number could potentially increase. The solenoid is 12Vdc and 3W. Each bin has its own barcode which will be scanned in order to open that bin. The idea is to have the barcode scanner feed the information to the PC and the PC send this information to the PICAXE through the serial.
I am new to the world of electronics but I have dived in, could anyone tell me if there are any mistakes in my code or schematic (Note: The inductor would not translate to the PCB in DesignSparkPCB so I have used an LED in the schematic instead to represent the solenoid. Also the NFET is supposed to be a MOSFET IRL520 as shown in Manual 3)? Any other suggestions would be appreciated
Andie
Code:
main:
SERTXD("Scan barcode")
SERRXD b0,b1,b2,b3,b4,b5,b6,b7 ;Barcode scanned to the PC and values are read through the 'serial in' port as variables
SERTXD(b0,b1,b2,b3,b4,b5,b6,b7,13,10) ;Send the values of the variables through the 'serial out' port to the PC
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="1" THEN GOTO compartment1 ;If barcode matches screws in compartment 1 jump to 'compartment1' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="2" THEN GOTO compartment2 ;If barcode matches screws in compartment 2 jump to 'compartment2' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="3" THEN GOTO compartment3 ;If barcode matches screws in compartment 3 jump to 'compartment3' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="4" THEN GOTO compartment4 ;If barcode matches screws in compartment 4 jump to 'compartment4' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="5" THEN GOTO compartment5 ;If barcode matches screws in compartment 5 jump to 'compartment5' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="6" THEN GOTO compartment6 ;If barcode matches screws in compartment 6 jump to 'compartment6' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="7" THEN GOTO compartment7 ;If barcode matches screws in compartment 7 jump to 'compartment7' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="8" THEN GOTO compartment8 ;If barcode matches screws in compartment 8 jump to 'compartment8' label
IF b2="1" AND b3="9" AND b5="0" AND b6="0" AND b7="9" THEN GOTO compartment9 ;If barcode matches screws in compartment 9 jump to 'compartment9' label
IF b2="1" AND b3="9" AND b5="0" AND b6="1" AND b7="0" THEN GOTO compartment10 ;If barcode matches screws in compartment 10 jump to 'compartment10' label
IF b2="1" AND b3="9" AND b5="0" AND b6="1" AND b7="1" THEN GOTO compartment11 ;If barcode matches screws in compartment 11 jump to 'compartment11' label
SERTXD("BARCODE NOT RECOGNISED, PLEASE SCAN AGAIN!") ;If barcode does not match any of the screws PC displays "BARCODE NOT RECOGNISED, PLEASE SCAN AGAIN!"
GOTO main ;Jumps back to the start of the 'main' label
compartment1:
SERTXD("Compartment 1",13,10) ;Displays "Compartment 1" followed by a Carriage Return (13) and Line Feed (10) on the PC
HIGH B.1 ;Sends voltage to solenoid of compartment 1
WAIT 5 ;Holds voltage for 5 seconds
LOW B.1 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment2:
SERTXD("Compartment 2",13,10) ;Displays "Compartment 2" followed by a Carriage Return (13) and a Line Feed (10) on the PC
HIGH B.2 ;Sends voltage to solenoid of compartment 2
WAIT 5 ;Holds voltage for 5 seconds
LOW B.2 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment3:
SERTXD("Compartment 3",13,10) ;Displays "Compartment 3" followed by a Carriage Return (13) and a Line Feed (10) on the PC
HIGH B.3 ;Sends voltage to solenoid of compartment 3
WAIT 5 ;Holds voltage for 5 seconds
LOW B.3 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment4:
SERTXD("Compartment 4",13,10) ;Displays "Compartment 4" followed by a Carriage Return (13) and a Line Feed (10) on the PC
HIGH B.4 ;Sends voltage to solenoid of compartment 4
WAIT 5 ;Holds voltage for 5 seconds
LOW B.4 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment5:
SERTXD("Compartment 5",13,10) ;Displays "Compartment 5" followed by a Carriage Return(13) and a Line Feed(10) on the PC
HIGH B.5 ;Sends voltage to solenoid of compartment 5
WAIT 5 ;Holds voltage for 5 seconds
LOW B.5 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment6:
SERTXD("Compartment 6",13,10) ;Displays "Compartment 6" followed by a Carriage Return (13) and a Line Feed (10) on the PC
HIGH B.6 ;Sends voltage to solenoid of compartment 6
WAIT 5 ;Holds voltage for 5 seconds
LOW B.6 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment7:
SERTXD("Compartment 7",13,10) ;Displays "Compartment 7" followed by a Carriage Return (13) and a Line Feed (10) on the PC
HIGH B.7 ;Sends voltage to solenoid of compartment 7
WAIT 5 ;Holds voltage for 5 seconds
LOW B.7 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment8:
SERTXD("Compartment 8",13,10) ;Displays "Compartment 8" followed by a Carriage Return (13) and a Line Feed (10) on the PC
HIGH C.0 ;Sends voltage to solenoid of compartment 8
WAIT 5 ;Holds voltage for 5 seconds
LOW C.0 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment9:
SERTXD("Compartment 9",13,10) ;Displays "Compartment 9" followed by a CArriage Return (13) and a Line Feed (10) on the PC
HIGH C.1 ;Sends voltage to solenoid of compartment 9
WAIT 5 ;Holds voltage for 5 seconds
LOW C.1 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment10:
SERTXD("Compartment 10",13,10);Displays "Compartment 10" followed by a Carriage Return (13) and a Line FEed (10) on the PC
HIGH C.2 ;Sends voltage to solenoid of compartment 10
WAIT 5 ;Holds voltage for 5 seconds
LOW C.2 ;Stops voltage
GOTO main ;Jumps back to 'main' label
compartment11:
SERTXD("Compartment 11",13,10);Displays "Compartment 11" followed by a Carriage Return (13) and a Line Feed (10) on the PC
HIGH C.3 ;Sends voltage to solenoid of compartment 11
WAIT 5 ;Holds voltage for 5 seconds
LOW C.3 ;Stops voltage
GOTO main ;Jumps back to 'main' label
Attachments
-
57 KB Views: 21
-
40.8 KB Views: 13
Last edited: