Skip to main content

Kitronik Robotics Board for Raspberry Pi Pico to drive 4 motors (or 2 stepper motors) and 8 servos

Project description

Other Languages: FRANCAIS

Kitronik-Pico-Robotics-Board-MicroPython

Pico Robotics Board de KitroniK

A class and sample code to use the Kitronik Robotics board for Raspberry Pi Pico. (www.kitronik.co.uk/5329)

This is the microPython version. For CircuitPython see: https://github.com/KitronikLtd/Kitronik-Pico-Robotics-Board-CircuitPython

To use save PicoRobotics.py file onto the Pico so it can be imported

Import the library and construct an instance:

import PicoRobotics
board = PicoRobotics.KitronikPicoRobotics()

This will initialise the PCA to default values.

Drive a motor:

board.motorOn(motor, direction, speed)

where:

  • motor => 1 to 4
  • direction => f or r
  • speed => 0 to 100

Stop a motor:

board.motorOff(motor)

where:

  • motor => 1 to 4

Drive a Servo:

board.servoWrite(servo, degrees)

where:

  • servo => 1 to 8
  • degrees => 0-180

Drive a Stepper:

board.step(stepperMotor,direction,steps)

where:

  • stepperMotor => 1 or 2 (stepper 1 is DC motors 1 and 2, stepper 2 is DC motors 3 and 4)
  • direction => f or r
  • steps => how many steps to make

To step an angle:

board.stepAngle(stepperMotor, direction, angle)

where

  • stepperMotor => 1 or 2 (stepper 1 is DC motors 1 and 2, stepper 2 is DC motors 3 and 4)
  • direction => f or r
  • angle => how many degrees to move

The stepper code assumes 200 steps per rev (1.8 degrees resolution) and only does full steps. There are defaulted parameters for stepper speeds (default 20mS pause between steps), hold position when finished stepping (off - saves energy) and how many steps per rev (200). Look at the function headers and function comments in PicoRobotics.py for more detail if you need to change them.

Troubleshooting

If the code is run without the Pico Robotics board connected, or if the board is not powered up it islikely that it will throw an OS Error (usually OS Error 5). This is because it tries to communicate with an I2C device which is not responding.

This code is designed to be used as a module. See: https://kitronik.co.uk/blogs/resources/modules-micro-python-and-the-raspberry-pi-pico for more information

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

KitronikPicoRobotics-1.0.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

KitronikPicoRobotics-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file KitronikPicoRobotics-1.0.0.tar.gz.

File metadata

  • Download URL: KitronikPicoRobotics-1.0.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for KitronikPicoRobotics-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cb0336c72c6e896ea091fe3e076d6fe469c865fd596f6b4a2f450db740dee562
MD5 fc674b183e49bbcd8426a6f4ca29a558
BLAKE2b-256 5a1ceff6826fb0365f330a5e1aafb9397d84ef247db3ec3133525f85ee10b585

See more details on using hashes here.

File details

Details for the file KitronikPicoRobotics-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for KitronikPicoRobotics-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64b4681d49ef60439776c6747f4fcbe953a350682c79fa3a8eb4e0187fc5c28a
MD5 395d65fdff01f9696694ee40cac09c86
BLAKE2b-256 6a87c9cd9619d007c8bb1b01cc08ab638c1b34d72d8ddad523704d1e4408d090

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page