Student Question on using a PID as a Dimmer to Control a Light Bulb!!! This is a fun one!!!!!!

I built my own temperature controller from scratch. I wrote code to linearize the thermocouple.* I built a diode-resistor network to serve as a synthetic cold junction. I wrote more code to decide on each cycle of the power line whether to switch the heater on for a complete cycle. My controller is built around a board with a Motorola (now Freescale)

68HC11 which has an 8-bit A-to-D converter. (New Micros NMIY 0020) Eight bits are not enough; I use an external 12-bit converter with a separate power supply that also reads the cold-junction compensator. I used parts from my collection when I could, including the 20-amp solid-state relay.

All told, the BOM parts cost of my controller is over $300. If you want a controller, buy from eBay. If you want to show yourself that you understand how to make a sweet one, build one. But that's a different project.

Jerry ___________________________________________

  • formatting link
    describes how.
Reply to
Jerry Avins
Loading thread data ...

See Jerry's comments on pricing -- if you can buy something that already does what you need it will have had every penny squeezed until it screamed. If you make it from parts you'll be paying for multiple instances of handling for each one of those parts, which makes it $$$.

Given all the questions you're asking about the technical side - if you really want to roll your own, just buy a basic stamp. It takes care of

90% of the processor issues, and leaves you only needing to deal with the PID stuff. Alternately, if you can stand the space taken up, use an old PC. I was going to say get one running DOS, but you may even be able to make this work in Windows. You'll still need to get the thermocouple information into the thing for less than $50, but it may be possible.

Even more alternately -- if your U has an electrical engineering department, post a notice on some bulletin boards to the effect that a Psych major is looking for an electrical engineering student to help out.

Anyway.

Any computer processor runs what's called 'machine language' -- it's the ones and zeros in the binary words that the computer reads in when it's running a program.

Assembly language ('asm') assigns a relatively easy to remember mnemonic to each machine word, and keeps track of things like addresses of data and code so you can give variables and jump points symbolic names like 'fred' or 'ginger' instead of $0b10 or $1234. You run your assembly language through a tool called an assembler, which turns it into machine code.

C is a 'higher level language' (some say not that high level) that allows you to type in something that looks much more like English, then translates those lines into machine code (or assembly code) that is then loaded (or assembled and loaded) into memory for a processor to run. Programmer productivity goes by line of code, pretty much, and each line of C generates 5 to 20 lines of assembly, so it increases your productivity a like amount.

There are many ways of implementing BASIC, but they all boil down to the fact that it is an interpreted language: the target computer stores what you wrote, more or less*. The target computer has a program running on it called an 'interpreter' which looks at what you wrote and pretends to be a processor who's machine code is BASIC.

Interpreted languages like BASIC (and Fourth, Jerry's favorite language) tend to be easy to learn and somewhat slower than compiled languages. Because of the slowness vs. ease of use tradeoff, they're often sneered at by 'professionals', but if they get the job done you can't complain.

  • Yes, advanced folks, I know about tokenization; I'm just not discussing it here.
Reply to
Tim Wescott

-- snip --

Ebay

Dunno, but with a total budget of $50 you may just not get there from here.

The nice thing about the PID loop is that your final accuracy is set by your measurement -- the integrator will take care of inaccuracies due to plant variations, external disturbances, or the oddities of using a photocell/lamp dimmer circuit. You may _have_ to use a photocell/dimmer circuit if you're going to keep it in the $50 range with a commercial controller -- otherwise you may have to use an analog PID implementation using op-amps, and then you'll need a really good caps in your integrator and differentiator, to keep track of changes over such long periods.

Reply to
Tim Wescott

Hi Everybody,

Its been a few days since I could continue with the project. I hada bio test that consumed all my time. Anyway, I bought a PID that can handle the job.

Can anyone describe what kind of phase angle SCR I need for a 0-10v input? I concerned with amps. Do I need a 10amp or 30amp? Is the answer to this question a function of the wattage of my light bulb (currently 35watts)??? They all seem to be 50/60hz... (why 50/60? whats that mean?)

Reply to
deriso

Power in the Americas and some other places is 60 Hz. In much of the rest of the world it is 50 Hz. The devices are able to work with either.

From a 120 volt supply, a 35-watt bulb draws 35.120 = .3 amps. The leakage current of a 30-amp unit will probably be (and from a 10-amp unit might be) too high for proper operation. 2 to 5 amps would be a good rating.

Jerry

Reply to
Jerry Avins

35/120
Reply to
Jerry Avins

The 10 amp unit is plenty. At 120 volts, this will control up to a

1200 watt heater.

It is a shame such a simple device is so expensive. Digikey sells a

15 amp version, 10PCV2415 for about $85.

Is the 35 watt bulb you intend to use as a heater rated for 120 volt operation, or is it a low voltage device?

Reply to
John Popelish

I found that Mouser sells the same relay for $68

formatting link

Reply to
John Popelish

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.