Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 22
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
One birthday today, congrats!
Vaxian (17)


Next birthdays
05/21 Dalus (34)
05/21 Kizmo (37)
05/22 Skynet (32)
Contact
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.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

a PIC based capacitor charger

1 2 
Move Thread LAN_403
Thomas
Fri Jul 13 2007, 06:17PM Print
Thomas Registered Member #120 Joined: Fri Feb 10 2006, 07:07AM
Location: Westchester New York
Posts: 83
I'm posting this just to ask if my idea is a good. Basically I'm very new to PIC programming and wanted to keep the programming down a bit. So what I would like to do is set a voltage with a keypad (not a big deal) and the charge the bank to that set voltage or drop the current voltage to the set voltage. A high power boost converter will be used.
Now here is the part I question. I currently have a circuit with the TC14433A IC being used. This is a ADC, where the typical application is a voltmeter (this ADC displays 3 1/2 BCD digits (1.xxx or 0.xxx) -> (0 to 1.999mV)).
Now should I just send them to the PIC or should I code a 3 1/2 BCD digit voltmeter myself?
Also can anyone please suggest a few good books? Would it be better to use the PIC ADC and make it into a 3 1/2 BCD meter? Also I'm using the PIC16F877A.
Back to top
...
Fri Jul 13 2007, 07:01PM
... Registered Member #56 Joined: Thu Feb 09 2006, 05:02AM
Location: Southern Califorina, USA
Posts: 2445
Probably you best bet would better off with integrated a/d, and drive the displays from the pic. I have a feeling that trying to decode the bcd output from the a/d will be tricky... I think that the 16f877 only has 8bit a/d, but if you can manage with 2v/count (ie, 0x00=0v, 0x01=2v,...0xFF=512v) you should be fine.
Back to top
Thomas
Fri Jul 13 2007, 07:23PM
Thomas Registered Member #120 Joined: Fri Feb 10 2006, 07:07AM
Location: Westchester New York
Posts: 83
... wrote ...

Probably you best bet would better off with integrated a/d, and drive the displays from the pic. I have a feeling that trying to decode the bcd output from the a/d will be tricky... I think that the 16f877 only has 8bit a/d, but if you can manage with 2v/count (ie, 0x00=0v, 0x01=2v,...0xFF=512v) you should be fine.

See the problem is that the max voltage is 1200V so I would need 11 bits. I think BCD would be my only option unless I could use a 12 bit or more PIC, but they don't make them from what I know (I'm using microchips line) and I think the programming might be too complicated since I'm a beginner. I have made 3 BCD digit counters though. Thanks for the input
Back to top
Wolfram
Fri Jul 13 2007, 07:35PM
Wolfram Registered Member #33 Joined: Sat Feb 04 2006, 01:31PM
Location: Norway
Posts: 971
The ADC is 10 bits. Some 18F-series PICs have 12 bit ADCs, some 16F ones might as well. This means that you'll have a volt resolution if you set your max charging voltage to 1000V or half a volt if you set.

Using the PIC ADC is exceedingly simple. You put the right A/D configuration in ADCON0 and ADCON1, set the GO bit, and a short time later, the AD_GO bit goes low again and the result is in ADRESH:ADRESL.

An example. ADCON0 = b'01000001' (A/D clk = Fosc/8, ch. 0 selected, A/D on), ADCON1 = b'10001110 (right justified result, RA0 = analog input, the rest of the port is digital). Remember to configure RA0 as an input!

bsf	ADCON0,GO
LOOP	btfsc	ADCON0,GO	;Until GO is cleared (conversion finished)
	goto	LOOP		;Then wait inside this infinite loop


I recommend switching over to the 18F series PICs. The instruction set is similar enough, so there's not very much you need to learn if you already know 16F assembly. Most of the small annoyances of the 16F series are fixed, you don't have to deal with the pages in RAM or ROM. There are also many improvements, like multiply instructions, heavily improved indirect addressing, port latch registers in addition to the port registers (no more read-modify-write problems when using RMW-instructions on the ports).
Back to top
Thomas
Fri Jul 13 2007, 08:12PM
Thomas Registered Member #120 Joined: Fri Feb 10 2006, 07:07AM
Location: Westchester New York
Posts: 83
If I do go your way I found a nice chip with a 12 bit A/D, either the PIC18LF4423 or the PIC18LF4523. I think i will try to make a little program with your example and go though microchips documentation again and see what I can do. Now I can't seem to think of it now, but would there be a way to isolate the sample voltage? I'm currently using a voltage divider in my circuit to divide the voltage by 1000 so I have a sample voltage of 0 - 1.2V instead of 0 - 1200V. Do they make opto-isolators that if I send a volt in a get a volt out and if I send a half a volt in a get a half of a volt out? could that be done with a normal phototransistor by sending the voltage to the diode (never tried)? I don't see why it wouldn't work since i'm eith increasing or decreasing the light that hits the base of the transistor. Unless they don't work that way and are either on or off.
Back to top
Wolfram
Fri Jul 13 2007, 08:50PM
Wolfram Registered Member #33 Joined: Sat Feb 04 2006, 01:31PM
Location: Norway
Posts: 971
Yes, TI (Burr brown) have some voltage isolators, but they cost more than you want to know.

