topbanner.gif
Login
Username

Password




Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Shoutbox
You must login to post a message.

07/24/2021 2:58 AM
welcome cup Danny

07/21/2021 3:00 AM
Welcome RoastedRight

07/18/2021 3:06 AM
Welcome to darkbrew, carl1961 and vitor !

07/17/2021 4:30 PM
Welcome Skin Destination AND Timberline

07/16/2021 3:10 AM
Welcome to callmejohn and axissolutions !

In Memory Of Ginny
Donations

Latest Donations
JackH - 25.00
snwcmpr - 10.00
Anonymous - 2.00
Anonymous - 5.00
Anonymous - 5.00
Users Online
Guests Online: 12

Members Online: 0

Total Members: 7,257
Newest Member: Danny

View Thread

Who is here? 1 guest(s)
 Print Thread
Connecting a raspberry pi to artists scope: no readings...
zamunda
Hello renatoa,

Thank you very much, this helps me a lot!

So if I understand you right, I could do something like this (see screenshot):
- Once the "ON"-button is clicked, the script "passBT.sh" is triggered and receives the BT value?

How should I pass the BT-value (dynamically) to the script?

Thanks again!
zamunda attached the following image:
screen_shot_2021-06-20_at_204729.png
renatoa
Hmmm... the ON button is pressed only once, do you want to receive BT value every second ?

Did you read here the whole story on this Events subject?
https://artisan-s...cs/events/
zamunda
Hello renatoa,

Thanks for that!

I'll definitively have to study that since Artisan might have solutions ready under the hood I was not aware of.
Let you know how it goes!

Thanks again and regards,
zamunda
Hello,

I made some progress with the RP4 set-up with Artisan running on it:

1) First of all, I connected a AC-solid-state relay to my RP in order to be able to control external devices like fan and heater from my Pie. I used the scheme I found here: https://coffeehacks.blogspot.com/2016/02/electric-lights-and-fire-elf-raspberry.html for the relay part. Then I connected a bulb to the relay for testing and this worked. I could set the bulb to "on" with a Python script from the shell.

2) Next step was to trigger this script from within Artisan and trigger it fe with an "Alarm" if the BT arrives above a certain temperature. This also works: during "roast" when the probe gets hotter then 26C, the bulb lights up

3) Then the following step would be that the same script could pick up the BT at a certain moment with fe:
/home/pi/serial/bulb-on.py {~Y1}
where "bulb-on.py" is the script which gets triggered as soon BT >26 and "{~Y1}" would be the argument holding the actual BT (which should be close to 26C).

The last step does not work yet, "{~Y1}" seems to be empty, isn't this the prober way of passing BT to a script?
What do I miss here?

Please find attached images of the diagram and scripts I used...

Thanks in advance!

Regards,
Bert

#!/usr/bin/python3

ACPin = 19

# importeer de GPIO bibliotheek.
import RPi.GPIO as GPIO
import sys

# Zet de pinmode op Broadcom SOC.
GPIO.setmode(GPIO.BCM)
# Zet waarschuwingen uit.
GPIO.setwarnings(False)

# Zet de GPIO pin als uitgang.
GPIO.setup(ACPin, GPIO.OUT)

# Zet de LED uit.
GPIO.output(ACPin,True)

# To test the value of a pin use the .input method
channel_is_on = GPIO.input(ACPin) # Returns 0 if OFF or 1 if ON

if channel_is_on==1:
print("Bulb is on")
elif channel_is_on==0:
print("Bulb is off ")

# total arguments
n = len(sys.argv)
print("Total arguments passed:", n)

# Arguments passed
print("\nName of Python script:", sys.argv[0])

#Write BT to a file
a_bt = sys.argv[1]
file = open("BT.txt", "w")
str_bt = repr(a_bt)
file.write("BT = " + str_bt + "\n")
file.close()
zamunda attached the following images:
roaster_schematic.png bbb.jpeg

Edited by zamunda on 06/25/2021 12:17 PM
zamunda
Could not add this image to the previous post somehow:
Edited by zamunda on 06/25/2021 9:47 AM
zamunda
Hello,

