Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot figure out wiring for CamJam EduKit 3 with Pico WH #35

Open
blacknand opened this issue Sep 7, 2024 · 1 comment
Open

Cannot figure out wiring for CamJam EduKit 3 with Pico WH #35

blacknand opened this issue Sep 7, 2024 · 1 comment

Comments

@blacknand
Copy link

I am trying to build this kit using a Pico WH instead of a regular Pi but cannot get the wiring correct at all. I found the pin layout for the motor controller board but I am not sure if I am using the correct pins because the pin layout on the site has 40 instead of 26.

I have connected pins 14 and 12 on the Pico to GPIO pins 8 and 7 on the motor controller board for the motor B control, as well as pins 10 and 11 to to GPIO pins 10 and 9 on the motor controller board for motor A control and then a ground pin on the Pico to a ground pin on the motor controller board.

I have hooked up the motor controller board to both motors as well as the battery pack included with 4 fresh AA batteries and nothing happens. I am not sure if there is meant to be any LEDs on the motor control board because I have seen some issues raised with people taking about the onboard LEDs but I have not got any on if that is the case. I can however hear some very light buzzing/high pitched sound when everything is wired up, even without the battery pack being turned on.

I have tried both C++ and MicroPython just to move the motors to see if the wiring is correct but in both cases nothing happens. Below are highlighted images of the pins I have used.

This is the motor controller board with the pins used highlighted:

Screenshot 2024-09-07 at 14 25 29

Here are the GPIO pins of the Pico highlighted:

Screenshot 2024-09-07 at 14 27 31

For reference, this is the C++ program I tried to run:

#include "pico/stdlib.h"

// Motor A Pins
const uint MOTOR_A_PIN1 = 10;
const uint MOTOR_A_PIN2 = 11;

// Motor B Pins
const uint MOTOR_B_PIN1 = 12;
const uint MOTOR_B_PIN2 = 14;

// Function to initialize GPIOs
void setup_motors() {
    gpio_init(MOTOR_A_PIN1);
    gpio_set_dir(MOTOR_A_PIN1, GPIO_OUT);
    
    gpio_init(MOTOR_A_PIN2);
    gpio_set_dir(MOTOR_A_PIN2, GPIO_OUT);
    
    gpio_init(MOTOR_B_PIN1);
    gpio_set_dir(MOTOR_B_PIN1, GPIO_OUT);
    
    gpio_init(MOTOR_B_PIN2);
    gpio_set_dir(MOTOR_B_PIN2, GPIO_OUT);
}

// Function to move Motor A forward
void motor_a_forward() {
    gpio_put(MOTOR_A_PIN1, true);
    gpio_put(MOTOR_A_PIN2, false);
}

// Function to move Motor A backward
void motor_a_backward() {
    gpio_put(MOTOR_A_PIN1, false);
    gpio_put(MOTOR_A_PIN2, true);
}

// Function to stop Motor A
void motor_a_stop() {
    gpio_put(MOTOR_A_PIN1, false);
    gpio_put(MOTOR_A_PIN2, false);
}

// Function to move Motor B forward
void motor_b_forward() {
    gpio_put(MOTOR_B_PIN1, true);
    gpio_put(MOTOR_B_PIN2, false);
}

// Function to move Motor B backward
void motor_b_backward() {
    gpio_put(MOTOR_B_PIN1, false);
    gpio_put(MOTOR_B_PIN2, true);
}

// Function to stop Motor B
void motor_b_stop() {
    gpio_put(MOTOR_B_PIN1, false);
    gpio_put(MOTOR_B_PIN2, false);
}

int main() {
    // Initialize GPIO pins
    setup_motors();

    // Example: Move motors forward for 2 seconds, then backward for 2 seconds
    while (true) {
        motor_a_forward();
        motor_b_forward();
        sleep_ms(2000);  // Run forward for 2 seconds

        motor_a_backward();
        motor_b_backward();
        sleep_ms(2000);  // Run backward for 2 seconds

        motor_a_stop();
        motor_b_stop();
        sleep_ms(1000);  // Stop for 1 second
    }

    return 0;
}

And following the documentation of the Pico I tried to run the following MicroPython code using minicom:

from machine import Pin
import time

# Motor A control pins
motor_A1 = Pin(9, Pin.OUT)
motor_A2 = Pin(10, Pin.OUT)

# Motor B control pins
motor_B1 = Pin(7, Pin.OUT)
motor_B2 = Pin(8, Pin.OUT)

# Move Motor A forward
motor_A1.value(1)
motor_A2.value(0)

# Move Motor B backward
motor_B1.value(0)
motor_B2.value(1)

time.sleep(2)  # Run motors for 2 seconds

# Stop both motors
motor_A1.value(0)
motor_A2.value(0)
motor_B1.value(0)
motor_B2.value(0)
@GeekyTim
Copy link
Member

GeekyTim commented Oct 9, 2024

We don't currently support using the Pico with the EduKit 3.

The motor speed is usually controlled with PWM, so perhaps try using PWM on the pins?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants