Happy HolidaySs Giveaway - Last Sponsor Giveaway of the Year!

Come Enter the BrewDeals/FastFerment Giveaway!

Home Brew Forums > Home Brewing Beer > Automated Brewing Forum > Looking For Software Developer Input...
LinkBack Thread Tools
Old 08-10-2012, 12:12 PM   #11
/bɪər nərd/
Feedback Score: 1 reviews
MalFet's Avatar
Join Date: May 2010
Location: NYC / Kathmandu
Posts: 8,275
Liked 1267 Times on 844 Posts
Likes Given: 583


Originally Posted by jbrewkeggin View Post
I would recommend using AJAX so that your browser is being updated with the most recent data without a refresh; however, I'm not sure that this works with Apple's browser, Safari.
Ajax works fine with Safari, and has for years.

"Be excellent to each other." -Benjamin Franklin

MalFet is offline
Reply With Quote Quick reply to this message
Old 08-17-2012, 06:18 PM   #12
Feedback Score: 0 reviews
Join Date: Jan 2010
Location: MD
Posts: 54
Liked 1 Times on 1 Posts


Originally Posted by jpalarchio View Post
This is along the lines of what I'm thinking. The PID algorithm running on the Arduino is going to need more timely updates from the temperature sensors than I need logged. I don't need 5 billion data points logged during a brew session.

I was trying to avoid writing any type of client/server application and instead leverage existing technologies to make it sort of a web app; still doing a lot of reading there.

The single-threaded nature of the Arduino seems like it might squash some of my initial thoughts.

What I need to do on the Arduino is:

Listen For Action Command From Server (via sockets?) -> Get Current Temperatures -> Execute PID -> Upload Data To Server (via sockets?) -> REPEAT

What's not clear to me within this loop is when I'm waiting for actions from the server, how long do I wait and what does the server do as far as sending when I'm at a point where the Arduino is not listening.
What you are trying to do is typically done via socket io select on the server side (like with apache httpd for example)...

I don't know if the Arduino supports io select but you can build a loop that does similar in a serial nature. Basically you will listen on a socket (a tcp port) in a while 1 loop, when a connection is made you read data from the socket and process accordingly (you would have to com up with some type of cmd structure or protocol)

You need to decide who the client is in the conversation: IE who starts the conversation.

So here is a verbal representation of what I like you wan to do.

Arduino = Server

-> Client connects a port on server and sends a command
<- Server reads command, process, returns the process output to client and closes the connection
-> Client receives the data returned and logs it to a database

So something like this

-> open socket port 1234, write Hello World
<- read from socket port 1234, read Hello World , write World Hello
-> read from socket World Hello, write to database World Hello.
rpfuror is offline
Reply With Quote Quick reply to this message
Old 08-17-2012, 06:46 PM   #13
Feedback Score: 0 reviews
Join Date: Sep 2011
Location: Austin, Texas
Posts: 1,257
Liked 64 Times on 53 Posts
Likes Given: 1


Probably a little late to throw this out there but if you have a Microsoft/.NET background, Netduino will be much easier since it runs .net micro

As for your setup, you want separation of concerns in terms of the server and the controller so your controller can run all of the time and the server becomes the 'guiding hand' per se. That way your controller is 'disconnected' from the server so it can run regardless of any issues on the server-side.

I would architect it like this:

Arduino Mega
-- Runs brewery based on some type of config source that defines variables for the brewing routine (times, target temps, etc). The source needs to be local, read/writable via Ardunio and the server. Likely a USB stick on the Ardunio board?
-- Stick some folders on the USB stick; /logs (write logging data with Ardunio), /currentBrew (store your current brewery config here which Arduino will use to run the brewery)

-- Reads data from the /logs folder -- so it'll show temp data, times, etc.
-- Able to edit the configuration in the /currentBrew folder

Now Ardunio needs the ability to detect changes to the /currentBrew folder and apply those changes. If you want some type of validation that changes were processed by Ardunio correctly, you can use a /serverCommands folder to store commands for Ardunio to execute. As Ardunio iterates through the commands and successfully executes them, just remove the line from the file. When the line is gone, assume the command was processed.

While not an elegant architecture, Ardunio is very compartmentalized and never has to do any network functions at all other than open up the USB stick to the server. Flat text-file config and log files will make debugging a breeze. And your server doesn't have to do anything fancy but read a log file and write to a text file. Use jQuery mobile for the server UI and you'll have a mobile-ready 'brewery controller'.

Just a very rough overview. If you want some more input, feel free to contact me.

On Deck: Cornucopia Oktoberfest
Primary: Centennial Blonde v2, Ed Wort's Kolsch
Secondary: none
Kegged: County Jail Pale Ale, AHS Anniv IPA, AHS Brooklyn Brown, Raspberry Wheat, Blood Orange Hefe, Ranger IPA clone (x2), Newcastle clone, AHS Irish Red, Centennial Blonde
Bottled: Session Series Belgian Saison, Apocalypso, Pecan Porter, DFH 90 Minute Clone, Apfelwein (x2), Wytchmaker Rye IPA Clone, Vienna/Simcoe SMaSH, Munich/Cascade SMaSH
rhamilton is offline
Reply With Quote Quick reply to this message

Quick Reply
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Software to control brewing process btbonser Automated Brewing Forum 18 07-08-2012 06:42 AM

Newest Threads