Author Topic: My Fully Automated Huky!  (Read 28751 times)

Offline Agrajag

  • Newbie
  • *
  • Solid or Perf: Solid
  • J or T : J
My Fully Automated Huky!
« on: June 03, 2016, 06:17:05 PM »
After getting my DC fan controlled by artisan and logging stove pressure I had a thought - what if I could control the gas as well? This was turning into more of a "could I" rather than "should I", but sounded like fun. Again, I didn't want to muck around with installing anything in the gas lines, so wondered if the knob could be controlled with a stepper motor? For those who don't know, a stepper motor is just a motor that can be accurately controlled. The torque required to turn the knob is very low, so I did some research and found you can get a small stepper motor for about $2. The knob on the gas can easily be taken off and adding a gear pulley to the shaft required no modifications. The gear pulleys + belt were found on ebay for about $15.



Hooked up to my arduino (lucky I got a mega, it now has 2 thermocouple interfaces, drives fan and motor) I wrote the program to control it that artisan could call. The result is this:



https://youtu.be/AjYLSC1JGC8

:D :D (yeah the control box is still in "prototype stage". And I'm no woodworker :-[)

I then had a poke around artisan (the documentation leaves a bit to be desired) and found that by using the Alarms functionality, I could set fan/stove at certain times during the roast. This is pretty powerful. This means I can have a Fully Automated Roast! For example, here's a set of alarms that are setup to follow Gregr's guide to achieving a Rao Curve:



Now all I have to do is load/drop the beans! Oh yeah.. and find that "god roast".

Offline Crzyworm623

  • Newbie
  • *
  • Solid or Perf: Perforated
  • Serial Number: 958
  • J or T : T
Re: My Fully Automated Huky!
« Reply #1 on: June 04, 2016, 04:46:41 AM »
that's pretty neat.  seems like it would be good for guys roasting for small scale sales.  Figure out a profile then automate it for repeatable roasts.

Offline Agrajag

  • Newbie
  • *
  • Solid or Perf: Solid
  • J or T : J
Re: My Fully Automated Huky!
« Reply #2 on: June 04, 2016, 04:58:45 AM »
Yeah, it's also useful even just using it by pressing the buttons as artisan is then logging it accurately as well. It also opens up the doors of being able to automatically follow a given profile, adjusting power/fan as appropriate. That would require some smarter software though, would be an interesting project.

Offline rawman

  • Full Member
  • ***
  • Solid or Perf: Starting with perforated but I have a solid as well
  • Serial Number: 842
  • J or T : T
Re: My Fully Automated Huky!
« Reply #3 on: June 06, 2016, 03:06:21 PM »
Nice.  I knew it could be done with an Arduino.  Now all you need to do is add the drum speed controller as well.  I have an external motor controller hooked to an arduino but haven't integrated it into Artisan yet

Offline Seion

  • Newbie
  • *
  • Solid or Perf: SOLID
  • Serial Number: 977
  • J or T : T
Re: My Fully Automated Huky!
« Reply #4 on: June 07, 2016, 09:56:38 AM »
Very cool, thanks for posting this!

Offline Agrajag

  • Newbie
  • *
  • Solid or Perf: Solid
  • J or T : J
Re: My Fully Automated Huky!
« Reply #5 on: June 07, 2016, 03:49:34 PM »
Now all you need to do is add the drum speed controller as well.
Hah. I'm still learning how to use the huky well, I don't want to introduce another variable.. yet!

Offline phischmi

  • Jr. Member
  • **
  • Solid or Perf: Solid
  • Serial Number: 693
  • J or T : T
  • Charge Weight : 333g
Re: My Fully Automated Huky!
« Reply #6 on: July 07, 2016, 03:54:45 AM »
Hi Agrajag,

great work 8)

I'm also playing aroung with an Arduino + stepper motor but am still at the very beginning ::)

Can you give some more information on how to adress the Arduino from within Artisan?

How do you pass variables (i.e. position of the stepper motor) to the appropriate Arduino sketch?

In your setup, it looks like you're using some kind of python-script, do you?


Best regards!

Philipp

