The 🛒Raspberry Pi Build HAT Is an add-on board that connects to your Raspberry Pi's 40-pin GPIO header and was created in partnership with LEGO® Education to make controlling LEGO® TechnicTM motors and sensors with Raspberry Pi computers simple.
Buy Rapsberry Pi Build HAT
It includes four connectors for SPIKETM Portfolio LEGO® TechnicTM motors and sensors. A distance sensor, a colour sensor, and a versatile force sensor are among the sensors available. The angular motors are available in a variety of sizes and have built-in encoders that may be used to determine their location.
The Build HAT is supported by the LEGO® Education SPIKETM Prime Set 45678 and SPIKETM Prime Expansion Set 45681, both of which are available separately from LEGO® Education resellers.
NOTE: All 40-pin GPIO 🛒Raspberry Pi boards, including the 🛒Raspberry Pi 4 and 🛒Raspberry Pi Zero 2 W, are compatible with the HAT. It can also be utilised with Raspberry Pi 400 with the addition of a ribbon cable or other extension device.
- Up to four LEGO® TechnicTM motors and sensors from the SPIKETM Portfolio can be controlled.
- Control your LEGO® TechnicTM devices with this simple Python library.
- Any Raspberry Pi computer with a 40-pin GPIO header will fit.
- Low-level control of LEGO® TechnicTM devices is managed by an onboard RP2040 microcontroller.
- A separate 8V PSU is available to power both the Build HAT and the Raspberry Pi.
NOTE: The Rapsberry Pi 400 cannot be powered by the Build HAT since it does not support GPIO headers.
You can also follow along with the Raspberry Pi Foundation's projects for Build HAT.
Getting the Raspberry Pi Ready for the Build HATSet up your Raspberry Pi and install the newest version of the operating system using Raspberry Pi Imager before you begin working with your Raspberry Pi Build HAT.
Attach 9mm spacers to the board's bottom. The Raspberry Pi Build HAT should be installed on your Raspberry Pi. Make sure it's the proper way up when you put it on. All of the components are on the bottom, unlike other HATs, allowing room on top for a breadboard or LEGO® pieces.
Getting your Raspberry Pi set upAfter the Raspberry Pi has booted, access the Raspberry Pi Configuration tool by selecting "Preferences" and then "Raspberry Pi Configuration" from the Raspberry Menu button.
Adjust the Serial settings as indicated below by clicking on the "interfaces" tab and adjusting the Serial parameters as given:
Using your Raspberry Pi as a Headless Computer- If you're using raspi-config to run your Raspberry Pi headless, choose "Interface Options" from the first option.
- Then "P6 Serial Port" appears.
- Disable the serial console by doing the following:
- Also, make sure the serial port hardware is turned on.
- This is how the final settings should appear.
- If you've made any modifications, you'll need to reboot at this point.
Connect an external power supply — the original Raspberry Pi Build HAT power supply is suggested — although the Build HAT will be powered by any dependable +8V10 percent power supply capable of producing 48W through a DC 5521 centre positive barrel connection (5.5mm 2.1mm 11mm). Unless you're using a Raspberry Pi 400, you won't need to attach an additional USB power supply to the Raspberry Pi.
NOTE: The Raspberry Pi 400 cannot be powered by the Build HAT since it does not support GPIO headers.
NOTE: Because the LEGO® TechnicTM motors are so strong, you'll need an extra 8V power supply to run them. If you wish to read from motor encoders and the SPIKETM force sensor, you may use the Raspberry Pi's USB power connector to power your Raspberry Pi and Build HAT. Like the motors, the SPIKETM colour and distance sensors require an external power supply.
Putting the Build HAT Software TogetherInstall the Python library Build HAT. To get started, open a Terminal window and type,
$ pip3 install buildhat
For additional information about the Build HAT Python Library visit.
Motors:
There are a variety of motors that may be used with the Build HAT.
How to Connect a Motor to Raspberry Piu Build HATConnect a motor to the Build HAT's port A. The LPF2 connections must be placed in the proper orientation. If the connector is difficult to insert, twist it 180 degrees and try again.
Motors in the WorkplaceTo begin, open the Thonny IDE. Add the following code to your programme:
from buildhat import Motor
motor_a = Motor('A')
motor_a.run_for_seconds(5)
Click the play/run button to start the application. There will be a brief pause as the firmware is transferred to the board if this is the first time you've executed a Build HAT application after the Raspberry Pi has launched. The red LED should turn off and the green LED should turn on. This delay will not be required for further Python programme running.
- For 5 seconds, crank your motor clockwise.
- Rerun your programme after changing the final line.
motor_a.run_for_seconds(5, speed=50)
- The motor should now spin more quickly. Make another alteration:
motor_a.run_for_seconds(5, speed=-50)
- The motor should rotate in the opposite direction (anti-clockwise).
By using the + button in Thonny, you may create a new programme. Add the following code to your page:
from buildhat import Motor
motor_a = Motor('A')
While True:
print("Position: ", motor_a.get_aposition())
- Run the application. Turn the shaft of the engine using your hand. The numbers written in the Thonny REPL should be changing.
Sensors The Raspberry Pi Build HAT is compatible with a wide selection of sensors.
The Use of SensorsConnect a Color sensor to port B and a Force sensor to port C on the Build HAT.
Make a second new programme :from signal import pause
from buildhat import ForceSensor, ColorSensor
button = ForceSensor('C')
cs = ColorSensor('B')
def handle_pressed():
cs.on()
print(c.get_color())
def handle_released():
cs.off()
Run it and press the Force sensor plunger while holding a coloured item (LEGO® elements are good) in front of the colour sensor. The sensor's LED should turn on, and the nearest color's name should appear in the thonny REPL.
Posts You May like:- The New Version of Raspberry Pi OS, Debian "Bullseye" is Now Available.
- The Raspberry Pi Zero 2 W Arrives Six Years After The First Pi Zero
- Raspberry Pi 4 Has Been Given Vulkan 1.1 Compliance by Khronos
- Raspberry Pi Officialy Announced Build HAT For Raspberry Pi
- Installing Android on a Raspberry Pi 4 with Google Play Store
- Pop OS Linux is Coming to Raspberry Pi and Other ARM Devices Soon
- How to Immediately Upgrade to Windows 11
- A Secret Update for the Raspberry Pi 4 8GB
- Raspberry Pi Introduces a New Documentation Hub
- Quick start with ESP8266 based Pico WiFi HAT
- Capture local Real-Time Air Quality Data with Raspberry Pi Pico
- GitHub CLI 2.0 Is Now Available, With Extension Support
- Connecting Wi-Fi on Raspberry Pi Pico Become Easy
- How To Track All Devices with Raspberry Pi
- Make your own Raspberry Pi Image from scratch
- How to Send phone notifications Using Raspberry Pi Pico?
- Raspberry Pi Pico 4G/2G Expansion : Expectations vs. Reality
- Quick Example to Drive Servo Using Programmable I/O
- How to Use a USB SSD or Flash Drive to Boot a Raspberry Pi 4 / Pi 400
- Filter Ads by your Raspberry Pi Before they Reach your Devices
- A Raspberry Pi 4 Model A Launch 2022 - Eben Upton
- First-Ever 2G Expansion Board for Raspberry Pi Pico has Launched on Kickstarter
- Learn IoT "Internet of Things" with 24 lessons for Teachers and Students
- Quick Guide for Raspberry Pi Users: Raspberry Pi Terminal Commands
- Windows 11 on Raspberry Pi Devices in Easy Installation Guide
- Get Your Project Done by Raspberry Pi Approved Design Partners
- PiRelay 8 Smart Relay Board for Raspberry Pi - Kickstarter
- Tiny Round/Circular LCD Display Launched!
- Issue Fixed! USB Boot Ubuntu Server 20.04 on Raspberry Pi 4
- HC-SR04 Sensor with micro-ROS on the Raspberry Pi Pico
- Raspberry Pi Pico: ADC Sampling and FFT
- Using CircuitPython for RP2040
- How to Setup Pico RP2040 on Windows
- Using micro-ROS on the Raspberry Pi Pico
- LED Tricks Using The Raspberry Pi Pico
- The RP2040 Raspberry Pi Pico Meets LoRa
- Pico supports SD cards and FatFS
- How to connect a Raspberry Pi Pico to LoRaWAN
- 50 Raspberry Pi Hacks & Tips You Should Know
- How to Install Wi-Fi and Internet on a Raspberry Pi Pico
Comments
Please log in or sign up to comment.