How about a PIC on the high side, sending digital data (RS232 or whatever) through an optocoupler to a PIC on the low side.

If you're programming it in assembly, feel free to PM me for help, I can't guarantee that I can answer all your questions, but I can try.


Anders M.
Back to top
Avalanche
Fri Jul 13 2007, 09:26PM
Avalanche Registered Member #103 Joined: Thu Feb 09 2006, 08:16PM
Location: Derby, UK
Posts: 845
Have a look at the LM331, it's a voltage to frequency converter that can provide simple a2d isolation through an opto-isolator. You can then use the pic to measure the frequency (using a pin set to 'interrupt-on-change') or just measure the pulse width to determine the voltage.
Back to top
Simon
Sat Jul 14 2007, 12:43AM
Simon Registered Member #32 Joined: Sat Feb 04 2006, 08:58AM
Location: Australia
Posts: 549
Thomas wrote ...

See the problem is that the max voltage is 1200V so I would need 11 bits.

Not necessarily. You'd be using a voltage divider to drop the voltage, right? It all depends on how much resolution and range you need.

Do you need it to know exactly what the voltage is if the voltage is below 300V? Or does that just mean you need to charge up?

Do you need 1V increments, or is the nearest 4V enough?
Back to top
Thomas
Sat Jul 14 2007, 06:54AM
Thomas Registered Member #120 Joined: Fri Feb 10 2006, 07:07AM
Location: Westchester New York
Posts: 83
Anders M. wrote ...

Yes, TI (Burr brown) have some voltage isolators, but they cost more than you want to know.

How about a PIC on the high side, sending digital data (RS232 or whatever) through an optocoupler to a PIC on the low side.

If you're programming it in assembly, feel free to PM me for help, I can't guarantee that I can answer all your questions, but I can try.


Anders M.

I think I'll go your way with a PIC18F2523. This chip has a 12 bit ADC module onboard so I can for sure get a xxxx resolution on it (between 0 - 1200). Then I would just send the date serially to the PIC16F877A in BCD formate (of course first converting to the 12 bits to 4 BCD digits). That way I would only have to isolate one line.

Also just to add if under 300V is entered I detach the 300 supply from the boost converter via relay and then bleed the bank till it reaches the voltage. Then if needed it will reengage the relay (connecting the circuit) to add a little more voltage and if more then 300V is added it activates the FET on the boost converter (enable pin on mosfet driver set by yet another phototransistor). I guess things will be turning on and off a lot cheesey I plan on using a solid state relay to alleviate me of the relay clicking sounds.

This should be a fun summer project I guess I will update my circuit now.
I found the TC14433 chip to be pretty cool though.

My other goal here is to have two circuits that are 100% isolated from one another. I want to make the user operated side detached from the capacitor dangerous side.

Thanks again everyone, I now feel much more confident in my design!
Back to top
Thomas
Sun Aug 12 2007, 03:59AM
Thomas Registered Member #120 Joined: Fri Feb 10 2006, 07:07AM
Location: Westchester New York
Posts: 83
I'm just about finished with the circuit boards (using express pcb) however I just realized that I might have a problem, since i'm isolating a chip that does serial communication. I have a feeling that my phototransistor might see fast clock speeds. But i'm not sure on how serial communication works. I'm driving my chips at 16MHz. Now I have a master and a slave since i'm using the most basic method (SPI).
My questions:
Now the clock for SPI goes in one direction from the master to the slave right? Also how fast would it's actual clock speed be? Those are just two of the things i don't know. Other wise the masters input connects to the slaves input and the masters output connects to the slaves input, no big deal there.

Thanks all!
Back to top
1 2 

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
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.