Download presentation
Presentation is loading. Please wait.
Published byMatthias Verbeke Modified over 5 years ago
1
Robot and Crickit HAT © Copyright 2019 by Dr. Elizabeth I. Horvath and Dr. Eva A. Horvath 1
2
Mini Robot Chassis Top View
Use the extra hex standoff screw pillars as shown here. 2
3
Mini Robot Chassis Front View
Use the extra hex standoff screw pillars as shown here. 3
4
Mini Robot Chassis Rear View
4
5
Mini Robot Chassis Top View
Portable USB High Capacity Power Bank; at least 2000mAh 5
6
Mini Robot Chassis Top View
Battery Pack 6
7
CRICKIT HAT 4 x Analog or Digital Servo control, with precision 16-bit timers 2 x Bi-directional brushed DC motor control, 1 Amp current limited each, with 8- bit PWM speed control (or one stepper) 4 x High current "Darlington" 500mA drive outputs with kick-back diode protection. For solenoids, relays, large LEDs, or one uni-polar stepper 4 x Capacitive touch input sensors with alligator-pads 8 x Signal pins, can be used as digital in/out or analog inputs 7
8
Image from https://www.adafruit.com
Crickit HAT Image from 8
9
Connecting CRICKIT HAT to Motor
Use four male/male jumper wires to connect the motors to the MOTORS screw block on the CRICKIT HAT. Starting from the side of the CRICKIT HAT on the upper right hand side. Put an orange wire for the VCC for the right motor (labeled 1) and put a brown wire (labeled 1) for the GND for the right motor. Skip the GND. Put a black wire for GND for the left motor (labeled 2) and put a red wire for VCC for the left motor (labeled 2). Image from 9
10
Mini Robot Chassis Power Setup
Raspberry Pi is located on top, with battery pack under the Raspberry Pi case. Additional duct tape was used to secure the components. You can run the Raspberry Pi, the CRICKIT HAT, and the motors for the robot from 4 AA batteries without the Power Bank. If you have a Power Bank or are connecting to the adapter, plug in the main power supply before connecting the AA battery pack. 10
11
Installing the CRICKIT HAT Software
$ sudo pip3 install RPI.GPIO adafruit-blinka $ sudo pip3 install RPI.GPIO adafruit-circuitpython-cricket $ sudo raspi-config Arrow down to Interfacing Options Tab to Select. Click on Select Arrow down to I2C. Enable I2C. Or, go to the Menu -> Raspberry Pi Configuration -> Interfaces -> Enable I2C Terminal sudo reboot Install I2C tools sudo apt-get install -y python-smbus sudo apt-get install -y i2c-tools Scan for I2C to see that the Crickit HAT is found with i2cdetect -y 1 If 49 is not seen, connect the battery pack. Press the Reset button to the right of the red LED. The LED will now be green. 11
12
Controlling DC Motors with the CRICKIT HAT
#make two variables for the motors to make code shorter to type motor_1 = crickit.dc_motor_1 motor_2 = crickit.dc_motor_2 motor_1.throttle = 0 # right motor stopped motor_2.throttle = 0 # left motor stopped time.sleep(1) motor_1.throttle = # right motor half speed backward motor_2.throttle = 0 # left motor stopped motor_1.throttle = 0.5 # right motor half speed foreward motor_2.throttle = # left motor half speed backward motor_1.throttle = 0 # right motor stopped motor_2.throttle = 0.5 # left motor half speed foreward 12
13
Modifying the CRICKIT HAT Code
$ cd /usr/local/lib/python3.5/dist-packages $ sudo cp adafruit_crickit.py adafruit_crickit.py.original $ sudo chmod a+rwx adafruit_crickit.py Go to IDLE and edit the adafruit_crickit.py file and change to motor.py to motor2.py. $ cd adafruit_motor $ sudo cp motor.py motor2.py $ sudo chmod a+rwx motor2.py Go to IDLE and edit motor2.py 13
14
Headless Operation Connecting to a Pi that is not connected to a monitor, keyboard, or mouse. Menu -> Raspberry Pi Configuration Change your password from raspberry! Interfaces -> Enable ssh Reboot Connect to your wireless access point sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.backup Check the /etc/wpa_supplicant/wpa_supplicant.conf file. This will have your association information. The last network is the default network with which you will be associated when you connect in headless operation. 14
15
Headless Operation Install putty on Windows or use Linux.
ssh Create a DHCP reservation on your wireless device for your Raspberry Pi, so that it will receive the same IP address based upon the HWAddr (MAC address) for wlan0. You may need to configure this file: sudo nano /etc/dhcpcd.conf 15
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.