PDA

View Full Version : [Contest Entry] USB-Q, the automated BBQ Grill temperature control



elcray
09-13-2007, 05:05 PM
http://www.trossenrobotics.com/images/forums/2nd-Place.jpg (http://www.geekwithfire.com)

__________________________________________________ _____________
UPDATE: For more information on the status of this project visit us at:
www.geekwithfire.com (http://www.geekwithfire.com/)
__________________________________________________ _____________


My simple little project seems to pale in comparison to most of the folks work here, but here goes:

Project:
Automatically regulate the temperature on my BBQ smoker by constantly reading the internal pit temperature and making necessary adjustments to the damper; thereby increasing or reducing the inflow of air to fuel the charcoal/wood mix.

Details:
I/O: Phidgets 8/8/8 (http://www.trossenrobotics.com/store/p/5341-InterfaceKit-8-8-8.aspx)
Inputs: Standard Meat Probe Thermistor
Outputs: Phidgets Servo controller, Futaba Servo
Software: Custom VB.NET application

Software Process:
Thermistor generates resistance with temperature change. Temperature change is converted into voltage drop. Voltage drop is converted to temperature (via a calibrated lookup table in a database). Temperature is bounced off of a PID loop every seconds which makes needed adjustments to the servo position.

Benefits:
I am now able to sleep at night while my smoker is going on those long cooks (sometimes cooks up to 2o hours). As long as I keep fuel in it, it maintains temperature perfectly. If for some reason the temperature exceeds the adjustable threshold, an audible alarm will sound, notifying the operator of a required intervention. In addition, and not shown on the version of the video, I am able to set the desired temperature of the particular meat I am smoking. When the desired temperature is reached, the smoker shuts down, to avoid burning my dinner!

In addition to controlling the smoker, I also capture data points every 20 seconds so as to chart the accuracy of a long smoke (see the attached image; one of my original tests, that does have some large variations in temperature).

http://www.jegreer.com/images/forum/SM/temp1.jpg


http://www.youtube.com/watch?v=VgG6cYH72lo

http://www.youtube.com/watch?v=VgG6cYH72lo

Thank you for your consideration,

Josh Greer
www.geekwithfire.com (http://www.geekwithfire.com)

Alex
09-14-2007, 02:59 PM
That's a pretty sweet project Josh! It's simple in concept sure, but it fills an interesting niche. Great work! How much you selling these for:)

Thanks for the submission!

Dave
09-14-2007, 04:10 PM
Nice. If it allows you to cook a brisket without putting your life on hold for a day, I'm all for it. Just out of curiosity, what kind of smoker do you have?

elcray
09-14-2007, 05:20 PM
Alex:
I haven't settled on a price yet. All depends on if I ever quit tinkering with it! Right now I'm adding a "logical rules" process so the user can establish a logical cooking process based on feedback from various inputs. At the same time, I'm coding around the concept of controlling multiple smokers within the same instance of the program. With that said, I would love to be able to program around an unknown amount of phidget devices, but I just can't seem to figure it out. Yet, I plug away.

Dave:
The smoker is a Chargriller Pro, with the Side Fire Box; typically full of Royal Oak lump charcoal and 1 year old seasoned apple chunks from my personal orchard.

All:
Thanks for the comments.

Josh

Alex
09-17-2007, 09:50 AM
Alex:
All depends on if I ever quit tinkering with it! [...] I would love to be able to program around an unknown amount of phidget devices, but I just can't seem to figure it out.

I hear ya about tinkering! I'm always trying to perfect the applications that I build:)

About the "unknown amount of phidget devices"; I see that you are using VB.NET. Is this perhaps VB.NET 2005, or even VB.NET 2005 Express Edition? The reason why I ask is that I was working on what I called "Dynamic Phidgets" in C# 2005 a while back which used what are called Generics which are unique to Visual Studio 2005 and 2005 Express Edition.

The purpose of "Dynamic Phidgets" was to ignore how many Phidgets were connected to a single machine, and just keep storing them in a Generic Collection as they are attached and removing them when they were detached. Then, I can do what I want with them while they are active in the application I built.

Generics are incredibly powerful, and if you are not familar with them, I highly recommend on reading up on them here (http://www.15seconds.com/issue/031024.htm), here (http://www.codeproject.com/csharp/Generics_Explained.asp) and here (http://www.ondotnet.com/pub/a/dotnet/2005/06/20/generics.html). There are a ton of other examples, but this will help you get started in understanding them if you don't already. Sorry, but these are all C#, but if you understand VB.NET, you understand C#. All of the concepts are the same, the only difference is syntax.

Basically what I did to create Dynamic Phidgets is create a Generic Dictionary Phidget object with the key of the Dictionary being a long variable which will be the serial number of each Phidget:


private Dictionary<long, Phidgets.Phidget> phidgetDictionary = new Dictionary<long, Phidgets.Phidget>();Then, I created a new Phidget Manager object, and intialized it:


private void InitializePhidgetManager()
{
PM = new Phidgets.Manager();
PM.Attach += new Phidgets.Events.AttachEventHandler(PM_Attach);
PM.Detach += new Phidgets.Events.DetachEventHandler(PM_Detach);
PM.Error += new Phidgets.Events.ErrorEventHandler(PM_Error);
PM.open();
}The Phidget Manager object was necessary because you never know what type of Phidget a user connects to the computer and you need to account for this:)

Finally, I hooked the Attach and Detach events of the Phidget manager and ran checks to see if they existed in the Generic Dictionary Class. If they did/didn't I added/removed them respectively:



void PM_Detach(object sender, Phidgets.Events.DetachEventArgs e)
{
if (phidgetDictionary.ContainsKey(e.Device.SerialNumb er))
{
phidgetDictionary.Remove(e.Device.SerialNumber);
EventLogger.LogEvent("Object Deleted from Dictionary:" + e.Device.GetType().ToString() +
" Serial Number:" + e.Device.SerialNumber);
}
}

void PM_Attach(object sender, Phidgets.Events.AttachEventArgs e)
{
if (!phidgetDictionary.ContainsKey(e.Device.SerialNum ber))
{
phidgetDictionary.Add(e.Device.SerialNumber, e.Device);
EventLogger.LogEvent("Object created and added to Dictionary for:" + e.Device.GetType().ToString() +
" Serial Number:" + e.Device.SerialNumber);

e.Device.open();


e.Device.waitForAttachment(500);

}
}NOTE: I worked with Phidgets to get the e.Device returned as the actual object itself that it found. This way, you can run a check on the Type of Phidget object that was found and do what you need to with it:)

This will allow you to ignore the fact of how many Phidgets get connected to the computer. Then, you can simply roll through the Dictionary to find the Phidget objects you have added and do what you need to with them!

I hope all this made sense. Let me know if you have any questions:D

elcray
09-17-2007, 10:39 AM
Basically what I did to create Dynamic Phidgets[....clipped....]
I hope all this made sense. Let me know if you have any questions:D

Thanks Alex for all of the information. I'll read up on the 3 sites you mentioned and give it a shot.

Thanks again,

Josh

Alex
09-17-2007, 12:26 PM
No problem, good luck!

I had a little bit of a hard time wrapping my head around Generics at first, so don't hesitate to give me a shout if needed. Please keep these sort of questions though via email.

elcray
04-14-2008, 12:49 PM
No problem, good luck!

I had a little bit of a hard time wrapping my head around Generics at first, so don't hesitate to give me a shout if needed. Please keep these sort of questions though via email.

It's been a while since I've posted, but wanted to write an update on the status of my project; namely the process of adding an unlimited number of phidgets to a project at runtime. I read up on the topics listed above, and I'll be honest, much of it was above my head. I'm glad it was, because it forced me to start from scratch. I now have an application that will allow me to add an unilmited number of Thermocouples, InterfaceKits, and Servos by using Classes and Controls. I wrote Visual Studio UserControls for each of the items listed above. At runtime, I simply add the controls to the application, and assign the serial number. I still have much of the user interface to retool, but the infrastucture works very well. Because of the infrastructure change, I can operate an unlimited number of BBQ pits, using an unlimited number of servos, thermocouples, and thermistors. Here's a screenshot of the rough application update.

http://www.geekwithfire.com/Portals/0/BBQCC-2-Alpha1.jpg (http://www.geekwithfire.com)

Matt
04-14-2008, 04:34 PM
We are working on the new downloads area where there will be a section for demo apps / widgets. Would you be willing to post your Phidget controls in there for others to use? They would be a great tool for many others I'm thinking.

elcray
04-14-2008, 05:28 PM
We are working on the new downloads area where there will be a section for demo apps / widgets. Would you be willing to post your Phidget controls in there for others to use? They would be a great tool for many others I'm thinking.

Sure. Just let me know when you're ready. I will have to say, it's pretty basic stuff though. But maybe it might spark someone's imagination.

elcray
06-03-2008, 01:25 AM
One of the problems I had been dealing with, using the new interface shown a few posts above, was multiple UserControls reading from a single Phidgets Interface Kit; reading multiple sensor ports, for my thermistor probes.

My UserControls would try to reopen the interface kit and cause the application to bomb out because the kit was already open. To fix this, I created an interface kit control and dropp it on the main form when it attaches itself to the system using the process below. I hope it's not too much information, but hopefully it will save someone else some time in a future project:

First I created a Usercontrol that contains the interface kit inside the control. This allows me to drop the usercontrol on the main form at runtime. I just assign a serial number property to the control, and it opens the interfacekit. A Close property will unload the connection cleanly.
Next, In the main form, I used the Phidgets manager to detect when an IFkit was attached to the system. When it sees a new IFKit, it inserts the usercontrol and assigns the serial number to the appropriate property.

Private Sub PhManager_Attach(ByVal sender As Object, ByVal e As Phidgets.Events.AttachEventArgs) Handles PhManager.Attach
Select Case e.Device.Name
Case Is = "Phidget InterfaceKit 8/8/8"
Dim ctNewIFKIT As New IFKitControl
ctNewIFKIT.IKSerial = e.Device.SerialNumber.ToString
ctNewIFKIT.Name = "IFKit-" & e.Device.SerialNumber.ToString
AddHandler ctNewIFKIT.IKSensorUpdate, AddressOf ctNewIFKit_SensorUpdate
Me.Controls.Add(ctNewIFKIT)
End Select
End Sub
So, if 1 or more IFKits are attached, the following event will fire when the analog sensor is tripped:

Protected Sub ctNewIFKit_SensorUpdate(ByVal strSerial As String, ByVal intPort As Integer, ByVal intValue As Integer)
RaiseEvent UpdateSensors(strSerial, intPort, intValue)
End Sub
This allows me to handle an unlimited number of IFkits in my application.

Alex
06-04-2008, 08:55 AM
That is brilliant! I had never thought of creating a User Control IntefaceKit Object which is to be held in the Controls Collection of the Form:D:D I'll have to use this for my next Phidgets .NET project, thanks!

BTW, we totally spaced out and forgot to mention to you. We've completed the downloads section if you'd like to upload your project and the controls to it:

http://forums.trossenrobotics.com/downloads.php

elcray
06-05-2008, 02:49 PM
....[clipped]...BTW, we totally spaced out and forgot to mention to you. We've completed the downloads section if you'd like to upload your project and the controls to it:

http://forums.trossenrobotics.com/downloads.php

I just uploaded a small package with the interface kit wrapper and a sample main form. I only have 1 interface kit, so I haven't been able to test it on multiples. The concept works for servos, and thermocouple readers, so I'm assuming it works on IFK's as well. If someone could test that for me, I would be most appreciative.