Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Little thermostat, minor issue...

Status
Not open for further replies.

Greenpower dude

Newbie level 6
Joined
Jul 21, 2007
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
earth
Activity points
1,392
Hey guys and Gals!

I've been studying hard for uni and how that the holidays have started I've decided to get back on to building my thermostat for my fish tank. Now that I've been introduced to digital circuitry, I've decided to integrate some digital chips to replace analogue transistors, MOSFET's and capacitors to in my circuit design. The only problem is that each chip runs at a different voltage...

For example;
OPAMP:
+Vcc: 18V
-Vcc:-18V (?)-what does it need a negative 18V for?

ICM555:
+Vcc: 18V

74HC00,08, 76, 160
Vcc: 2V to 7V

I understand when an analogue chip is going to a digital chip I could put a 13V Zener diode between them to drop the voltage down, but from a digital to analogue chip I am not sure what to do.
Is there anyone out there with some advice?

Regards,
Geoff
 

Interesting questions Geoff.

Digital devices normally have two logic states so it makes sense to represent them as 'voltage' or 'no voltage' rather than two different absolute levels. With only two states, it doesn't make sense to use more than one supply line and to remain compatible with other digital devices it also makes sense for everyone to use the same 'logic high' voltage and 'logic low' voltage. There are exceptions but they are uncommon and certainly not applicable to your idea.

Analogue (analog) has to be able to take an infinite number of different voltages and it generally can't be said to be in a high state or low state in the way digital is described. The reason for negative supply rails is twofold, firstly there is nothing to stop an analog voltage being negative and if it is coming from the output of an op-amp, there has to be some source of that voltage for it's output stage to draw from. Secondly, amplifiers are normally linear (output is directly proportional to the input times an amplification factor) and because of there is a minimum voltage at which transistors behave themselves, producing output voltages very close to zero is difficult. Adding a negative supply line allows the output to be zero while the internal components still have plenty of voltage to operate them.

The voltages you mention look like 'absolute maximum' ratings for some devices. For example the 74xx series of digital devices normally runs from 5V or 3.3V, the '555 can run from 4.5V up to 18V and op-amps can run from anything from about 2.5V up to 50V, depending on the individual type.

If you need to drop voltages, a better and cheaper way is to use a potential divider, Zener diodes have some unwanted characteristics which makes them less suitable for logic level conversion. For example, if your logic gate draws very little input current, such as CMOS types, the leakage current through the Zener will make it ineffective and of course, Zener diodes work like ordinary diodes in the forward direction.

For your application, the simplest way forward would probably be to use a digital thermometer chip (DS18B20 for example) a simple microcontroller (PIC or AVR) and an LCD display. You can easily produce PWM signals to give continuous power control to the heater and keep the temperature stable and on display.

Brian.
 

OoOo... microcontroller.

How do you program them? Or should it already be somewhere in the datasheet?
I've been shown how to program AVR microprocessors at uni, but the chips was already in a pre-made housing that we only needed to plug our desktops, with the software installed, to get running.
 

Generally, there's no need to go digital with the design. If you want to avoid the overhead involved with microprocessors (software tools, programming adaptors), go for a classical analog PI or PID controller with a full wave PWM for the heater.

A microcontroller can provide more features (e.g. temperature display, alarms) with a smaller part count.
 

I think Greenpower dude wants to change from analog to digital, hence the questions about digital devices.

Digital has a lot of advantages in cost and functionality but you do have to go through the programming 'pain barrier'. In truth, it isn't at all difficult but if you are unfamiliar with solving problems in the digital domain, it can be daunting at first. The nice thing about the micro controller solution is you can make it do other clever things as well, while hardly adding anything more to the cost. For example, if you have lights over your tank you could switch them off or on with the same software that controls the temperature. If you did that in analog circuitry you would need two separate circuits.

If you choose to go this route, you will find the two most popular types of IC are the PIC series and the AT series. Both are extremely easy to use and free programming tools are available from their manufacturers. My personal preference is the PIC series but that's probably just because I've been using them for 20 years! You will find lots of support from other users here and on other forum systems.

Brian.
 

I've had a look at my project and have come to the decision to use a micro controller as it allows me to have a simpler (and cheaper), hands off approach in caring for the fish tank. I can also, if i wish, attach more components up to the tank and update the software accordingly as my fish tank is on my homework bench next to the computer.

I've got some programing experience, and am still going thought the so-called 'pain barrier' with middle grade programming. So I shouldn't have too much trouble with programming the chip.

I have checked out my local store and produced a small list of possible µC's. I'm going to have a brisk read thought the data sheets for them and come back with a decision on my chips as well as the code for it and see if anybody screams no.
 

Okay, the list of chips I feel are sufficient for my needs are the:
AT89C2051
PIC16C711
PIC16F628A
PIC16F84A

BTW, how do you program them? I've got ponyprog but I don't know what to do with it.
 

The 16F84A is quite old and more or less replaced by the 16F628A as it is pin compatible and almost software compatible. I wouldn't recommend the 84A for new designs.

Of the ones listed the easiest to use is probably the 16F628A but no doubt others will disagree. I have many designs based on that chip and can vouch for it's ease of use.

The steps you need to go through are:

1. make a list of things you want the controller to do and how many signals it takes to achieve them. For example, you probably want one pin for the temperature sensor signal, one for the heater control, probably 7 if you want to add and LCD display and so on. Don't forget you want at least two signals for setting the temperature you want.

2. Work out which pins on the IC are most suited to the application. For example, some pins may be able to read analog signals while some may not. Apart from functionality, the pin layout is up to you but it makes sense to group pins together for things like an LCD data bus so the bits don't come out of pins all over the place and on different electrical ports.

3. Plan exactly what you want the software to do. Spend lots of time on this. The more you plan ahead, the less time you will spend trying to debug it later. Programming should be 90% inspiration and 10% perspiration, not the other way around!

4. Decide on the language you want to use. There are trade-offs between the different ones which need consideration. Generally writing in 'C' or BASIC is less efficient and slower in running speed but quicker to develop. Assembly language may take longer but gives you absolute control of what goes on. Also consider that MPLAB from Microchip is free and an excellent assembly language development and debugging platform, most high level languages have a price tag.

5. The basic programming steps are:
a. assign sensible pin names in the program. It's much easier to write and understand something like 'heater = ON' than 'movxy reg05,73' even though they may be identical instructions.
b. Configure the pins to do their jobs, set them to be inputs, outputs or analog.
c. Set up internal registers inside the IC, for example timers and interrupts.
d. Your program will almost certainly repeat in a loop while things are checked and adjusted so establish a beginning point for the loop.
e. Code the routines to do each job and return to the start of the loop again when they are finished.

6. Simulate it. Almost all development tools have a simulator in them. Basically they model the operation of the IC in software so you can run your program on it and see that it behaves as you want it to. This will reveal most bugs and let you fix them before even buying a real IC.

7. When you are confident it should work, there is one last step to the programming. Most devices have configuration registers which can only be set during the process of writing to silicon. These are things like selecting the type of clock oscillator to use, if a watchdog timer is needed and so on. In other words things that need to be configured but shouldn't be under program control. For example, there is no point in changing from an internal to an external clock from inside the program as it would almost certainly crash the program with no way of recovering. You decide the configuration you need and either embed it in the main program if the platform lets you, or you manually set it in the programming hardware.

8. Go shopping!

9. You now have to transfer the program from your computer into the real IC. This requires some extra hardware which you can buy or build yourself. I use PIC devices so I use a PicKit2 which is inexpensive and can program virtually all PIC processors, and also a wide range of memory devices too. If you are only planning to build one project it is probably cheaper to build one yourself, there are many designs on Edaboard and elsewhere. If you are likely to progress onto other projects, save yourself the hassle and buy a PicKit or equivalent. The trouble with most of the DIY programmers is they will only work with a limited number of different devices and invariably, the one you want to use will not be supported.
The actual device programming is very easy, just plug the IC into the programmer, or attach the wires to the IC if a socket isn't present. Then load your hard work into the programming application and hit 'GO'. It only takes a few seconds to transfer the program into silicon and most devices these days will let you erase them and reprogram them them hundreds or even thousands of times so you get lots of tries if it doesn't work first time. (thank goodness!)

10. Final step. Try it in real hardware, you can always make changes and reprogram again if something isn't quite right or you want to modify or add features.

Good luck.
Brian.
 

This is a really cheap evaluation board, that has a programmer included on it.

It is a ST, so is not that popular as Microchip or Atmel, but for 7 dollars it's a very good option for you:

https://www.st.com/mcu/contentid-130-113-STM8S_DISCOVERY.html

I just received today and the quality looks great, I haven't done anything with it yet.
 

It's much easier to write and understand something like 'heater = ON' than 'movxy reg05,73' even though they may be identical instructions.

I fully agree...
:D

Is it possible to get a program that does it via USB?
 

Are there any trust worthy simulators available off the net for free?
 

If your earlier question about USB refers to the programming hardware, yes, the PicKit is USB powered and works in conjunction with a PC application. If you mean,"can I just connect a blank chip to a USB port to program it" the answer is no. Unfortunately, there has to be a program in the chip already called a 'boot loader' before you can do that.

Regarding simulators, if you program in PIC assembly language, the best simulator is already built into the MPLAB program which you can download free from www.microchip.com, I think most people would agree it is the best one around.

Again if you use PIC devices, but want to use a high level language, try the WIZ-C compiler and simulator from **broken link removed** which is extremely fast and easy to use, particularly if you use the built in application designer module. If you prefer BASIC, I found the best one to be from www.oshonsoft.com which is an excellent program generator but painfully slow when running simulations. Both of these are commercial programs but are low cost and have free trials, WIZ-C will only compile programs up to 2K in size and Oshonsoft impose a time limit of (I think) 30 days before needing to be registered. After registering they both have full capabilities.

Brian.
 

Are you sure all the parts of your engine were in good conditions? Try to check the parts if they were installed properly. If this advice did not work to go to the shop to be able to you to determine the cause of this problem.


_________________
Thermostat
 

If you mean,"can I just connect a blank chip to a USB port to program it" the answer is no. Unfortunately, there has to be a program in the chip already called a 'boot loader' before you can do that.
Atmel AT90USB series is shipped with a bootloader programmed to the flash.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top