Microcontroller

Thread Starter

tryingtolearn

Joined Apr 4, 2010
17
Hello, I am just starting in microcontrollers and was wondering where would be a good starting point as far as chips/boards etc. I have been scouring the net and found a project that I would like to do as my ultimate goal. A microcontrolled thermostat with lcd display and adjustable set temps. Mine will vary slightly but in it he uses a PIC 18f1320 microcontroller. I have also seen several references to Arduino and I don't know if I should try as best to stay inline with his parts list and just study and build my way to a similar result or go with different parts? Any help or pointers would be much help to me. I am on no timeline as asked several times in other forums here I am just looking for the best place to start. Thanks.
 

eblc1388

Joined Nov 28, 2008
1,542
Before we offer suggestions to go for PIC or AVR(Arduino), you'll need to let us know about the following:

1. do you know some electronics knowledge so that you are comfortable and can play around with component on a breadboard?

2. what types of ports does your computer has? Parallel, serial, USB or a mix of them.

3. do you want to learn assembly language or prefer higher level language like Basic or C? Do you prepare to pay a reasonable sum of money for such choice or prefer a totally free software development system?

4. is sourcing the PIC or AVR a problem in the place where you live?
 

Tahmid

Joined Jul 2, 2008
343
Hi tryingtolearn,
Before you think of that project, start the basics of microcontroller.
1. Choose either PIC or AVR, I believe they are both equally capable microcontrollers, except maybe in price. Just depends on your choice.
2. Choose your programming language and compiler.
3. Choose your development kit (trainer board).
4. Choose your programmer (USB/serial/parallel) (original/clone).

Then grab a book, download the datasheet, application notes, code samples and reference manuals off the manufacturer's website and start learning. Once you think you are capable of coding with ADC, serial communication, LCD, PWM, Timers, Comparator, then only go for large projects as that you have mentioned.

Hope this helps.
Tahmid.
 

Markd77

Joined Sep 7, 2009
2,806
You can download a lot of the development tools for free to see how you get on with them. For example MPLAB IDE and sim from the Microchip website.
 

Thread Starter

tryingtolearn

Joined Apr 4, 2010
17
Thank you for all your replies. I will try to answer each question that was asked and hope I do not miss any.

eblc1388
1. I have some basic knowledge of electronics but as far as microcontrollers only what I've researched for the past week which compared to what they are capable of is fairly vague.

2. Serial, USB. No parallel as I decided against it when I built my comp.

3. As of right now I want to learn all I can. I've touched around c+ programming for computers. Very basic tho. I would probably want to start with something basic to learn and make my idea at hand start working and then progress from there. I have up to about $100 that I was planning to get the parts needed for my idea as well as parts and things to learn.

4. Correct, I will be doing all this at home.

Tahmid
1. I guess I will go with the PIC as that what my idea was based on from the one similar I found on the web. And that particular chip 18f1320 is what I have been doing my research around.

2. Language and compiler, not sure yet. I downloaded mplab ide to maybe play around but I have alot of learning to do lol. also I was looking at ICprog and Winpic800.

3. Not sure what you mean by trainer board, was going to use breadboard and stripboard for testing/learning.

