Shop OBEX P1 Docs P2 Docs Learn Events
Temperature Control — Parallax Forums

Temperature Control

4x5n4x5n Posts: 745
edited 2013-07-18 03:30 in Propeller 1
I'm looking to use a Propeller chip for a project that includes among other things temperature control of a water bath. I don't know that I need something as elaborate as PID control but it should be at least P or PI. Has anyone ever done this or know where I can go to find an algorithm?

Comments

  • SRLMSRLM Posts: 5,045
    edited 2011-08-28 20:58
    This thread is a good introduction to PID control, with sample code in PBasic that you can read easily enough and convert to Spin to fit your application.

    http://forums.parallax.com/showthread.php?77656-PID-Control-Intro-with-the-BASIC-Stamp
  • 4x5n4x5n Posts: 745
    edited 2011-08-29 09:01
    Time for another silly question. I just discovered the parallax processors and decided to use it for a project I'm working on. (It's a home processor for developing black and white film in case anyone here still uses film. In order to get consistent results temp control is important but not more important then consistent agitation, etc.)

    I started with the Basic Stamp because I saw it on the shelf at a local frys. I've since started puttering around with pbasic and while it's limited it seems rather efficient. I've been looking at the propeller over the last few days and think it may be better suited to what I'm looking to do. What I really like is the ability for it to easily interface with a keyboard and display. I have a development kit on order but haven't gotten it yet. How different is "spin" from pbasic?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-29 09:40
    PBasic is, of course, based on Basic. Spin is more related to programming languages like Pascal and Python. Spin is pretty easy to use once you get used to using indenting to mark the nesting of statements. The Propeller Education Kit tutorials are a good introduction to Spin.

    You might stick with your Basic Stamp for your controller. Your project doesn't require high speed nor large amounts of memory for variables. It's a good match for the Stamp. You can easily interface a Stamp to a 16-key keypad and a serial 20 x 4 display. If you want to use a TV display, you could use a Propeller Backpack with your Stamp using the display software that comes with it..
  • 4x5n4x5n Posts: 745
    edited 2011-08-29 11:13
    Mike,

    I haven't given up on the Basic Stamp. Reading over my last post I may not have been clear but there will be more going on then maintaining temperature. I also need to run a stepper motor for agitation according to a cycle that needs to be "written" (the cycle not the actual underlying program) by the end users. The cycle will consist of say three agitations and then delay 30 secs and repeat for 15 min. All doable by the Basic Stamp. I'm just afraid that I'm going to run out of capacity with the Basic Stamp by the time I get done with feature adds and improvements. Even the temperature needs to be adjustable. I may for now continue along parallel tracks and write code for both and see where it takes me.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-29 11:54
    Consider using a MemKey keyboard encoder. Parallax used to carry it. That (and the serial LCD) would make for an easy control interface. By storing your menu information using DATA statements, you could have a nice menu-driven interface without using a lot of Stamp program memory. You'd have a table in EEPROM with the menu item text, lower bound, upper bound, number of decimal places displayed (for a scaled decimal value). You'd use the A,B,C,D buttons for "previous item", "next item", "clear", and "enter". Any lines on the display after the 1st one would be used for displaying actual measured values like the bath temperature(s).

    If you want, you could add a DS1302 Real Time Clock although you could do the timing with just the Stamp given the long periods involved.

    On the other hand, everything could also be done with just a Propeller. How are you measuring the temperature(s)? What kind of display do you want to use? Why a stepper? A servo motor should be able to do the job too with less fuss. What are you agitating? ... a tank? ... a tray?
  • 4x5n4x5n Posts: 745
    edited 2011-08-29 17:27
    More likely then not I'll be using an lm34 and an A/D or a thermocouple and A/D. I haven't made up my mind yet. I'm leaning towards using an lm34 in epoxy. I plan on making a couple of processors.

    The first is a rotary processor intended to replace my Jobo CPP (they're not being made anymore and when they come up for sale on ebay go for $2,000+!!) That means spinning a tank 75rpm for 2 revolutions stopping and 2 revolutions the other way. The servos I've seen from parallax don't spin fast enough or have nearly enough torque! A high torque stepper is cheap and can spin at 75rpm without any gearing. The lack of a gear drive means that there's less to go wrong and break.

    The second model will rock a tank. The users of this processor will need to be able to adjust the development cycle. The standard Kodak recommended method is to agitate for the first 30sec and then 5 sec every 30 sec. I process film using semi-stand meaning I agitate for the first 30 sec and then three agitations every 3 min. The plan here is also to use a stepper motor with a cam to provide the rocking motion.

    Although the market is small and shrinking I do hope to be able sell these processors. That means price is important and aside from the room for growth the propeller over the the Basic Stamp (such as the ability to add a keyboard and display) is the price of the proto board over the Basic Stamp. I know that a PIC is a lot cheaper per unit they have the disadvantage of higher initial costs as well as complexity in getting them on a board and usable. By my back of the envelope calculations I can get the total cost of the controls with motor, heater and power supply for just over $100. At that point a couple of dollars more for the microcontroller isn't significant.
  • ClaiudiuClaiudiu Posts: 13
    edited 2013-07-16 06:20
    Hey, check this out. it`s kinda the same like propeller
    http://youtu.be/imJc_reASCE
    Don`t forget to turn captions on!
  • FernandFernand Posts: 83
    edited 2013-07-18 03:30
    No idea how experienced you are with what, that plays a big role. The Prop has the Obex library, and it's a lot more powerful, and this is a Prop forum, but honestly it's hard to beat the Arduinos for cheap hardware and available code. Have you looked at them? If you're not making your own boards, and cost is a concern, a complete Arduino board (from Mini to Nano to Uno) with A/D, PWM D/A, serial, USB, RAM, EEPROM etc is now just over $10. Look on e-bay. There are compatible Chinese sensors and subsystems and displays of all sorts that practically snap together with sample Arduino code. The Arduinos are all programmed in the same simple C, no harder than BASIC, and there is probably more example code with discussions than for any other microcontroller system. For quick results close to the metal, with sensors, motors etc, but without really complex real-time processing, or fancy displays and graphics, and without creating your own boards, the Arduinos are great. There are PID algorithms and discussions galore. The Prop has advantages, like the ViewPort debugger is awesome. Spin is its own thing, learning curve and all. If you plan to make your own boards, the $7 Prop gets very attractive, and you can put exactly what you need on your board. If you plan to drive a full screen with GUI and network interface, it's a different matter again.
Sign In or Register to comment.