I would like to replace me dedicated device for temp-reading (Voltcraft 125-4) by these sensors (https://www.bitsandparts.nl/Thermocouple-Thermokoppel-versterker-MAX6675-breakout-board-SPI-p115827).

I connected the 2 MAX6675 to my Raspberry Py and I am able to read the temps within a Python proram.
Now I want to display these temps within Artisan so I changed under Config->Device->Meter to Config->Device->Prog and then pointed there to the Python script:
#!/usr/bin/python2.7

# before import the max6675, you must save the max6675.py file at "/usr/lib/python2.7/dist-packages"

# wiring
# Raspberry MAX6675
# GND ------ GND
# 5V ------ VCC
# pin 18 ------ SCK
# pin 22 ------ CS
# pin 16 ------ SO

# import max6675 module.
import max6675

# set the pin for communicate with MAX6675
cs = 22
sck = 18
so = 16

# max6675.set_pin(CS, SCK, SO, unit) [unit : 0 - raw, 1 - Celsius, 2 - Fahrenheit]
max6675.set_pin(cs, sck, so, 1)

try:
while 1:
# read temperature connected at CS 22
a = max6675.read_temp(cs)

# print temperature
print a

# when there are some errors with sensor, it return "-" sign and CS pin number
# in this case it returns "-22"

max6675.time.sleep(3)

except KeyboardInterrupt:
pass

However, how do I hand this temp over to Artisan? Pointing to the script is not enough I guess since the script should at least run in the background while running Artisan as well but I did not get any further...
Any suggestions/pointers?

Thanks in advance!
zamunda attached the following image:
screenshot_2021-06-29_at_122402.png
renatoa
Please, check others similar experiences here:

www.home-barista....58234.html
zamunda
Hallo renatoa,

SUCCES!!!

Thanks for this link, I looked at it and saw that most of them are using it with Arduino but I would was looking for a Raspberry Pi-only solution. However, I noticed there that combining the program with MODBUS config might work.

So I figured out how to write the temp from the program to the serial port and read it within Artisan by configuring the port under the MODBUS-tab...

The working program looks now as follows:

#!/usr/bin/python2.7

# before import the max6675, you must save the max6675.py file at "/usr/lib/python2.7/dist-packages"

# wiring
# Raspberry MAX6675
# GND ------ GND
# 5V ------ VCC
# pin 18 ------ SCK
# pin 22 ------ CS
# pin 16 ------ SO

# import max6675 module.
import max6675
#import serial module
import serial

# set the pin for communicate with MAX6675
cs = 22
sck = 18
so = 16

# max6675.set_pin(CS, SCK, SO, unit) [unit : 0 - raw, 1 - Celsius, 2 - Fahrenheit]
max6675.set_pin(cs, sck, so, 1)

try:
while 1:
# read temperature connected at CS 22
a = max6675.read_temp(cs)

# print temperature
print a
ser = serial.Serial('/dev/ttyAMA0') # open serial port
#print(ser.name) # check which port was really used
ser.write(a) # write a string
ser.close() # close port

# when there are some errors with sensor, it return "-" sign and CS pin number
# in this case it returns "-22"

max6675.time.sleep(3)

except KeyboardInterrupt:
pass


Thanks again!
zamunda attached the following images:
screen_shot_2021-06-29_at_163108.png screen_shot_2021-06-29_at_163033.png

Edited by zamunda on 06/29/2021 9:41 AM
zamunda
Hello

Taking it a step further, how does Artisan expect to receive the data for 2 probes from the serial port, comma-separated like this:
23,28
???
Tried this but did not work, any hints?

Thanks
renatoa
From the serial port Artisan expects to receive them packed in various ways, depending on the device protocol.
The most popular is TC4 I guess... so you should try to emulate a TC4 board, in order to be able to send something to Artisan.
Artisan send a READ command, and the device should reply instantly, so you should have the values already acquired and processed, ready to build the packet.
The TC4 packet reads as below:
AT,ET,BT,3rdTC,4thTC,HTR,FAN,SP
where:
AT = ambient
HTR,FAN = actual values, could be different than Artisan thinks they are, the hardware could have it's own reasoning... for example a heater cutoff when fan is under a given value.
SP = PID setpoint, if PID active

Temperature values should be scaled in the hardware to the units used by Artisan.
Or viceversa, Artisan units set to match the hardware.

One more (mandatory) thing, is a small handshake at the beginning of every roast... it consist of three commands, sent by Artisan, that the board should execute (or try to mimic this), and reply with a # sign, else Artisan will abandon and never sends READ commands.
The three commands are: FILT, CHAN and UNITS.
For a complete syntax, you can find the whole commands list here:
https://github.co...mmands.txt

Possible to be devices with simpler protocol, but not investigated.
Edited by renatoa on 06/29/2021 12:12 PM
renatoa
One more notice... sincerely I am seriously puzzled why the RasPI version on Artisan see the serial devices as ModBUS things, because ModBUS protocol is one of the many ways a serial device can communicate, and is not simple at all... actually is the most complicate I know in this world of instrumentation communication.
TC4 protocol is far more simpler, and also the various digital usb meters, as is Mastech MS6514, aren't related to ModBus way at all...
zamunda

Quote

renatoa wrote:

From the serial port Artisan expects to receive them packed in various ways, depending on the device protocol.
The most popular is TC4 I guess... so you should try to emulate a TC4 board, in order to be able to send something to Artisan.
Artisan send a READ command, and the device should reply instantly, so you should have the values already acquired and processed, ready to build the packet.
The TC4 packet reads as below:
AT,ET,BT,3rdTC,4thTC,HTR,FAN,SP
where:
AT = ambient
HTR,FAN = actual values, could be different than Artisan thinks they are, the hardware could have it's own reasoning... for example a heater cutoff when fan is under a given value.
SP = PID setpoint, if PID active

Temperature values should be scaled in the hardware to the units used by Artisan.
Or viceversa, Artisan units set to match the hardware.

One more (mandatory) thing, is a small handshake at the beginning of every roast... it consist of three commands, sent by Artisan, that the board should execute (or try to mimic this), and reply with a # sign, else Artisan will abandon and never sends READ commands.
The three commands are: FILT, CHAN and UNITS.
For a complete syntax, you can find the whole commands list here:
https://github.co...mmands.txt

Possible to be devices with simpler protocol, but not investigated.


Hello renatoa,
Thank you for your elaborated answer...to be honest, I was not aware that it is that complicated what I am trying to achieve:
since connecting one sensor from the RP to Artisan was quite straightforward, I hoped to be able to connect one for ET as well.
In fact, what I am trying to do is this:
https://www.youtube.com/watch?v=M-j_JZCX-OI
but then with the MAX6657

Do you see this still as feasible?
renatoa
Yes, should work, these chips are compatible and very close as code base.
grencardigan is user here, he knows better this stuff.

But one of his youtube comments reveal another thing you should be aware, this approach is somewhat a dead end:

Quote

I had issues getting phase angle control of an AC fan so gave up.


In a different way, I found the same thing long time ago... tethered roasting could be more annoying than should be... so I found my way to have successful roasts without Artisan around.
renatoa
Yes, should work, these chips are compatible and very close as code base.
grencardigan is user here, he knows better this stuff.

But one of his youtube comments reveal another thing you should be aware, this approach is somewhat a dead end:

Quote

I had issues getting phase angle control of an AC fan so gave up.


In a different way, I found the same thing long time ago... tethered roasting could be more annoying than should be... so I found my way to have successful roasts without Artisan around.
greencardigan
Hi, yes that's my video.

I was trying to eliminate the TC4 and Arduino from my Rpi <-> Arduino <-> TC4 setup.

It was a while ago now so I don't recall all the details required to get it working. But a few vague memories are below.

- The script might need to be made executable so it can be called from Artisan.
- The script just needs to output the two temp values comma separated using a print statement.
- The temps are the only thing that should be output from the script.
- It shouldn't require serial or modbus.
greencardigan

Quote

renatoa wrote:

But one of his youtube comments reveal another thing you should be aware, this approach is somewhat a dead end:

Quote

I had issues getting phase angle control of an AC fan so gave up.



I think this comment was referring to the fact I could not get any of the available PWM to AC dimming boards working properly at the time. The Pi can output PWM at whatever frequency desired, but it was the additional dimming boards that were the problem for me. I never figured out why and others seem to use the boards with no issues.
zamunda
Thanks renatoa and greencardigan for your replies:

I made it work for 2 sensors, connected 2 MAX6675 to the RP and adjusted the scripts as follows (concatenation of vars did not work out somehow):

...
try:
while 1:
# read temperature connected at CS 22
et = max6675.read_temp(cs)
bt = max6675.read_temp(cs2)

# print temperatures
print et
print ','
print bt

ser = serial.Serial('/dev/ttyAMA0') # open serial port
#print(ser.name) # check which port was really used
ser.write(et) # write a string
ser.write(',') # write a string
ser.write(bt) # write a string
ser.close() # close port

# when there are some errors with sensor, it return "-" sign and CS pin number
# in this case it returns "-22"

max6675.time.sleep(0.4)

except KeyboardInterrupt:
pass
...

Now I get ET and BT readings within Artisan as expected. However, I have to leave in place both the serial and modbus-part, otherwise it does not work somehow, only the print statement is not enough.

Thanks again and keep you posted!

Regards
zamunda attached the following image:
screenshot_2021-06-30_at_100732.png
zamunda
Hello
I started playing with Events now, added a slider for Air Control and wrote a small test script:
/home/pi/serial/air.py

So at the Air-slider-> Call program:
/home/pi/serial/air.py {}

The test script logs the actual value of the slider to a file, so far, so good.

Now, if I add "{~Y1} as a second argument, I supposed that this would write the ET to the file as well:
/home/pi/serial/air.py {} {~Y1}

However, it gives me an error:
Exception: fireslideraction()'~Y1'

Isn't this the proper way of passing BT as an argument to a program or script?

Thanks in advance for any hint!



#!/usr/bin/python

import sys

af = sys.argv[1]
print sys.argv[1]

et = sys.argv[2]
print sys.argv[2]

f = open("/home/pi/serial/air.txt", "a")
f.write(af+",")
f.write(et+"\r\n")
f.close()
zamunda
Hello,

I have everything ready for show time: the Raspberry Pi, two thermocouples on the Pi measuring with Artisan, an Solid State realy for the heater and a (manual) DC control for the fan.
Measuring temps works perfect but as soon as I start the fan in combination with the probes on the Pi, temps become unstable/unreliable. Somehow, there is an interaction between the probes and the DC-controller (has no ground). The solid state for the heater does not disturb the probes.

Anyone seen this behaviour? Where does this come from? Is there a solution other than use a meter on the Pi instead of probes (MAX6675) directly on the Pi?

A big thanks as usuual!

Regards
greencardigan
Try grounding the roaster to the Pi ground?

Try insulating the thermocouples from the roaster body?
Jump to Forum:

Similar Threads

Thread Forum Replies Last Post
Using a TC4 with Artisan Roaster Scope Dataloggers/Controllers/Rate of Rise Meters 11 01/27/2021 10:56 AM
How to get accurate temp readings MY FIRST ROASTER 5 01/07/2021 2:29 AM
Connecting my popper to a variable voltage regulator? Popcorn Popper roasting 19 09/25/2020 1:01 PM
TC4 connect to Raspberry Pi Dataloggers/Controllers/Rate of Rise Meters 53 08/06/2019 6:45 PM
How do I get started with connecting my laptop to my roaster and profile roasting? And what is the c ROASTING SOFTWARE APPS 7 08/13/2018 1:21 PM
Homeroasters Association Logo, and all Content, Images, and Icons © 2005-2016 Homeroasters Association - Logos are the property of their respective owners.
Powered by PHP-Fusion Copyright © 2021 PHP-Fusion Inc
Released as free software without warranties under GNU Affero GPL v3
Designed with by NetriX