Posts tagged “arduino”
You are currently viewing a selection of posts from the Pololu Blog. You can also view all the posts.
A while ago, I made a wedding gift for some friends, both of whom are avid Star Wars fans. The gift was basically a multi-piece decorative set that consisted of a modified toy Han Solo blaster, a stand to hold the blaster, and three edge-lit LED displays: one each of Boba Fett, Darth Vader, and Jar Jar Binks. I painted over the toy blaster to make it look more like it came straight out of the movies and added electronics so that it could interact with the displays (and the couple’s TV!).
The blaster uses IR TV remote codes to do several things: it can shoot the LED displays (and they’ll respond by blinking and playing audio recordings unique to each character), change the color and brightness of each display, and it can act as a limited TV remote by turning on or off the TV. At the heart of the blaster lies an A-Star 32U4 Mini ULV, which monitors the state of a switch, a couple of buttons, and a few potentiometers in order to decide which actions to carry out. The ULV version of the A* Mini is especially convenient for this setup because the toy blaster was originally powered by two AAA batteries, which produce too low of a voltage for a 5V microcontroller. The ULV’s built-in switching step-up voltage regulator allows it to operate directly off of the batteries and power the other components, unlike typical Arduinos that need at least 7V.
The blaster has two modes: one for shooting the displays and turning on/off the TV and another for adjusting color and brightness of the displays. Which mode the blaster is in is determined by the state of the programming mode switch, which is accessible with a flick of the thumb. While powered on, the A* continually checks to see if the programming mode switch is enabled. If it is disabled, the blaster will respond to trigger presses. When the trigger is depressed, the A* does two things: it sends a pulse train to a 5mm IR LED and drives an input pin low on an Adafruit Audio FX Mini sound board, which then outputs sound to a speaker through a 2.5W audio amplifier, producing DL-44 blaster firing noises. The blaster and displays use the IRremote Arduino library for sending and receiving the pulses. For these blaster shots, the blaster emits the IR TV remote code that corresponds to the generic power-on/power-off code for an LG TV. This same code is decoded by the Star Wars displays as a “hit” and the characters react to being shot. You can watch videos of those reactions in the YouTube playlist below (the playlist also includes the displays’ bonus Easter egg content, which is only accessible by sending certain button presses from the LG TV remote!). The sound level is a little low, so you might need to increase your volume to hear what the characters are saying:
If the programming mode switch is enabled, the blaster repeatedly emits a set of IR TV remote codes that contain information on what color and how bright the displays should be. Color is adjusted in the HSV color space using the blaster’s three rotary potentiometers (one each for hue, saturation, and value). There is also a linear potentiometer that can be used to set overall brightness (this effect combines with the change in brightness from adjusting the value potentiometer). So long as a display’s IR receiver can detect the IR signal sent by the blaster, the LED information can be decoded and the LED arrays can be updated.
Each display features a ~12″ tall profile of the head or upper body of a Star Wars character. The profiles are laser-etched onto a 1/2″ thick clear acrylic piece, which also has holes at its base. The holes allow the piece to be fastened to a recessed channel at the top of the display box. A short segment of an APA102C LED strip lines the bottom of the recessed channel and faces upward into the acrylic profile, which allows its light to disperse across the laser-etched surfaces. The display box has the same sound board and amplifier as the blaster, but uses a more powerful 1W speaker. An A-Star 32U4 Prime controls everything and power is supplied via a 9V 3A wall power adapter.
Compared to the rest of the system, the design of the blaster stand is pretty straightforward: it is just several pieces of 1/4″ plywood arranged into a frame that houses two channels. Those two channels have mounting holes which allow two clear acrylic pieces, which conform to the shape of the blaster, to be fixed to the frame. A lip along the inside of the frame makes it easy to mount the silver mirrored acrylic piece. The bottom of the mount features a personal well-wish from me to the couple. The message is written on the inside of the Alliance Starbird, which is cut from gold mirrored acrylic. The stand also houses some scrap metal parts (a bunch of prototype Zumo blades) to give it some weight. Four adhesive rubber feet, one for each corner of the stand, help make sure the stand doesn’t slide around easily and scrape the gold Starbird piece.
I owe a part of the inspiration of this gift to my coworker, Kevin, since in some ways I was basically trying to one-up his Harry Potter-themed wedding gift, which was given to another coworker, Brandon, for his wedding. Kevin also ended up helping me make some good decisions and generate some clean-looking CorelDraw files for the display cutouts/rastering. So, thanks, Kevin! You the real MVP.
Because of how complex the VL53L1X is and how difficult it is to learn how it works, developing a library for it has been more of a challenge than writing one for a typical sensor like an LSM303 accelerometer/magnetometer. Continued…
For my birthday, I am excited to share two new products to help get your projects moving: dual motor driver boards for Arduino and for Raspberry Pi based on Maxim MAX14870 drivers, which on these boards (without additional cooling) can power motors with a continuous 1.7 A (2.5 A peak) from a voltage source anywhere from 4.5 V to 36 V. This makes the driver ideal for powering a wide range of motors including our high power micro metal gearmotors, and our 12 V 20D mm metal gearmotors. We like the MAX14870 so much that already we make a single driver carrier for it, and we use it on our A-Star 32U4 Robot Controller SV. These new boards make it easy to control two motors using the MAX14870 with an Arduino or Raspberry Pi.
The Dual MAX14870 Motor Driver Shield for Arduino is designed to plug directly into an Arduino or another microcontroller board with the Arduino form factor. It connects the Arduino I/O pins to the two-pin speed/direction interfaces as well as the fault output pins, and our open-source library is available to help you get started. The shield can be set up to power your Arduino device from your motor power supply, which is especially helpful if you are using an Arduino or compatible device with an operating voltage similar to that of the MAX14870, such as our A-Star 32U4 Prime SV. Additionally, the board can be customized to use the advanced features of the MAX14870 drivers or change the pin mappings.
The Dual MAX14870 Motor Driver for Raspberry Pi has many of the same features as the Arduino version, but it is designed to plug into the GPIO header on a compatible Raspberry Pi (Model B+ or newer), including the Pi 3 Model B and Model A+. We provide an open-source Python library to make it easy to interface with the board. This board also has a location to connect a step-down 5 V regulator to power the Raspberry Pi from your motor’s power supply.
I am really excited about these boards because the Raspberry Pi expansion board is the first PCB I ever designed, and the Arduino shield was designed by my friend David S. Both of us are engineering students at the University of Nevada, Las Vegas who work at Pololu to complement our studies. It has been a great experience for us to learn how to design these products from the development engineers here at Pololu. Plus, getting to share these products for the first time with you is a fun way to celebrate my birthday!
As usual for our new product releases this year, we’re offering an extra introductory discount: the first 100 customers to use coupon code MAX14870INTRO can get any mix of up to 3 of these boards for $7.77 each. (Click to add the coupon code to your cart .) Note that this introductory offer applies only to the units without connectors soldered in.
Our new programmer, the Pololu USB AVR Programmer v2.1, was supposed to be a minor update to our existing programmer, coming right after the A-Star 328PB Micro that we released last month, with the main point of excitement being the Las Vegas-inspired $7.77 price. But as we were testing the combination of the programmer with the A-Star, we were getting brown-out resets on the programmer when it powered the A-Star. The relevant part of the circuit was just a P-channel MOSFET that connected the programmer’s own logic voltage (which we call VDD) to the VCC pin of the ISP connector:
MOSFET-based target VCC power control used on Pololu USB AVR Programmer v2.
The problem was caused by the MOSFET turning on too well (quickly and with low resistance), causing the logic voltage on the programmer to drop if the VCC of the target device had more than a few µF of discharged capacitance on it. The bigger the capacitance on VCC, the bigger the voltage drop on VDD, until eventually the drop was big enough to trigger the brown-out reset protection on the programmer’s microcontroller. We tried various firmware tricks with our existing hardware, such as turning on the MOSFET for very short pulses to gradually charge up the target device’s VCC capacitance, but none of them worked reliably enough. So in the end, we decided to redo our PCB and put in a dedicated high-side power switch with a controlled slew rate. The new programmer can now power target boards with up to about 33 µF on their logic supplies.
These are the two other improvements we made to the new v2.1 programmer over the older v2 programmer:
- Plugging a v2 programmer into a 3pi robot could cause one of the motors to briefly run at full speed because the programmer’s circuitry for measuring VCC could inadvertently pull up one of the 3pi’s programming pins (which doubles as a motor driver input) before the GND connection was established. The v2.1 programmer has improved circuitry for measuring VCC which limits the duty cycle of this effect to about 0.2%, so the motor won’t move (but it might make a 25 Hz clicking sound).
- The v2 programmer would typically brown-out if a 5 V signal was applied to its RST pin while it was operating at 3.3 V. The v2.1 programmer does not have this problem.
The v2.1 programmer is otherwise identical to the v2 programmer, which means it’s a USB AVR microcontroller programmer that can program targets at 3.3 V and 5 V and offers an extra UART-type TTL serial port (like the popular FTDI USB-to-serial adapters) that can be super handy for debugging, bootloading, or even general connection of your project to a USB port.
Pololu USB AVR Programmer v2.1, labeled top view.
The v2 programmer was already a good deal at under $12, but at $7.77, and with free shipping in the USA, we hope to make AVR development extremely accessible. The manufacturing improvements and other cost reduction initiatives I have been blogging about this year help us make this offer without losing money on it, but I am not expecting to be making money directly off of the programmers, either. My goal is to give you the best value in a basic tool you will use over and over as you build your own projects, with the hope that that will help you keep Pololu in mind the next time you need some electronics or robotics parts.
And, as usual for our new product releases this year, we’re offering an extra introductory discount: the first 100 customers to use coupon code AVRPROGINTRO get that already great $7.77 price dropped to $5.55 (limit 2 per customer). (Click to add the coupon code to your cart.)
Today we are releasing our newest A-Star programmable controller, the A-Star 328PB Micro. It is basically our version of the ubiquitous Arduino Pro Mini type products, but with the newer ATmega328PB microcontroller. The board itself is pretty straightforward (though the updated AVR is exciting), so the main thing I want to share in this post is our history with the Atmel ATmega328PB microcontrollers (this was before Microchip acquired Atmel) and how this product would not have existed without our lower-cost manufacturing initiative that I have been discussing.
We have been using the ATmega8, and then the ATmega48, ATmega168, and ATmega328P, since 2004 in many of our user-programmable products because of their versatility and excellent free compiler support (which also made Arduino possible). We first heard about the ATmega328PB in early 2014. The product kept being delayed, and I did not get a quote for them until October 2015. I ordered a reel right away; it arrived in March 2016. Over those two years, we put our AVR-related efforts into the ATmega32U4, releasing several A-Star 32U4 programmable controllers and using it on robots like the Zumo 32U4. The ATmega32U4 was a superior part with native USB and more I/O lines, making it a better fit for many of our applications. By the time we finally got the ATmega328PB parts, we had the A-Star 32U4 Micro available for just $12.75, making it less exciting to put effort into a lower-performance product that might end up costing almost the same amount.
Original ATmega168-based Baby Orangutan robot controller from 2005 (left) next to A-Star 32U4 Micro boards.
The new manufacturing equipment I ordered in the fall of 2017, along with the availability of our latest AVR programmer, brought attention back to the feasibility of a basic ATmega328PB carrier. I was hesitant to put effort into a product where we could not offer something substantially more compelling than what was already available. Despite the ATmega328PB being out in the wild for almost two years, it still had not really made it into many Arduino products, so I thought that perhaps we could offer something there. But more importantly, I wanted to see how low we could price it. I was aware of Arduino Pro Mini clones available on eBay and the AliExpress-type sites for under $3. Most official Arduino Pro Mini type products cost more like $10. For this project to be worthwhile, I wanted to get under $5.
It turns out we had to squeeze quite a bit just to get to the upper limit of that “under $5” goal, and so we are releasing this product at a unit retail price of $4.95. It’s not the under-$3 you can find for the absolute cheapest clones, but if you get the A-Star 328PB Micro from us, you are getting a well-supported, well-made product (each unit is 100% automatically visually inspected and 100% functionally tested) and supporting a company that is doing more than just copying products that are already out there.
It is my hope that by being able to offer the A-Star 328PB Micro for under $5, we are offering something meaningful, giving you a new option for general-purpose controllers at the price of a cheap lunch. I am interested to hear what you think. Is the 328PB interesting when you can get USB for not much more? Is the price low enough for you to buy from us instead of getting it from China?
We are offering the A-Star 328PB Micro in four voltage and frequency combinations:
- 5 V, 16 MHz (blue power LED)
- 5 V, 20 MHz (red power LED) Note: See item-specific page for speed warning.
- 3.3 V, 8 MHz (green power LED)
- 3.3 V, 12 MHz (yellow power LED)
A-Star 328PB Micro pinout diagram.
The A-Star 328PB Micro provides access to all 24 I/O lines of the microcontroller and ships with an Arduino-compatible serial bootloader; you can also use an AVR in-system programmer (ISP) for access to the entire chip. We recommend our USB AVR Programmer v2, which supports both programming interfaces and can be configured to run at either 3.3 V or 5 V.
Last but not least, we are continuing our plan of offering new products at the highest quantity price break at single unit quantities as an introductory celebration. That means that for the first 100 customers, you can get an A-Star 328PB Micro for just $3.87! (Must use coupon code AS328PBINTRO; click to add the coupon code to your cart.)
While we assemble (and design and document and ship and support) the boards here in Las Vegas, we still get the bare PC boards from China, where they are currently on holiday celebrating Chinese New Year. That is constraining how many units we can make at the moment, so we are limiting shipments to 5 units per customer. However, the introductory coupon has no quantity limit, and you can order more than five at that price if you would like. Backordered units are likely to ship within a few weeks.
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.