0

nano brewery building an automated filling rig
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: nano brewery building an automated filling rig

by burrito_poots on Fri Jul 19, 2019 9:02 am

kcl1s wrote:I believe you need a common ground between the feather (gnd) and supply ( - ).

Fellow hobbyist
Keith


Because I'm a complete moron here Keith, does that mean I would connect my supply ( - ) to my boards gnd pin, just a wire soldered between the two? Thanks for the insight, fingers crossed this fixes my issue once I get some clarification from you

burrito_poots
 
Posts: 64
Joined: Thu May 30, 2019 5:02 pm

Re: nano brewery building an automated filling rig

by kcl1s on Fri Jul 19, 2019 9:17 am

burrito_poots wrote:
kcl1s wrote:I believe you need a common ground between the feather (gnd) and supply ( - ).

Fellow hobbyist
Keith


Because I'm a complete moron here Keith, does that mean I would connect my supply ( - ) to my boards gnd pin, just a wire soldered between the two? Thanks for the insight, fingers crossed this fixes my issue once I get some clarification from you

Yes just a wire to tie the gnds together. In the tutorial you referenced above you can see the gnds tied through the breadboard ground rail https://learn.adafruit.com/assets/70523

Keith

kcl1s
 
Posts: 1290
Joined: Tue Aug 30, 2016 12:06 pm

Re: nano brewery building an automated filling rig

by adafruit_support_bill on Fri Jul 19, 2019 9:46 am

Definitely a missing ground reference would explain the flaky-at-best MOSFET behavior. Connect them as Keith has described.

Regarding solenoid, the spec mentions 4W without any further context. 4W at 12v would be 333mA. Not sure where the 29mA comes from. Given the ambiguity, a wise strategy would be to measure the actual current draw at 12v before connecting it to a motor shield.

The MOSFET can handle many amps without a sweat, so I'm not concerned about that.

adafruit_support_bill
 
Posts: 74627
Joined: Sat Feb 07, 2009 10:11 am

Re: nano brewery building an automated filling rig

by burrito_poots on Fri Jul 19, 2019 9:51 am

adafruit_support_bill wrote:Definitely a missing ground reference would explain the flaky-at-best MOSFET behavior. Connect them as Keith has described.

Regarding solenoid, the spec mentions 4W without any further context. 4W at 12v would be 333mA. Not sure where the 29mA comes from. Given the ambiguity, a wise strategy would be to measure the actual current draw at 12v before connecting it to a motor shield.

The MOSFET can handle many amps without a sweat, so I'm not concerned about that.


Lol I really hope it's the missing ground, the best problems are the ones you kick yourself for missing. Soldering iron is heating up as we speak, I'll update you all once I do a test run.

If my individual solenoid draws less than the stated "1.2A per coil" would this mean I'm safe to use it with the motor shield? The difference is going to be about $13 but it looks like hooking it up will be a lot less time consuming and look a lot cleaner/be much easier to stuff inside of an enclosure (which is a down-the-line box I'd like to be able to check on this project).

burrito_poots
 
Posts: 64
Joined: Thu May 30, 2019 5:02 pm

Re: nano brewery building an automated filling rig

by adafruit_support_bill on Fri Jul 19, 2019 9:54 am

Yes. If it is less than 1.2A, the shield should handle it fine.

adafruit_support_bill
 
Posts: 74627
Joined: Sat Feb 07, 2009 10:11 am

Re: nano brewery building an automated filling rig

by burrito_poots on Fri Jul 19, 2019 9:57 am

Cool, I have some decisions to make regarding that or the MOSFETS then.

FYI, thank you both for the help, we have a working solenoid now, the ground was the culprit and my MOSFET is fine! Can't tell y'all how pumped I am to get past this.

burrito_poots
 
Posts: 64
Joined: Thu May 30, 2019 5:02 pm

Re: nano brewery building an automated filling rig

by burrito_poots on Mon Jul 29, 2019 1:19 pm

Hey Bill,

For the same project, could I pick your brain on incorporating a rotary encoder?

My code:
Code: Select all | TOGGLE FULL SIZE
import board
import busio
import digitalio
import adafruit_ssd1306
i2c = busio.I2C(board.SCL, board.SDA)

display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)

button_a = digitalio.DigitalInOut(board.D9)
button_a.pull = digitalio.Pull.UP
button_b = digitalio.DigitalInOut(board.D6)
button_b.pull = digitalio.Pull.UP
button_c = digitalio.DigitalInOut(board.D5)
button_c.pull = digitalio.Pull.UP