4. As for the programmer board I was going to make this (http://www.obddiag.net/prog2455.html) and try to implement an onboard ICSP into my idea board to keep from having to remove the chip from the circuit and for future upgrades as I learn more. I just havent figured out if when I hook the programmer up to the built circuit if it will affect any of the other parts or if I should put jumpers on them to break them for when I attach my programmer?

Thank you for all of your comments and help.
 

eblc1388

Joined Nov 28, 2008
1,542
2. Serial, USB. No parallel as I decided against it when I built my comp.
Then start with PIC, using a Pickit2 or its clone programmer(search eBay for it) and the free MPLAB developement support from Microchip.

The Microchip C compiler student edition is also free but the optimization is disabled after one month. Your resultant code size will be somewhat larger but still a good one to use.

Do not start with AVR first as AVR has more gotchas than PIC to a beginner so I think PIC is better in this respect. An inexperience user, especially beginner, can configure a certain AVR fuse option unknowingly and the AVR chip become locked up, requiring other programming method to revive the chip.
 

Thread Starter

tryingtolearn

Joined Apr 4, 2010
17
Thanks for your help thus far. One more question tho and I will be off to experiment. For my temp sensor, I was going to use the DS18S20, but while scanning through the forums, someone referred another person to the DS1721. The accuracy seems a little better and it has a better temp resolution I think, my question is that the DS1721 has a high (Th) and low (Tl) setting that controls the relay itself (Tout), but if I want to use this circuit for heating instead of cooling as it seems on the data sheet could I used a low value for Th and a high value for Tl?

I'm asking this because I am trying to get a parts list ordered and don't want to have to spend and extra $10-$15 to get one part shipped.

Thanks.
 

eblc1388

Joined Nov 28, 2008
1,542
I want to use this circuit for heating instead of cooling as it seems on the data sheet could I used a low value for Th and a high value for Tl?
No. The value of Th must be higher than Tl to be logical and it does not matter if the process is heating or cooling.

If you want the Tout pin to change state, program the Th value accordingly. If you set it for say 25°C, then the pin will change state when 25°C is reached and this state will be held even if the temperature rises still higher. You can disable a relay for heating element when this happens.

You can also control when the Tout pin will revert back to the inactive state should the temperature falls by setting the Tl value. Say you have set it for 23°C, the Tout pin will not revert back until temperature falls below 23°C. The relay controlling the heating element will then turn back on again.

So at 24°C, the Tout pin may be active or may be not, depends on which way the temperature changes. This is called hysteresis and is there to prevent the relay operating frequently should the temperature changes slightly, say in case from 25.1°C back to 24.9°C.

The important concept here is one can use a state change to control other things. Whether the Tout pin voltage changes from high to low or low to high is immaterial. One can always arrange other circuit element like relays or contacts such that this state change can be used to operate/stop something.

Hope this help.
 

rjenkins

Joined Nov 6, 2005
1,013
I'd second the PIC series plus Pickit 2

The MPLab works well and allows full step by step program debugging while watching the registers and memory. It's a nice setup to use.
 

Thread Starter

tryingtolearn

Joined Apr 4, 2010
17
Thank you for your help as it is really much appreciated, but for some reason I do not think I understand. Sorry. I guess I could either hook the Tout to NO and let the heater run til it gets to say the 23C Th and then it will signal the relay to NC and turn the heater off. Or I guess I could learn the programming more and let my PIC control the relay based on the temp conversions of the sensor when it sends the read command. right? Thanks again. Sorry for seemingly simple questions.
 

t06afre

Joined May 11, 2009
5,934
It has been reported that some USB to serial converters do not work very well with PIC homemade hobbyist programmers. The PICKIT units work like a dream. And if you have to purchase parts for the programmer and a USB to RS232 converter. The cost of PICKIT unit will probably set you back less.
 

eblc1388

Joined Nov 28, 2008
1,542
Thank you for your help as it is really much appreciated, but for some reason I do not think I understand. Sorry. I guess I could either hook the Tout to NO and let the heater run til it gets to say the 23C Th and then it will signal the relay to NC and turn the heater off.
Sorry I can't explain it simpler. :(

When the Tout pin change state, say from low to high, you can use this level change to drive a relay from off to on(using a NPN transistor) or drive a relay from on to off(using a PNP transistor).

Then you can choose to use either the NO contact or the NC contact of the relay to control your heater. The choice is entirely up to you.
 

corsair

Joined Mar 6, 2010
51
btw, rjenkins, that book that tahmid suggested is extremely helpful. i ended up torrenting it, but it seriously can do the chewing for you and will spoon-feed you information. i just started learning the pic18f4550 2 months ago, and i feel like i've gotten pretty far on projects referencing that book a lot (and of course, google :D)

anyways, gl with ur project!
 

retched

Joined Dec 5, 2009
5,207
I think you may be confused on a controller and driver. The controller makes the decisions and the driver does the work. So when your Th pin is high (The voltage is a preset amount HIGHER then the low voltage which is usually ground(0v)) it can control a driver (like a transistor) to use its power to open or close a relay. That relay can do whatever you would like. It can turn an air cooler on, or a heating element on, OR it can turn an air cooler off or a heating element off. The point is, you are using the LOGIC levels to make decisions and then using those low power decisions to tell higher power devices what to do.

So, You have a device or program that says at 25deg or less make this pin 5v
At 26deg or more make this pin 0v

Now connected to that pin, you have a driver. The driver is hooked to a heating element.

... The temperature is 27deg...pin is low... driver doing nothing
temp 25.1 deg pin still low
temp 24deg now pin is high (5v) the driver takes the 5v signal and uses a transistor to switch a relay. The heating element is now on.

hope it helps.
 

Thread Starter

tryingtolearn

Joined Apr 4, 2010
17
Thanks for the tip on the book corsair. I didn't think about that. And thanks to everyone else for trying to help and explain things. I think for now I'm gonna take the time and do some studying and see what I can come up with. If I have anymore problems I will post again asking for help after I've exhausted all other means of self learning. I hate asking questions blindly without having tried to figure it out myself first. I think it makes people seem less intelligent for doing things like that. Thank you to everyone who has helped me. This forum is GREAT.
 
Top