If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.
Special Thanks To:
Aaron Holmes
Aaron Wheeler
Adam Horden
Alan Scrimgeour
Andre
Andrew Haynes
Anonymous000
asabase
Austin Weil
barney
Barry
Bert Hickman
Bill Kukowski
Blitzorn
Brandon Paradelas
Bruce Bowling
BubeeMike
Byong Park
Cesiumsponge
Chris F.
Chris Hooper
Corey Worthington
Derek Woodroffe
Dalus
Dan Strother
Daniel Davis
Daniel Uhrenholt
datasheetarchive
Dave Billington
Dave Marshall
David F.
Dennis Rogers
drelectrix
Dr. John Gudenas
Dr. Spark
E.TexasTesla
eastvoltresearch
Eirik Taylor
Erik Dyakov
Erlend^SE
Finn Hammer
Firebug24k
GalliumMan
Gary Peterson
George Slade
GhostNull
Gordon Mcknight
Graham Armitage
Grant
GreySoul
Henry H
IamSmooth
In memory of Leo Powning
Jacob Cash
James Howells
James Pawson
Jeff Greenfield
Jeff Thomas
Jesse Frost
Jim Mitchell
jlr134
Joe Mastroianni
John Forcina
John Oberg
John Willcutt
Jon Newcomb
klugesmith
Leslie Wright
Lutz Hoffman
Mads Barnkob
Martin King
Mats Karlsson
Matt Gibson
Matthew Guidry
mbd
Michael D'Angelo
Mikkel
mileswaldron
mister_rf
Neil Foster
Nick de Smith
Nick Soroka
nicklenorp
Nik
Norman Stanley
Patrick Coleman
Paul Brodie
Paul Jordan
Paul Montgomery
Ped
Peter Krogen
Peter Terren
PhilGood
Richard Feldman
Robert Bush
Royce Bailey
Scott Fusare
Scott Newman
smiffy
Stella
Steven Busic
Steve Conner
Steve Jones
Steve Ward
Sulaiman
Thomas Coyle
Thomas A. Wallace
Thomas W
Timo
Torch
Ulf Jonsson
vasil
Vaxian
vladi mazzilli
wastehl
Weston
William Kim
William N.
William Stehl
Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Registered Member #14
Joined: Thu Feb 02 2006, 01:04PM
Location: Prato/italy
Posts: 383
since my coilguns need to be more and more compact i'll stick to a PIC16f84 microcontroller design for pulsetimes and magazine projectile counting.
Current setup: RB0 port interrupt triggered by transitions in the optic side (4 stages or-ed) of the coilgun RB1-RB7 -> 7 segment display multiplexed with RA1-RA3 ports (3 digits)
RB1-RB4 -> detecting which stage is involved (setting ports as input during the interrupt cycle, as output during the main program)
RA0 -> button multiplexed with RB5-RB7 (mode, + , -)
RA4 -> iGBT gate driver IC input (common IGBT for all stages, scr's to select the proper stage triggered dyrectly from the optic side)
Features: pulse duration setting stand alone, without the use of a PC (1-255, 10us-2.55ms). Setting magazine capacity (1-9 projectiles).
During interrupt see which RB port is high to select proper pulse duration and sending it to RA4.
6 modes of operation selected with the mode button: Standard (showing projectiles left) Stage 1 pulse time (using + and - buttons to tweak the time) 0, to disable stage 2 pulse time (using + and - buttons to tweak the time) 0, to disable . stage 4 pulse time (using + and - buttons to tweak the time) 0, to disable magazine projectile capacity (using + and - buttons to select the numer) al significative data stored in the eeprom (to not set pulse times every time i power up the gun)
the multiplexying scheme is quite complex, but should work properly
the rest of the coilgun management is left to the analog part (comparators, LM3914 led driver, timers etc)
Registered Member #509
Joined: Sat Feb 10 2007, 07:02AM
Location:
Posts: 329
The 16F84 is a bit aged, you can find other 18 pin micros with a few more I/Os.
The 16F84 @ jameco $5.59/1
The 16F87 @ jameco 16 IO lines for only $3.39
For the 7 segment displays, are you displaying numbers only, or some letters too? Are you buffering the displays? You could multiplex a few of them without buffers (just using a transistor for the common cathode/anode)
Even with only 13 IOs I can came up with a design that doesn't need the pins to be multiplexed in software.
I'll try to explain, if that doesn't make sense, I'll make up a sketch for you.
If you use 3 BCD - 7 Segment decoders, you can use 7 pins in total to drive the display. 4 data, and 3 latch pins. For the inputs to figure out which stage is active, you can use a 8-3 priority encoder, since only one will be active at a time. Plus you could use up to 8 stages later on.
RB7 would be your IGBT output.
AN0 -(analog input, not digital) - 3 resistors in series connected to Vss. Put a momentary switch at each junction, and at the very top. When the top button is pressed, the ADC will read 1/3Vcc (85 or so) When the middle is pressed, it will read 1/2 vcc. (127) and when the bottom button is pressed, VCC directly will be read (255) RA1 - 7 seg latch 1 RA2 - 7 seg latch 2 RA3 - 7 seg latch 3 RA4 - D0 for 7-seg driver RA5 - D1 for 7-seg driver RA6 - OSC 2 RA7 - OSC1
RB0 - ORed interrupt for optical input RB1 - D0 of encoder RB2 - D1 of encoder RB3 - D2 of encoder RB4 - D2 for 7-seg driver RB5 - D3 for 7-seg driver RB6 - Trigger RB7 - Output to IGBT driver.
Though it does seem you're missing a trigger... You could add another resistor to the chain on AN2, or give the trigger its own IO. I would do the latter for safety purposes.
EDIT:
I'm assuming you'll want to run at a full 20 mhz and not 4mhz on the internal osc. So I you'll only have 14 IO pins then. Let me look up which pins are the OSC pins and change my post as needed.
Registered Member #14
Joined: Thu Feb 02 2006, 01:04PM
Location: Prato/italy
Posts: 383
ConKbot of Doom wrote ...
The 16F84 is a bit aged, you can find other 18 pin micros with a few more I/Os.
The 16F84 @ jameco $5.59/1
The 16F87 @ jameco 16 IO lines for only $3.39
For the 7 segment displays, are you displaying numbers only, or some letters too? Are you buffering the displays? You could multiplex a few of them without buffers (just using a transistor for the common cathode/anode)
Even with only 13 IOs I can came up with a design that doesn't need the pins to be multiplexed in software.
I'll try to explain, if that doesn't make sense, I'll make up a sketch for you.
If you use 3 BCD - 7 Segment decoders, you can use 7 pins in total to drive the display. 4 data, and 3 latch pins. For the inputs to figure out which stage is active, you can use a 8-3 priority encoder, since only one will be active at a time. Plus you could use up to 8 stages later on.
RB7 would be your IGBT output.
AN0 -(analog input, not digital) - 3 resistors in series connected to Vss. Put a momentary switch at each junction, and at the very top. When the top button is pressed, the ADC will read 1/3Vcc (85 or so) When the middle is pressed, it will read 1/2 vcc. (127) and when the bottom button is pressed, VCC directly will be read (255) RA1 - 7 seg latch 1 RA2 - 7 seg latch 2 RA3 - 7 seg latch 3 RA4 - D0 for 7-seg driver RA5 - D1 for 7-seg driver RA6 - OSC 2 RA7 - OSC1
RB0 - ORed interrupt for optical input RB1 - D0 of encoder RB2 - D1 of encoder RB3 - D2 of encoder RB4 - D2 for 7-seg driver RB5 - D3 for 7-seg driver RB6 - Trigger RB7 - Output to IGBT driver.
Though it does seem you're missing a trigger... You could add another resistor to the chain on AN2, or give the trigger its own IO. I would do the latter for safety purposes.
EDIT:
I'm assuming you'll want to run at a full 20 mhz and not 4mhz on the internal osc. So I you'll only have 14 IO pins then. Let me look up which pins are the OSC pins and change my post as needed.
Probably i will stick also to a chip whith more memory as the 16f88 with compatible pinout.
anyways the digits are only 3 (they are enough) multiplexed with the A port (also the switches are multiplexed). The optics signal are or-ed and feed the rb0(configured as interrupt) to deactivate all B ports and read witch signal (from 4) is high to detect the stage and select the proper pulse time (stored in the eeprom), pulse and then back to the main. The pinout suits exactly my needs, the chip cost is 0$ because i have some of them laying around. I'm a bit concerned about program memory. Your idea looks interesting though.
what do you mean with trigger? it isn't needed because the trigger drives the injector pushing the projectile into the coils.
The thing gets a bit confusing. I will try to draw it down on eagle to explain myself better
Registered Member #509
Joined: Sat Feb 10 2007, 07:02AM
Location:
Posts: 329
ok, I didnt know you were using injection, so then a trigger wouldnt be needed.
The only thing I'm thinking could be a problem would be the LEDs pulling the optic sensor inputs up or down. Thats why I asked it they were being buffered.
If you get a BCD-7segment decoder that has a latch, then you only need to update the display when you have new data instead of constantly scanning it. Which would free up a bit of code space.
Since the inputs on the 7-seg decoders would be high-impedance, you could multiplex those with the outputs from the optos. Which could get you down to 10 IOs.
4 IOs for the 7segment drivers and opto inputs 3 IOs for the latches 1 IO for the interupt 1 IO for the IGBT output 1 Analog In for the switches.
Registered Member #33
Joined: Sat Feb 04 2006, 01:31PM
Location: Norway
Posts: 971
If you are going to use chips to drive the LED displays, shift registers would propably be cheaper and require less pins. However, I'd just connect the displays directly to the microcontroller outputs and multiplex them, as you had planned.
Registered Member #14
Joined: Thu Feb 02 2006, 01:04PM
Location: Prato/italy
Posts: 383
ConKbot of Doom wrote ...
ok, I didnt know you were using injection, so then a trigger wouldnt be needed.
The only thing I'm thinking could be a problem would be the LEDs pulling the optic sensor inputs up or down. Thats why I asked it they were being buffered.
If you get a BCD-7segment decoder that has a latch, then you only need to update the display when you have new data instead of constantly scanning it. Which would free up a bit of code space.
Since the inputs on the 7-seg decoders would be high-impedance, you could multiplex those with the outputs from the optos. Which could get you down to 10 IOs.
4 IOs for the 7segment drivers and opto inputs 3 IOs for the latches 1 IO for the interupt 1 IO for the IGBT output 1 Analog In for the switches.
Leaving 3 more for other purposes.
The optic signal is "buffered" by a shmitt trigger, and, you are right, the RB ports will pull down the signal but i will use a series of diodes and resistors, so no problem of pulling them down. When on of the optic signal is high (and will be high even it they are pulled down) the interrupt will be triggered, the The A port set to 1, the B ports set all to 0 (reverse voltage on the led display), TRISB register set on all inputs and determining which port is high to select the proper pulse time (read from EEPROM), pulse and back to the program. I will draw the schematic so you will understand better what i want to do and if possible correct any errors. The idea of the display drivers with latch is very interesting, it will remove the flickering ad reduce the code, i will search for these parts at futurlec.
(also there is another way around: using the pic16f876, lots of ports, which would allow me to control even the charge state and set the operating voltage.
Registered Member #509
Joined: Sat Feb 10 2007, 07:02AM
Location:
Posts: 329
Anders M. wrote ...
If you are going to use chips to drive the LED displays, shift registers would propably be cheaper and require less pins. However, I'd just connect the displays directly to the microcontroller outputs and multiplex them, as you had planned.
I think that comes down to being a preference of whoever is building it, if they want to do something in hardware, or completely in software. Lazy coders vs cheap builders
Registered Member #14
Joined: Thu Feb 02 2006, 01:04PM
Location: Prato/italy
Posts: 383
Anyways here is the eagle lite schematic of what i wanna do. I will esperiment also with the pic16f88 and the pic16f876A. If i would stick to the 28 pin PIC16f876a the software will also control firing (not allowing the injecctor to work if the magazine is 0) and voltage of the caps controlling the dc-dc convertor. This will result in very compact circuitry, in case of a software crash i would need to thrown down the main switch before the thing blows up.
the coilgun will reduce it's volume to only 4 devices 1: the optics + microcontroller and display (placed over the coils) 2: the power board (with capacitors underneath), placed under the coils 3- the dc dc high voltage convertor (royer topology with turn off pulling down the gates of the mosfets 4- the voltage board with input 12V SLA battery and +5 +24V outpus (tl494 boost converter for the +24 and a lm7805 for the +5V. The battery will sit in the handle. The main drawback that the pic16f876A is expensive and hard to be programmed with the jdm programmer
Edit : oh! S**T i forgot the eagle schematic . I will post it in the next post (after a reply)
Registered Member #509
Joined: Sat Feb 10 2007, 07:02AM
Location:
Posts: 329
TheMerovingian wrote ...
Anyways here is the eagle lite schematic of what i wanna do. I will esperiment also with the pic16f88 and the pic16f876A. If i would stick to the 28 pin PIC16f876a the software will also control firing (not allowing the injecctor to work if the magazine is 0) and voltage of the caps controlling the dc-dc convertor. This will result in very compact circuitry, in case of a software crash i would need to thrown down the main switch before the thing blows up.
the coilgun will reduce it's volume to only 4 devices 1: the optics + microcontroller and display (placed over the coils) 2: the power board (with capacitors underneath), placed under the coils 3- the dc dc high voltage convertor (royer topology with turn off pulling down the gates of the mosfets 4- the voltage board with input 12V SLA battery and +5 +24V outpus (tl494 boost converter for the +24 and a lm7805 for the +5V. The battery will sit in the handle. The main drawback that the pic16f876A is expensive and hard to be programmed with the jdm programmer
Edit : oh! S**T i forgot the eagle schematic . I will post it in the next post (after a reply)
If your going bigger, why not consider a HD44780 LCD display? Actually, I think if you comminicate with it in 4-bit parallel mode, you can get away with only 7 pins (0-3, RS RW and E) and then you could have a pretty versitile user interface. If you could scale/divide the cap bank voltage, you could have a display of your voltage, rounds in the magizine, and what each pulse width is all set at. You could probaby squeeze all of that on a 2x20 display.
of course you probaby have the 7-segments around allready.
If you could record the time between each stage, you could get some velocities and have it display that.
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.