Monthly Archives: February 2019

The MP3 Music Box

via SparkFun: Commerce Blog

SparkFun employees and customers are constantly building really cool, fun projects. As a SparkFun employee overseeing our Supply Chain, I am exposed to and inspired by these on a regular basis, but the step from appreciating to making can be a big one. When I saw the new SparkFun Qwiic MP3 Trigger release a few weeks ago, I was finally nudged to do my own project.

I have two daughters, ages three and five, and they love Disney songs. I wanted to build a music playback device for them that was simple, self contained and loaded with both some of their favorites and an updateable playlist. The other challenge is that they can’t read yet. I have had the idea in the back of my head for a while, but when I read through the MP3 Trigger Hookup Guide I knew this was the thing to use.

SparkFun Qwiic MP3 Trigger

SparkFun Qwiic MP3 Trigger

DEV-15165
$19.95

The Qwiic MP3 Trigger has an amazing feature for beginners: a pre-programmed tool set that allows for basic playback with no additional coding. This is great if you want to build something, but aren’t quite ready to dive into world of Arduino coding and loading programs onto a board. There is a lot of info on the more advanced capabilities of the board in the hookup guide, but if you skip down to the Example 1: Play Track 1 section, you'll learn the basics you need for this build.

There are four trigger pins on the side of the MP3 Trigger board. When you connect a Pin to the corresponding Ground, it triggers the numbered MP3 track on the microSD card. The pins are also additive, so if you trigger one and four at the same time, track five will play. You can play up to ten tracks in this way with the default programming. The MP3 tracks need to be named T001.mp3, T002.mp3, etc., for the program to recognize them.

For my project, I wanted to attach a button to each of the pins. I went with four colors of our Concave Buttons - red, yellow, green and blue - that are bright and easy for small hands to press. These buttons are also great because they can be screwed onto a panel or box lid. This style of button is a momentary push button. When you press it down, it completes the circuit between the COM pin and the NO pin on the bottom of the switch (I recommend checking out the Switch Basics Guide). If you run a wire from GND on the board to COM on the button, and from Pin 1 on the board to NO on the button, you have a functional switch! The switch portion of the button can be removed from the button itself for ease of soldering, and for mounting the buttons.

Buttons screwed through cut holes in the cardboard box lid, switches removed.

Buttons screwed through cut holes in the cardboard box lid, switches removed

For the speaker you can go basic with two wires and a <1.4W speaker, or you can connect some speakers with the 3.5mm audio jack. I picked up a cheap pair of computer speakers because I wanted to be able to control the volume externally and have louder playback for my daughters’ dance parties.

After attaching the switches to the board with some wires, you’re pretty much done. Just load some MP3s onto a microSD card with the proper track names, slide that into the socket on the back of the board, and attach your selected speaker. I’m powering my board with a USB-C power adapter from a phone, but you can also use a USB-A to C cable, or a basic USB 1A wall charger.

Qwiic MP3 Trigger all hooked up.

The Qwiic MP3 Trigger all hooked up!

I decided to use one of our red boxes as an enclosure; it has enough surface space for the four buttons, and I was also able to make two side compartments to nestle the computer speakers in. I cut a slot in the side for the speaker volume knob, and a hole in the back for the power cords to come out. Everything is now contained in an easily transportable package.

The completed Music Box.

The final product, the MP3 Music Box is complete!

Note: Not listed: Soldering Iron, Solder, Wires, & Speakers

Overall I was happy how this worked out! It took a Saturday afternoon, and my girls helped me pick out songs and watched while I worked on it. My soldering and wiring were a little messy, but it was fun and the girls were thrilled with the result!

I’ll probably build a more advanced version at some point in the future. I’m envisioning finding a nice jewelry box and trying to incorporate something into that for my older daughter. Maybe something that plays a random song when opened… and lights! I’m also curious to try and incorporate the Qwiic Micro OLED to display song info as she learns to read. Thank you so much for reading about my first project foray!

comments | comment feed

New product: 24V Step-Up/Step-Down Voltage Regulator S18V20F24

via Pololu Blog

The 24V Step-Up/Step-Down Voltage Regulator S18V20F24 is the newest addition to our line of S18V20x step-up/step-down voltage regulators.

This 24 V fixed-voltage version is a minor modification of the 9 V to 30 V adjustable version we have been making for years. We can make custom-voltage versions of most of our regulators, and this particular unit was initially one of those customizations we routinely offer. However, since 24 V seems like it might be common enough to be interesting to other customers, we have made it a stock product. Since we assemble these at our Las Vegas, Nevada facility, we can often make simple customizations that only require component changes within a few days. Besides changing output voltages on regulators, these changes could include changing LED colors, omitting components such as pull-up or pull-down resistors, and substituting components with higher temperature ratings or better tolerances. (We offer more involved customizations that require modified board layouts or new firmware features, but those take longer and have higher up-front engineering costs.)

Pololu electronics manufacturing area with multiple pick and place lines.

For those of you interested in the details of the actual product, the S18V20F24 efficiently produces a fixed 24 V output from input voltages between 3 V and 30 V while allowing a typical output current of up to 2 A when the input voltage is close to the output voltage. Its ability to convert both higher and lower input voltages makes it useful for applications where the power supply voltage can vary greatly, as with batteries that start above but discharge below the regulated voltage. Other features include integrated reverse-voltage protection, over-current protection, over-temperature shutoff, and under-voltage lockout.

Typical efficiency of Pololu 24V step-up/step down voltage regulator S18V20F24.

Typical maximum output current of Pololu fixed voltage step-up/step-down voltage regulators (S18V20F5, S18V20F6, S18V20F9, S18V20F12, and S18V20F24).

Alternate versions of this regulator include a fixed 5 V, 6 V, 9 V, or 12 V output or an adjustable 4 V to 12 V or 9 V to 30 V output. Our full selection of regulators and power supplies can be found here.

New products: 16 more QTR reflectance sensor arrays

via Pololu Blog

Our rapidly growing selection of new QTR sensors now includes high-density (HD) versions with 13 and 25 channels, and medium-density (MD) versions with 7 and 13 channels. These QTR sensors are well suited for applications that require detection of changes in reflectivity. This change in reflectivity can be due to a color change at a fixed distance, such as when sensing a black line on a white background, as well as due to a change in the distance to or presence of an object in front of the sensor. Just like the 16-channel medium-density arrays we released in December, the 13-channel medium-density modules use PCBs specifically designed for an 8 mm pitch that allow separate control of the odd and even emitters, which gives you extra options for detecting light reflected at various angles. They have the same board dimensions (101 × 16.5 mm) and mounting hole locations as the high-density (4 mm pitch) 25-channel arrays, but the pinout is different.

Each of these is available with two sensor options—traditional QTR and high-performance, low-current QTRX—and with analog or digital (RC) outputs, making 16 new products in all. Check out the QTR reflectance sensor category to see our full selection of new-style QTRs with black PCBs, which now stands at 96 varieties, and don’t forget to use our QTR introductory promotion to get 50% off any of these new sensors! (Limited to the first 100 customers who use coupon code QTRINTRO, limit 3 per item per customer.)

Friday Product Post: CAN You CAN-CAN Like Offenbach?

via SparkFun: Commerce Blog

We have a lot of great new products for the week, but first and foremost we are starting with two shields for the SparkFun AST-CAN485 Dev Board, allowing for wireless possibilities and more I/O ports. After that, we have three Qwiic-enabled boards developed by Zio. Last up, as you requested, we have a new GNSS Multi-Band Antenna!

As a reminder, we have launched our Brand Ambassador program! If you are interested in joining the SparkFun team as someone who helps promote us and our products at conventions, online and at makerspaces, head over to our Brand Ambassador page to fill out an application!

Can you hear Galop Infernal? We know we can!

SparkFun AST-CAN485 WiFi Shield

SparkFun AST-CAN485 WiFi Shield

WRL-14597
$16.95

The AST-CAN485 Dev Board brings CAN (Control Area Network) and RS485 to a small, Pro Mini form factor with the ability to interface to 24V input and outputs. When looking to save space, losing the communication cable is one of the best options, and the SparkFun AST-CAN485 WiFi Shield does just that. With screw terminal connectors for RS-485 and a U.FL connector, this board supplies solid solutions for working wirelessly in automation, an environment famous for being noisy and unforgiving on electronics.