solenoid = digitalio.DigitalInOut(board.A4)
solenoid.direction = digitalio.Direction.OUTPUT

#Variables to remember which state a, b and c are in
a = 0
b = 0
c = 0

display.fill(0)
display.text('M O N A R C H', 0, 0, 1)
display.text('   - Ind. -', 0, 10, 1)
display.text('MK. I', 95, 20, 1)

while True:
    if button_a.value == 0:
        # Button_a has been pressed
        a = not a
        # Switch the stored version of a to the opposite of whatever it is.
        if a == 1:
            # a is toggled to "off"
            display.fill(0)
            display.text('Mode', 0, 0, 1)
            display.text(' © Filling:      OFF ', 0, 20, 1)
            display.text(' Time: 8.3s', 60, 0, 1)
            solenoid.value = False
        else:
            # If a is not 1 then it must be 0, so toggle a "on"
            display.fill(0)
            display.text('Mode', 0, 0, 1)
            display.text(' © Filling: ON ', 0, 20, 1)
            display.text(' Time: 8.3s', 60, 0, 1)
            solenoid.value = True
    if button_b.value == 0:
        # Button_b has been pressed
        b = not b
        # Switch the stored version of b to the opposite of whatever it is.
        if b == 1:
            # b is toggled to "off"
            display.fill(0)
            display.text('Mode', 0, 0, 1)
            display.text(' © CIP:      OFF', 0, 20, 1)
        else:
            # If b is not 1 then it must be 0, so toggle b "on"
            display.fill(0)
            display.text('Mode', 0, 0, 1)

            display.text(' © CIP: ON ', 0, 20, 1)
    if button_c.value == 0:
        # Button_c has been pressed
        c = not c
        # Switch the stored version of c to the opposite of whatever it is.
        if c == 1:
            # c is toggled to "on"/"Today"
            display.fill(0)
            display.text('Mode', 0, 0, 1)
            display.text(' © Stats:', 0, 20, 1)
            display.text(' Cans Filled', 50, 0, 1)
            display.text('   -Today-', 60, 10, 1)
        else:
            # If c is not 1 then it must be 0, so toggle c "off"/"All time"
            display.fill(0)
            display.text('Mode', 0, 0, 1)
            display.text(' © Stats:', 0, 20, 1)
            display.text(' Cans Filled', 50, 0, 1)
            display.text('-All time-', 60, 10, 1)


    display.show()


Basically, in my button A portion of the code, I have a dummy display "time" of 8.3 seconds. This was just for mockup purposes -- what I'm hoping to accomplish is to have that place in the code edited on the fly via the rotary encoder, up or down by a tenth of a second. I need this to be my timer for one of my solenoids, specifically the time I hold my solenoid open before closing it. Any ideas on how to tackle this? It's one of the last big pieces of coding I need to figure out, and is one of the most important pieces of the code from a user interaction standpoint.

burrito_poots
 
Posts: 64
Joined: Thu May 30, 2019 5:02 pm

Re: nano brewery building an automated filling rig

by adafruit_support_bill on Mon Jul 29, 2019 2:34 pm

PJRC has an excellent encoder library: https://www.pjrc.com/teensy/td_libs_Encoder.html
It works with their Teensy-LC which is an M0-based board. So you should be able to get it going on your M0 Feather.

adafruit_support_bill
 
Posts: 74627
Joined: Sat Feb 07, 2009 10:11 am

Re: nano brewery building an automated filling rig

by burrito_poots on Mon Jul 29, 2019 2:46 pm

adafruit_support_bill wrote:PJRC has an excellent encoder library: https://www.pjrc.com/teensy/td_libs_Encoder.html
It works with their Teensy-LC which is an M0-based board. So you should be able to get it going on your M0 Feather.


Does the rotary encoder not work with the M0 express? On the rotary encoders little wiki page it states that "You can use any CircuitPython Express board. Note that at this time, Gemma M0, Trinket M0 and other non-Express boards do not support rotaryio" -- would you please clarify if I'm overlooking something here? If not, I assume I can still use rotaryio and hopefully in the way I'm attempting to from my previous reply?

burrito_poots
 
Posts: 64
Joined: Thu May 30, 2019 5:02 pm

Re: nano brewery building an automated filling rig

by adafruit_support_bill on Mon Jul 29, 2019 2:56 pm

If you are using Python, then you should be able to use the rotaryio library. Python is not my native language, so I don't have any experience with it. You might want to post the question over on the CircuitPython forum: viewforum.php?f=60

adafruit_support_bill
 
Posts: 74627
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.