Offline Agrajag

  • Newbie
  • *
  • Solid or Perf: Solid
  • J or T : J
Re: My Fully Automated Huky!
« Reply #7 on: July 07, 2016, 04:40:05 AM »
G'day Philipp, I have just committed my scripts here:

https://github.com/phil-nelson/hukyroaster

Quick explanation:

artisanprog.py - This is the script that I have artisan configured to call for reading from the TCs as well as controlling the motor and fan. The arguments to this script tell it what to do, e.g. for the fan slider I have "Action" as "Call program" and the command is "artisanprog.py FAN {}" - telling artisanprog.py to set the fan to the slider value. This program sends the command to arduinoCommunicator.py

arduinoCommunicator.py - This is the program that actually communicates with the arduino. It uses FIFOs (named pipes) for IPC to receive commands from artisanprog.py. I did it this way because artisan may call the external program from different threads and it's nicer to just have the one serial connection permanently open to the arduino instead of a bunch of different connections which will have race conditions.

calibrateStoveMotor.py - This is for calibrating/saving the motor positions for each kPa value that I use. I ended up rewriting this as a small web app in the web/ directory because the interface is faster to use

web/ - php/js scripts to do the same as above.

Hopefully these scripts are fairly self explanatory but I'm happy to explain further if you have any questions.

Offline phischmi

  • Jr. Member
  • **
  • Solid or Perf: Solid
  • Serial Number: 693
  • J or T : T
  • Charge Weight : 333g
Re: My Fully Automated Huky!
« Reply #8 on: July 07, 2016, 06:16:23 AM »
Thank you very much! :)

That'll let me get a first idea of what to do. Anyway i think there's much to learn, but i'm looking forward to it  ;D

I'll take a closer look at those scripts at the weekend.


Regards

Philipp

Offline phischmi

  • Jr. Member
  • **
  • Solid or Perf: Solid
  • Serial Number: 693
  • J or T : T
  • Charge Weight : 333g
Re: My Fully Automated Huky!
« Reply #9 on: July 08, 2016, 05:07:59 AM »
One more thing :)

How did you implement the fan speed control? Did you replace the original fan by an DC fan and use PWM or what's your approach?


Regards

Philipp


*edit*

Just found this topic

https://www.hukyforum.com/index.php?action=bookmarks;sa=add;topic=408;b41986f6a6=e202e824f40142a0de146b5d07219d16

Thanks anyway ;D
« Last Edit: July 08, 2016, 06:43:46 AM by phischmi »

Offline phischmi

  • Jr. Member
  • **
  • Solid or Perf: Solid
  • Serial Number: 693
  • J or T : T
  • Charge Weight : 333g
Re: My Fully Automated Huky!
« Reply #10 on: July 10, 2016, 01:30:20 PM »
@Agrajag

Wouldn't it also be possible to choose "serial command" in the events tab in Artisan and send a value directly to the Arduino? Just wondering... :)

Offline phischmi

  • Jr. Member
  • **
  • Solid or Perf: Solid
  • Serial Number: 693
  • J or T : T
  • Charge Weight : 333g
Re: My Fully Automated Huky!
« Reply #11 on: July 12, 2016, 11:08:43 AM »
Hi @Agrajag,

i did some scripting the last days inspired by your code.
This is the result:
Code: [Select]
#!/usr/bin/env python3

import sys
import time
import serial
 
PORT = '/dev/tty.usbmodemFA131'
 
with serial.Serial(PORT, 9600) as arduino:
    time.sleep(2)
    arduino.write(sys.argv[1].encode('ASCII'))
    print(arduino.readline())

The corresponding Arduino-Code sets a fan to the desired speed - just for testing purposes.
Works like a charm when called from within Terminal :)

Next a tried to call the script from within Artisan, but sadly nothing happens. Not even an error message :-\
I chmodded the script executable and made the call like shown in the attached screenshot.

What am i doing wrong? Have i missed something?

Thanks a lot for your help!

Philipp
« Last Edit: July 12, 2016, 11:10:53 AM by phischmi »

Offline Agrajag

  • Newbie
  • *
  • Solid or Perf: Solid
  • J or T : J