SparkFun AST-CAN485 I/O Shield (24V)

SparkFun AST-CAN485 I/O Shield (24V)

DEV-14598
$19.95

The SparkFun AST-CAN485 I/O Shield allows you to use the AST-CAN485 Dev Board with 24VDC inputs and outputs, a popular voltage level for industrial automation devices, as well as 5V devices. By providing screw terminals, the board can easily and safely interface with I/O in a semi-permanent manner, which allows for inputs, outputs, or the board itself to be swapped out. With all pins pre-populated with either females pin headers or screw terminals, setup time is minimized.


SparkFun AST-CAN485 Dev Board

SparkFun AST-CAN485 Dev Board

DEV-14483
$44.95
4

Of course, if you need the SparkFun AST-CAN485 Dev Board, it is still available! This development board is a miniature Arduino in the compact form factor of the Pro Mini. In addition to all the usual features that a mini Arduino has, it possesses onboard CAN and RS485 ports, enabling quick and easy interfacing to a multitude of industrial devices. The CAN485 Dev Board bridges the gap between the maker and industrial spaces!


Zio Ultrasonic Distance Sensor - HC-SR04 (Qwiic)

Zio Ultrasonic Distance Sensor - HC-SR04 (Qwiic)

SEN-15171
$13.95

You may be familiar with the classic HC-SR04 distance sensor; it’s great for providing non-contact distance readings from 2cm to 400cm. This board improves on the classic by adding a Qwiic connector to it, so you can communicate over I2C. If you prefer to bypass the Qwiic connector and I2, you can also access the Trigger and Echo pins which are broken out on the edge of the board.


Zio Current and Voltage Sensor - INA219 (Qwiic)

Zio Current and Voltage Sensor - INA219 (Qwiic)

SEN-15176
$7.95

The Zio Current and Voltage Sensor is a highly accurate current and power monitor. Utilizing the INA219, it’s able to read DC current and power over I2C with up to 1 percent precision. This is a great fit for a variety of applications, including estimating battery life, tracking solar power generation or monitoring electricity consumption.


Zio Haptic Motor Controller - DRV2605L (Qwiic)

Zio Haptic Motor Controller - DRV2605L (Qwiic)

ROB-15181
$22.95

Haptic feedback can add a more professional level of interaction to your project. The same satisfying vibration you get when you receive a text message or install a new app can be brought to your project using the Zio Haptic Motor Board. The board features both the motor and motor driver paired with the Qwiic interface to make adding haptic feedback simple.


GNSS Multi-Band Magnetic Mount Antenna - 5m (SMA)

GNSS Multi-Band Magnetic Mount Antenna - 5m (SMA)

GPS-15192
$64.95

The ANN-MB-00 GNSS multiband antenna is unique to other GNSS/GPS antennas in that it is designed to receive both the classic L1 GPS band and the newly launched (started in 2005) L2 GPS band. Additionally, the ANN-MB-00 from u-blox is extremely well built, with a magnetic base with mounting holes for additional anchoring for the harshest environments.


Alrighty, that’s it for this week! As a reminder, if you are interested in becoming a SparkFun Brand Ambassador, follow this link to fill out an application! As always, we can’t wait to see what you make! Shoot us a tweet @sparkfun, or let us know on Instagram or Facebook. We’d love to see what projects you’ve made!

We’ll be back next week with even more fantastic new products!

comments | comment feed

Enginursday: Using Both ESP32 Cores

via SparkFun: Commerce Blog

For the last year I’ve been working on and off on my OLED clock code. If you haven’t read my previous blog posts, you can read about part one here, and a follow up here. But as a quick overview, I’ve been working on a clock that uses our ESP32 Thing to communicate with a Network Time Protocol (NTP) server to get the current time and display it on my OLED displays. With the WiFi radio, I can also scan for the available access points and provide the password to the access point I’m trying to connect to. The problem is the scan takes a few seconds to complete, and during that time, the displays freeze until the scan is complete.

