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.

allenb
11/28/2023 6:38 PM
Waltkurtz welcome cup

allenb
11/28/2023 11:13 AM
yoshiod9 Welcome

renatoa
11/28/2023 3:52 AM
coffee drink, Choppin ?

allenb
11/27/2023 5:52 PM
JHCCoffee Welcome

renatoa
11/27/2023 6:46 AM
welcome cup, Braumeister

In Memory Of Ginny
Donations

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

Members Online: 0

Total Members: 8,005
Newest Member: Waltkurtz

View Thread

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

Thanks for your response, I'll try to insulate the probes from the chambers.
I think my mistake was to completely remove the PCB when modifying the fan instead of leaving the capacitors and inductors in place as explained here:
https://www.instructables.com/Arduino-controlled-DIY-Coffee-Roaster/ :
"For my DC fan motor, I modified the PCB to connect this to the TC4+. Essentially, you want to remove the wires, AC capacitor, and bridge rectifier from the PCB, and connect new wires where the output of the bridge rectifier was. This way, we keep the inductors and capacitors around the fan motor, which are useful for filtering out noise. If you remove the PCB entirely and solder wires directly onto the motor terminals, you might have problems with electrical noise making its way down to the TC4+ and messing with your thermocouple readings (or worse)."

But since I already removed it I will try if insulation helps!

Thanks and regards
 
zamunda
Hello,

AC-relay control and probes work fine now, I would like to control the fan as well by means of the Raspberry Pi and Artisan.
Therefore, I bought the L298N, quite cheap (7 euros):

https://www.electronicshub.org/raspberry-pi-l298n-interface-tutorial-control-dc-motor-l298n-raspberry-pi/

I connected the fan, the board and a 12V DC for testing.

This is the script I use (see below)...
From the command line it works quite well (changing speed works as expected) but if I call it from the Event-manager from Artisan, I get mixed results...seems like subsequent commands get mixed so maybe I have to adjust the script, do not know yet...

Any experience with this set-up?

Thanks and regards,


#!/usr/bin/python2.7

import RPi.GPIO as GPIO # Import GPIO module
import time # Import time module
from sys import argv


ENA = 25
IN1 = 24
IN2 = 23

if __name__ == '__main__':
try:
# Initialization
GPIO.setmode(GPIO.BCM) # Use BCM numbering method
GPIO.setup(ENA, GPIO.OUT) # Set the GPIO pin corresponding to ENA to output mode
GPIO.setup(IN1, GPIO.OUT) # Set the GPIO pin corresponding to IN1 to output mode
GPIO.setup(IN2, GPIO.OUT) # Set the GPIO pin corresponding to IN2 to output mode

freq = 500
startspeed = 0
pwm = GPIO.PWM(ENA, freq) # Set the input PWM pulse signal to ENA, the frequency is freq and create a PWM object
pwm.start(startspeed) # Start inputting PWM pulse signal to ENA with the initial duty cycle of speed

speed=int(argv[1])

# Set the motor to forward rotation
GPIO.output(IN1, False) # Set IN1 to 0
GPIO.output(IN2, True) # Set IN2 to 1

pwm.ChangeDutyCycle(speed) # Change the PWM duty cycle
time.sleep(100)

finally:
pwm.stop() # Stop PWM
GPIO.cleanup() # Clean up and release GPIO resources, reset GPIO
 
zamunda
Hello,

Finally, I worked out a script for air-control which works with the Events for Artisan (sliders, buttons), see below...

Script should be called like this fe:
/home/pi/Roaster/Scripts/air-control.py {} [for using with a slider, dynamic value]
/home/pi/Roaster/Scripts/air-control.py 35 [for using with a button, static value]


Regards,


#!/usr/bin/python3

import RPi.GPIO as GPIO # Import GPIO module
import time # Import time module
from sys import argv

ENA = 25
IN1 = 24
IN2 = 23

def get_slidervalue(filepath):
""" Returns the slidervalue as an int, read from the first line of filepath """
with open(filepath) as f:
first_line = f.readline().strip()

return int(first_line)

if __name__ == '__main__':
try:
# read the slider value from argv
speed = int(argv[1])
sliderfilepath = "/home/pi/Roaster/Scripts/airvalue.txt"
# write the slider value to the file and close file
sliderfile = open(sliderfilepath, "w")
sliderfile.write(str(speed))
sliderfile.close()

# Initialization
GPIO.setmode(GPIO.BCM) # Use BCM numbering method
GPIO.setup(ENA, GPIO.OUT) # Set the GPIO pin corresponding to ENA to output mode
GPIO.setup(IN1, GPIO.OUT) # Set the GPIO pin corresponding to IN1 to output mode
GPIO.setup(IN2, GPIO.OUT) # Set the GPIO pin corresponding to IN2 to output mode

freq = 500
startspeed = 0
pwm = GPIO.PWM(ENA, freq) # Set the input PWM pulse signal to ENA, the frequency is freq and create a PWM object
pwm.start(startspeed) # Start inputting PWM pulse signal to ENA with the initial duty cycle of speed

# Set the motor to forward rotation, switch IN1 and IN2 to backward rotation if needed
GPIO.output(IN1, False) # Set IN1 to 0
GPIO.output(IN2, True) # Set IN2 to 1

# while this file has the latest cycle value
latestSpeed = True
while latestSpeed:
# check if this is not the newest process
newestSpeed = get_slidervalue(sliderfilepath)
if newestSpeed != speed:
latestSpeed = False
break
# set fan to desired speed
pwm.ChangeDutyCycle(speed) # Change the PWM duty cycle

finally:
pwm.stop() # Stop PWM
GPIO.cleanup() # Clean up and release GPIO resources, reset GPIO
 
Jump to Forum:

Similar Threads

Thread Forum Replies Last Post
Unable to get Artisan Scope's PID to control heating Dataloggers/Controllers/Rate of Rise Meters 4 08/01/2023 9:11 AM
Raspberry+artisan Bread Machine Roasters 8 03/08/2023 1:06 PM
Using a TC4 with Artisan Roaster Scope Dataloggers/Controllers/Rate of Rise Meters 41 05/09/2022 12:06 PM
TC4 connect to Raspberry Pi Dataloggers/Controllers/Rate of Rise Meters 55 01/04/2022 5:42 PM
How to get accurate temp readings MY FIRST ROASTER 5 01/07/2021 2:29 AM
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 © 2023 PHP-Fusion Inc
Released as free software without warranties under GNU Affero GPL v3
Designed with by NetriX
Hosted by skpacman