Re: My Fully Automated Huky!
« Reply #12 on: July 12, 2016, 02:52:31 PM »
@Agrajag

Wouldn't it also be possible to choose "serial command" in the events tab in Artisan and send a value directly to the Arduino? Just wondering... :)

Yeah you probably could, however I couldn't find documentation on how the serial command works. Also if you need to do any other conversion (like how I save the kPa values as motor positions) you'd need to do that on the arduino side which is harder.

Next a tried to call the script from within Artisan, but sadly nothing happens. Not even an error message :-\
Hard to say from just that - if you run artisan in a terminal window you'll probably see any errors there (your python code inherits its stdin/stdout) when it tries to run your script - give that a go?

Offline phischmi

  • Jr. Member
  • **
  • Solid or Perf: Solid
  • Serial Number: 693
  • J or T : T
  • Charge Weight : 333g
Re: My Fully Automated Huky!
« Reply #13 on: July 12, 2016, 10:27:53 PM »
Hey,

thanks for that hint!

I fired up Artisan using the executable in ./Artisan.app/Contents/MacOS/

When hit one of the defined buttons i get an error saying, Python crashed.

This is the message from the Terminal:

Code: [Select]
Last login: Wed Jul 13 07:21:46 on ttys000
Philipps-Air:~ philipp$ /Applications/Artisan.app/Contents/MacOS/Artisan ; exit;
Jul 13 07:22:20  Artisan[40170] <Notice>: /Applications/Artisan.app/Contents/Resources/lib/python2.7/site-packages.zip/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
Jul 13 07:22:57  Artisan[40170] <Notice>: Fatal Python error: Py_Initialize: unable to load the file system codec
Jul 13 07:22:57  Artisan[40170] <Notice>: ImportError: No module named 'encodings'
Jul 13 07:22:57  Artisan[40170] <Notice>:
Jul 13 07:22:57  Artisan[40170] <Notice>: Current thread 0x00007fff73660000 (most recent call first):

May there be a problem, because i'm using Python 3 and Artisan seems to still be using Python 2?

Offline Agrajag

  • Newbie
  • *
  • Solid or Perf: Solid
  • J or T : J
Re: My Fully Automated Huky!
« Reply #14 on: July 12, 2016, 10:49:11 PM »
May there be a problem, because i'm using Python 3 and Artisan seems to still be using Python 2?

Yeah that's quite possible, strange though since your shebang uses python3. Perhaps try python2 and see how you go. I don't know how artisan is actually calling the external program. I once had a look at artisan's source code and was horrified to find it's all in one massive ~2MB .py file (what a mess!) and gave up.

 

Resources

PRICING and FAQs

ARTISAN RESOURCES

PHIDGET INFORMATION

ROASTING GUIDES

ROASTING TERMINOLOGY

GREENS SOURCES

A FEW VIDEOS

Temperature Converter

Celsius:
Fahrenheit:
Kelvin:

Recent Topics

Rob Hoos article on Thermocouples by SusanJoM
August 31, 2017, 02:52:23 PM

CFM range for exhaust fan by edtbjon
August 30, 2017, 08:13:09 PM

Standard Stove - any ideas what to substitute it with at the European market? by hankua
August 30, 2017, 08:07:16 AM

Just Purchased, Hello from Claymont, DE! by hankua
August 30, 2017, 07:57:21 AM

Hello from Melbourne, Australia! by hankua
August 30, 2017, 07:55:07 AM

New to Roasting (opportunity to buy a Huky) by hankua
August 30, 2017, 07:52:18 AM

Hello from South Korea! by K.Brown
August 30, 2017, 05:40:09 AM

First Roast with Artisan, Feedback Appreciated by edtbjon
August 28, 2017, 04:17:34 AM

And another checklist to validate… by SusanJoM
August 25, 2017, 09:15:43 AM

Estimated Cost after Mods and Tools For Maintenance etc. etc. by edtbjon
August 25, 2017, 01:46:56 AM

Phidget 1048 Temperature() [Error 126] by MasterKraus
August 23, 2017, 06:41:08 PM

Any ordering at MLGP by jay
August 22, 2017, 06:44:05 AM

Powered by EzPortal