wifi configuration page

Occasionally, some of the NTP servers from this list can go offline without a warning. So as a backup, I check all of the servers until I receive a UDP packet. With a 1000ms timeout, if I lose my Internet connection, I have to wait 14 seconds before I’m able to update the time again. As a workaround, I tried updating the time after each failed attempt, but everything I tried resulted in the ESP32 crashing and rebooting.

NTP code

That’s when I had fellow Funion Engineer Andy recommend I use the other core of the ESP32. Honestly, I hadn’t thought of that. After doing some digging, I came across this tutorial by RandomNerdTutorials.com. After uploading the duel LED blink code, I started to understand how to use it.

/*********
  Rui Santos
  Complete project details at http://randomnerdtutorials.com  
*********/

TaskHandle_t Task1;
TaskHandle_t Task2;

// LED pins
const int led1 = 2;
const int led2 = 4;

void setup() {
  Serial.begin(115200); 
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);

  //create a task that will be executed in the Task1code() function, with priority 1 and executed on core 0
  xTaskCreatePinnedToCore(
                    Task1code,   /* Task function. */
                    "Task1",     /* name of task. */
                    10000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    1,           /* priority of the task */
                    &Task1,      /* Task handle to keep track of created task */
                    0);          /* pin task to core 0 */                  
  delay(500); 

  //create a task that will be executed in the Task2code() function, with priority 1 and executed on core 1
  xTaskCreatePinnedToCore(
                    Task2code,   /* Task function. */
                    "Task2",     /* name of task. */
                    10000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    1,           /* priority of the task */
                    &Task2,      /* Task handle to keep track of created task */
                    1);          /* pin task to core 1 */
    delay(500); 
}

//Task1code: blinks an LED every 1000 ms
void Task1code( void * pvParameters ){
  Serial.print("Task1 running on core ");
  Serial.println(xPortGetCoreID());

  for(;;){
    digitalWrite(led1, HIGH);
    delay(1000);
    digitalWrite(led1, LOW);
    delay(1000);
  } 
}

//Task2code: blinks an LED every 700 ms
void Task2code( void * pvParameters ){
  Serial.print("Task2 running on core ");
  Serial.println(xPortGetCoreID());

  for(;;){
    digitalWrite(led2, HIGH);
    delay(700);
    digitalWrite(led2, LOW);
    delay(700);
  }
}

void loop() {

}

For my application, I wanted to keep everything WiFi related to core0, while updating the displays was handled by core1. You can see my full code in my GitHub repository, but here’s a snapshot of what I added.

Snapshot of task1 code

You can more or less treat the while loop as a second main loop. By moving my webserver handleClient() function into Task1’s loop, every client is automatically handled by core0. There were a few gotchas for me, however. The time library has the ability to automatically update the time, but it will use core1. I was able to get around this manually updating the time by using a non-blocking, 10-second delay and calling the NTP request function. I also ran into an issue where creating the task caused the ESP32 to crash, which I was able to work around by using vTaskDelay() function. The issue could have also been a result of not changing the size of the stack in the setup.

I’ve been making slow and steady progress, including working on a clock using our new LuMini 8x8 Matrix LEDs that I’m hoping to be able to show off in the near future. But in the meantime, have you used both cores to parallel tasks for your ESP32 project? If this is the first time you’ve heard about using both cores on your ESP32, what could you see it being useful for? Let us know in the comments below!

comments | comment feed

Adding Serial Ports to your SAMD21 Board

via SparkFun: Commerce Blog

Have you ever needed an extra UART, or an extra SPI line? What about that sensor that only has one address, but you need two of them? The SAMD21 boards use what is called Sercoms (Serial Communication). The board definitions in the Arduino IDE will usually define a UART, SPI and I2C port for you, but with six Sercoms, that leaves a few extra for you to play with. Check out our new tutorial on setting up new Serial ports. We use the new Redboard Turbo to control our Serial LCD screens over custom UART, SPI and I2C buses.

Redboard Turbo with serial ports outlined

Adding More SERCOM Ports for SAMD Boards

comments | comment feed