Question about the Powerboost part used with the fairy wings project

Wearable electronics: boards, conductive materials, and projects from Adafruit!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by dastels »

Yes, just be careful to keep it neat and insulated so nothing else can accidentally touch it.

Dave

User avatar
Froggy92030
 
Posts: 97
Joined: Wed Apr 20, 2022 8:25 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by Froggy92030 »

Awesome! Fingers crossed this is it lok

User avatar
Froggy92030
 
Posts: 97
Joined: Wed Apr 20, 2022 8:25 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by Froggy92030 »

Everything seems to be powered up now but I seem to be having the same problem as the last pair I made. You and I went through all the solder points to discover that the code I was using was outdated. Would you be willing to check the code for me? I have a green light on the M4 that will blink green once then pause and blink once again, which is exactly what the last pair was doing. It is the code from the project bundle but things seem to have been updated in there since we made the last pair.

This is the code

Code: Select all

# SPDX-FileCopyrightText: 2021 Erin St Blaine for Adafruit Industries
#
# SPDX-License-Identifier: MIT

"""
Fluttering Fairy Wings
Adafruit invests time and resources providing this open source code.
Please support Adafruit and open source hardware by purchasing
products from Adafruit!
Written by Erin St Blaine for Adafruit Industries
Copyright (c) 2020-2021 Adafruit Industries
Licensed under the MIT license.
All text above must be included in any redistribution.
"""

import time
import random
import board
from analogio import AnalogIn
from adafruit_servokit import ServoKit

analog_in = AnalogIn(board.A0)
kit = ServoKit(channels=8)

SERVO_MIN = 0
SERVO_MAX = 130
DELAY_MIN = 0.01  # In seconds, is the longest DELAY between servo moves
DELAY_MAX = 0.1   # In seconds, is the longest DELAY between servo moves

DELAY = DELAY_MAX

def set_delay():
    '''calibrate to potentiometer'''
    global DELAY # pylint: disable=global-statement
    DELAY = DELAY_MIN + DELAY_MAX * (65535 - analog_in.value) / 65535
    #print(DELAY\

while True:
    num_flaps = random.randint(1, 4)

    print("Flapping", num_flaps, "times")
    for flap in range(num_flaps):
        print("Open")
        set_delay()
        for angle in range(SERVO_MIN, SERVO_MAX, 2): # move 2 deg at a time
            kit.servo[0].angle = angle
            kit.servo[1].angle = SERVO_MAX-angle
            time.sleep(DELAY)
        print("Close")
        set_delay()
        for angle in range(SERVO_MIN, SERVO_MAX, 2): # move 2 deg at a time
            kit.servo[0].angle = SERVO_MAX-angle
            kit.servo[1].angle = angle
            time.sleep(DELAY*2)
    print("Waiting...")
    time.sleep(random.randint(2, 10))  # wait 2 to 10 seconds
Last edited by dastels on Thu Aug 25, 2022 1:37 pm, edited 1 time in total.
Reason: Add code tag

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by dastels »

First make sure you have CircuitPython 7.3.2 and the latest 7.x library bundle.

Can you run it with USB connected to see what's sent to the REPL? That will give a better indication on what's happening.

Dave

User avatar
Froggy92030
 
Posts: 97
Joined: Wed Apr 20, 2022 8:25 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by Froggy92030 »

Ok here is what I get when I send it to REPL:

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 7.3.2 on 2022-07-20; Adafruit Feather M4 Express with samd51j19
>>> print("Hello, CircuitPython!")
Hello, CircuitPython!
>>>

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by dastels »

What about when you run the servo code?

Dave

User avatar
Froggy92030
 
Posts: 97
Joined: Wed Apr 20, 2022 8:25 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by Froggy92030 »

So when I connect MU to my board they only other code I see is _init_.py. when I load that it just comes up with a blank screen.

When I open CIRCUITPY in my files I can see adafruit_pca9685.mpy and adafruit_servokit.mpy but neither of those show in MU

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by dastels »

They won't show up in MU since they are library files. They should in in CIRCUITPY/lib btw.

code.py should be in CIRCUITPY.

Dave

User avatar
Froggy92030
 
Posts: 97
Joined: Wed Apr 20, 2022 8:25 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by Froggy92030 »

Code.py is and thats what I ran...Unless I ran it wrong

User avatar
michaelmeissner
 
Posts: 1819
Joined: Wed Aug 29, 2012 12:40 am

Re: Question about the Powerboost part used with the fairy wings project

Post by michaelmeissner »

Froggy92030 wrote: Thu Aug 25, 2022 12:35 pm This may be a stupid question but can I splice all 3 ground wires together and attach them to the end of a single wire that is then soldered to the ground pin?
In general, yes you can do this (and it isn't a stupid question BTW). In more complex setups, there might be reasons why you don't want to connect all of the ground wires to a single connection on the microprocessors.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by dastels »

I see calls to print in the code so you should see that output in the REPL.

Dave

User avatar
Froggy92030
 
Posts: 97
Joined: Wed Apr 20, 2022 8:25 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by Froggy92030 »

So would I be checking the spots that say
print("flapping", num_flaps, "times") or anything that has the print command before it?

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by dastels »

Exactly. You should see that output in the REPL. Double check that CIRCUITPY/code.py has the expected code in it.

Dave

User avatar
Froggy92030
 
Posts: 97
Joined: Wed Apr 20, 2022 8:25 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by Froggy92030 »

How would I see it in REPL? This is probably where I am missing a step. I know how to get into REPL, and how to access the help modules, and see what pins are available on the board.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Question about the Powerboost part used with the fairy wings project

Post by dastels »

Anything output using print is sent to the REPL. Any error that causes the code to crash/stop is output to the REPL in a fair amount of detail.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Wearables”