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/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 !

07/10/2021 8:24 AM
yourspecialbrew Welcome!

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: 25

Members Online: 0

Total Members: 7,256
Newest Member: stivenreed333

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
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