Posts tagged “arduino”
You are currently viewing a selection of posts from the Pololu Blog. You can also view all the posts.
MCHobby, a Pololu distributor, translated the Pololu Zumo Shield for Arduino User’s Guide to French as the Guide utilisateur du Robot Zumo Pololu (2MB pdf)! They describe it in French as “Un guide complet pour assembler, utiliser et exploiter rapidement votre Robot Zumo (version 0.1)”. If you’d like to see more translations like this, please let them you know that you enjoyed it and support them by buying from their shop.
This is the fifth and final post in a series about how to make a Balboa 32U4 robot balance. In earlier posts I covered everything you need to get the robot balancing. In this post I will talk about how to get your Balboa to perform some fun and challenging maneuvers.
If you have been following along, you should now have your robot using its inertial sensors, motors, and encoders together to balance in place. Now it’s time to get it moving! Our first challenge will be to get it to “pop up” from a resting position into a balancing position. Then I will show how you can get the Balboa to drive around while balancing. Continued…
This tutorial shows how to build a basic Raspberry Pi robot with the Romi chassis and the Romi 32U4 Control Board, our Arduino-compatible microcontroller board designed specifically for the Romi. With this setup, the powerful Raspberry Pi can take care of high-level tasks like motion planning, video processing, and network communication, while the Romi 32U4 Control Board takes care of low-level tasks that the Pi is incapable of, such as motor control and sensing. Continued…
This is the fourth post in a series about how to make a Balboa 32U4 robot balance. In earlier posts I covered the basic sensors and mechanical parts used for balancing; in this post I will show you how to put everything together to make the robot actually balance.
From earlier posts we have obtained six basic variables for use in balancing: Continued…
Julien de la Bruère-Terreault (also known as DrGFreeman on the Pololu Forum, creator of the Custom Mini Sumo robot and the Romi and Raspberry Pi robot shared on this blog) made “SharpDistSensor” an Arduino library for analog Sharp distance sensors. If you’re running a recent version of the Arduino IDE, you can install it with the Library Manager. The library reads the sensor’s analog voltage output, filters the data, and converts it to a distance measurement. By default it is calibrated to work with the Sharp GP2Y0A60SZLF analog distance sensor 10-150cm 5V, but you can calibrate it to other analog Sharp distance sensors (if you can fit a power function or a fifth order polynomial to the voltage vs distance response of your sensor). Pull requests are welcome for supporting other Sharp distance sensor models!
The readme, library code, and example sketches are available in the GitHub repository.
This is the third post in a series about how to make a Balboa 32U4 robot balance. Last week I talked about inertial sensors, especially the gyro. In this post I will talk about the Balboa’s built-in encoders, which allow accurate measurements of motor speed and distance.
To get your Balboa to balance, you will soon need to create a balancing algorithm, a program that takes sensor input and computes the appropriate motor speed settings to keep the robot upright. So far our only inputs, both from the gyro, are the rate of rotation and current angle of the robot. These are not quite enough to make a good balancer. To see why, suppose that your program tries to balance by holding the angle at a constant 90°. If your definition of 90° is even slightly off-balance, the robot will need to keep accelerating, driving faster and faster to maintain it, until it reaches top speed or hits an obstacle. You might be able to account for this by using the motor output settings themselves as an input to your algorithm, but this is difficult, especially at the low speeds used for balancing. Also, even if you can avoid accelerating, your robot will gradually drift in one direction or the other. The Balboa’s encoders are valuable additional sensor inputs that allow you to measure how fast the wheels are actually turning, so you can directly control acceleration and drift. As a bonus, encoders are great for driving straight, precision turns, and navigation. Continued…
This is the second post in a series about how to make a Balboa 32U4 robot balance. Last week I talked about selecting mechanical components. In this post I will cover the inertial sensors included on the Balboa’s control board and how to use them in your code.
The key to Balboa’s balancing ability is the built-in ST LSM6DS33 IMU chip, which combines a 3D gyroscope and a 3D accelerometer. The Balboa also includes an ST LIS3MDL 3-axis magnetometer. Both sensors are connected to the AVR via I²C, giving it access to a total of nine sensor channels. These nine channels can be used in software to make an AHRS (attitude and heading reference system), a system that gives the robot a sense of its orientation in three dimensions. AHRS software is particularly important in aviation/drone applications, but for basic balancing, you don’t need anything that complicated. In fact, a single gyro channel is enough to determine the robot’s angle of rotation relative to vertical. The gyroscope’s y-axis channel measures the Balboa’s forward/backward rate of rotation; that is the channel we will be looking at here. Continued…
I am excited to announce the release of the Balboa robot! The Balboa is a two-wheeled balancing robot platform that is small enough to tempt you to run it on a desktop, but it’s quick enough that you should probably stick to bigger, softer surfaces. Or at least put a safety net or foam pit around your desk. Here is a short video showing it kicking up into balancing position and driving around:
A look inside the external gearbox on the Balboa 32U4 Balancing Robot.
One of our main goals in designing our robots is to make them complete and engaging on their own while making them open and expandable enough for all kinds of projects. We also don’t want them all to be the same. Most of the Balboa robots in our pictures have 80 mm wheels, but the chassis can also work with our 90 mm wheels (and to a lesser, barely practical extent, our 70 mm wheels). Because the chassis is made for our micro metal gearmotors, you have a few options for gear ratios as with our Zumo sumo robots, but what’s really exciting about the Balboa design is that there is an extra stage of gear reduction for which you get five different options (all included, and you can easily change the gear ratio from whatever you initially choose). The design also allows the drive wheels to be supported on ball bearings, reducing the stress on the micro metal gearmotor output shafts.
The Balboa chassis has a built-in battery holder for six AA cells, which typically give you several hours of run time, even if you add some extra power-hungry electronics like a Raspberry Pi.
Balboa 32U4 Balancing Robot with battery cover removed.
The main microcontroller is an Arduino-compatible ATmega32U4, which is powerful enough to read the on-board IMU sensors and encoders and to control the motors to balance the robot; it’s also great for introductory projects like line following or reading an RC receiver to make a radio-control balancing robot. For advanced projects, the Balboa is ready for you to add a Raspberry Pi computer to perform high-level algorithms while the ATmega32U4 microcontroller takes care of low-level tasks like motor control.
We will be adding more content to the Balboa’s product page and user’s guide, and we will have more blog posts about the Balboa robot. For today, we’ll end with some slow-motion footage of Balboa popping up on its own and then recovering when Paul knocks it around a bit:
At Pololu we maintain around thirty open-source Arduino libraries, and we keep adding new ones whenever we make a new carrier board or Arduino shield. People typically use these libraries with Arduino-compatible boards, such as our A-Star programmable controllers or Arduinos. We also have Arduino libraries for our user-programmable robot kits like the Romi 32U4 robot, Balboa 32U4 robot and Zumo 32U4 robot.
Sometimes we need to make changes to a lot of libraries at once, like when we wanted to add all of our libraries to the Arduino Library Manager. For us, library manager compatibility requires changing the directory layout, but doesn’t require changing the library or example code. With this many libraries to change, there is a risk of potentially breaking a working library by misspelling or moving a file incorrectly. Fortunately, customer Walt Sorensen introduced us to PlatformIO and Travis CI, which let us test compiling Arduino libraries every time they are pushed to GitHub.
Setting this up is easy enough that we encourage you to do it on your Arduino libraries! First, sign up for Travis CI (a testing service, free for open-source projects) and enable it for the GitHub repository you want to test. Now, every time you push new code to your repository, Travis CI will try to see if there is a .travis.yml file in the top level with instructions for running tests.
If your project has the structure of an Arduino Library Manager project and you have at least one example sketch, our short .travis.yml file should work. This file instructs Travis CI to compile the library and its examples against all the supported Arduino boards (specified in the “env” list of the .travis.yml file). The results can be seen on Travis CI’s website (for example, here is Pololu’s Travis CI page). The Arduino compiler is provided by PlatformIO, an open source ecosystem for internet-of-things development, which supports a long list of Arduino-compatible boards.
You can share your Travis CI build status by embedding a badge into your GitHub readme page:
Of course, for most library changes, we still have to test on actual hardware, but now every time we update our libraries (or a contributor submits a pull request), we can be sure they will at least compile on every supported board.
What do you need to turn a Romi chassis into a functioning robot? Here are some Romi projects from the community, as well a couple of our example builds:
A variety of controllers can be used with the Romi, but until now you have had to figure out lots of wiring to connect everything together. You will always need some wiring to connect your own sensors or other devices, but we have been trying to make it easier to get started, beginning with the Romi power distribution board and motor driver board, which help simplify some of the more difficult parts. Our new Romi 32U4 Control Board is the culmination of this product line: a complete controller solution for the Romi that integrates power, motor control, and an Arduino-compatible microcontroller.
Romi power distribution board, motor driver board,
Here is how it looks when connected to a Romi Chassis with motors and encoders plugged in, as well as the optional LCD:
Features of the Romi 32U4 Control Board
Pinout diagram of the Romi 32U4 Control Board (ATmega32U4 pinout, peripherals, and board power control).
- Reverse-protected battery power switch circuit
- Powerful 5 V, 2 A switching regulator
- Dual 1.8 A DRV8838 motor drivers
- ATmega32U4 microcontroller with Arduino-compatible USB bootloader
- 16 free general-purpose I/O ports including 10 analog inputs
- LCD connector
- Three user buttons
- Five indicator LEDs (2 for power, 3 user-controllable)
- Battery voltage monitoring
- Quadrature encoder inputs
- Four general-purpose level shifters
- 3-axis I²C accelerometer
- 3-axis I²C gyroscope
- Raspberry Pi connector with I²C interface and HAT EEPROM
Raspberry Pi interface
Microcontrollers like the ATmega32U4 are great for fast, timing-sensitive operations such as reading sensors or driving servos, but their computing power is very limited compared to devices like the Raspberry Pi. That is why we built a Raspberry Pi interface into this board: to give you the option to expand your robot beyond what is possible with a microcontroller. This could be useful for anything from advanced applications like computer vision or room mapping to simply letting your robot share status updates on Twitter. Here is a Romi assembled with a Raspberry Pi:
When connected, the control board supplies power to the Raspberry Pi and connects to it as an I²C slave device. We include the ID EEPROM required by the HAT specification, though we have not found it particularly useful, so we ship it blank and unlocked for you to experiment with.
Our Arduino library gives example code for I²C connectivity, and you can check out our Raspberry Pi tutorial for the A-Star 32U4 Robot Controller, which we will be updating for the Romi 32U4 Control board.
For more information about the Romi 32U4 Control Board or to order, please see its product page.