# Daily Cheer Automaton

## Overview

## The Collective Cheer

> The collective cheering ritual started in Wuhan, China, in January and spread across the globe in the virus's wake. Here, it is sometimes accompanied by the song "New York, New York."

- [What NYC Sounds Like Every Night at 7](https://www.nytimes.com/interactive/2020/04/10/nyregion/nyc-7pm-cheer-thank-you-coronavirus.html)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/170/medium800/feather_sculpture-3005670_1280.jpg?1589492757 photo by Erich Westendarp)

Sometimes you can't be around at exactly the right time every day to participate in the collective cheer for healthcare workers. This device will remember for you and participate on your behalf, even if you can't. Sometimes we can all use a helping hand.&nbsp;

This project creates an automatic cheering device that will play an MP3 of a crowd cheering every day starting at 7 PM.

We've designed this project around the [Feather system of boards](https://www.adafruit.com/feather), which makes the components modular and easy to put together and expand upon. It can be easily modified to play any MP3 of your choice, and to go off at any time of your choice.

# Daily Cheer Automaton

## Arduino version

There is an Arduino version and CircuitPython version of this project, and they each use different hardware.

The Arduino version uses a Music Maker FeatherWing for MP3 playback and an Adalogger FeatherWing to keep track of the time.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/329/medium800/feather_autocheer_arduino.jpg?1589854802)

# Daily Cheer Automaton

## Parts List

### Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0

[Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0](https://www.adafruit.com/product/2772)
Feather is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Feather M0 Basic Proto** ,&nbsp;it has a bunch of prototyping space...

In Stock
[Buy Now](https://www.adafruit.com/product/2772)
[Related Guides to the Product](https://learn.adafruit.com/products/2772/guides)
![Angled shot of a Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0. ](https://cdn-shop.adafruit.com/640x480/2772-09.jpg)

The Feather M0 Basic Proto is recommended here, but nearly any fast [Feather board](https://www.adafruit.com/feather) should work!

### Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards

[Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards](https://www.adafruit.com/product/2922)
A Feather board without ambition is a Feather board without FeatherWings! This is the **Adalogger FeatherWing** : it adds both a battery-backed Real Time Clock and micro SD card storage to any Feather main board. Using our [Feather...](https://www.adafruit.com/products/2830)

In Stock
[Buy Now](https://www.adafruit.com/product/2922)
[Related Guides to the Product](https://learn.adafruit.com/products/2922/guides)
![Adalogger FeatherWing with Real time clock and SD card slot.](https://cdn-shop.adafruit.com/640x480/2922-11.jpg)

### Adafruit Music Maker FeatherWing - MP3 OGG WAV MIDI Synth Player

[Adafruit Music Maker FeatherWing - MP3 OGG WAV MIDI Synth Player](https://www.adafruit.com/product/3357)
Bend all audio files to your will with the **Adafruit Music Maker FeatherWing**! It's a fun-size version of our [Music Maker&nbsp;shield for Arduino](https://www.adafruit.com/product/1790)!&nbsp;This powerful wing features the VS1053, an encoding/decoding (codec)...

In Stock
[Buy Now](https://www.adafruit.com/product/3357)
[Related Guides to the Product](https://learn.adafruit.com/products/3357/guides)
![Adafruit Music Maker FeatherWing - MP3 OGG WAV MIDI Synth Player connected to a half sized breadboard and a set of headphones. ](https://cdn-shop.adafruit.com/640x480/3357-01.jpg)

### FeatherWing Tripler Mini Kit - Prototyping Add-on For Feathers

[FeatherWing Tripler Mini Kit - Prototyping Add-on For Feathers](https://www.adafruit.com/product/3417)
This is the **FeatherWing Tripler** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are three! The magic of the Tripler comes when you want to connect your Feather to...

In Stock
[Buy Now](https://www.adafruit.com/product/3417)
[Related Guides to the Product](https://learn.adafruit.com/products/3417/guides)
![Triple prototyping feather wing PCB with socket headers installed](https://cdn-shop.adafruit.com/640x480/3417-05.jpg)

### SD/MicroSD Memory Card (8 GB SDHC)

[SD/MicroSD Memory Card (8 GB SDHC)](https://www.adafruit.com/product/1294)
Add mega-storage in a jiffy using this 8 GB class 4 micro-SD card. It comes with a SD adapter so you can use it with any of our shields or adapters. Preformatted to FAT so it works out of the box with our projects. Tested and works great with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1294)
[Related Guides to the Product](https://learn.adafruit.com/products/1294/guides)
![Hand removing/installing micro SD card from SD adapter](https://cdn-shop.adafruit.com/640x480/1294-03.jpg)

### CR1220 12mm Diameter - 3V Lithium Coin Cell Battery

[CR1220 12mm Diameter - 3V Lithium Coin Cell Battery](https://www.adafruit.com/product/380)
These are the highest quality & capacity batteries, the same as shipped with the iCufflinks,&nbsp;iNecklace, Datalogging and GPS Shields, GPS HAT, etc. One battery per order (you'll want one battery per cufflink or pendant.)  
  
Brand may vary but all battery brands are verified...

In Stock
[Buy Now](https://www.adafruit.com/product/380)
[Related Guides to the Product](https://learn.adafruit.com/products/380/guides)
![Angled shot of CR1220 12mm Diameter - 3V Lithium Coin Cell Battery - CR1220.](https://cdn-shop.adafruit.com/640x480/380-01.jpg)

# Daily Cheer Automaton

## Assembly

You'll need a [soldering iron and solder](https://learn.adafruit.com/adafruit-guide-excellent-soldering).

We are building this project around the [FeatherWing Tripler](https://github.com/adafruit/Adafruit_CircuitPython_VS1053/issues/11) to connect the Feather and two FeatherWings.

You could also use [Feather Stacking Headers](https://www.adafruit.com/product/2830) for a different form factor, to have the boards stacked on top of each other rather than next to each other. Decide what you'd like to do, then plan ahead accordingly!

In this example, we'll solder male headers onto the Feather and two FeatherWings, and female headers onto the FeatherWing Tripler.

Follow the instructions for [attaching male headers to your Feather board](https://learn.adafruit.com/adafruit-feather-m0-basic-proto/assembly). It helps to use a [solderless breadboard](https://www.adafruit.com/product/64) to get the headers on straight.

![](https://cdn-learn.adafruit.com/assets/assets/000/090/927/medium800/feather_headers.jpg?1588866488 How to set up your breadboard to solder headers onto Feathers and FeatherWings)

Do the same for the [Music Maker FeatherWing](https://learn.adafruit.com/adafruit-music-maker-featherwing/), attaching **male headers**.

Then attach **male headers** to the [Adalogger FeatherWing](https://learn.adafruit.com/adafruit-adalogger-featherwing/assembly).

Attach **female headers** to the FeatherWing Tripler. You can use one your soldered Feather boards to help keep the female headers straight while you solder.

![](https://cdn-learn.adafruit.com/assets/assets/000/090/938/medium800/feather_IMG_2808.jpg?1588966065 Assembled FeatherWing Tripler)

Place the Feather, Adalogger FeatherWing, and Music Maker FeatherWing into each of the Tripler's slots. The order is up to you, but you may want to consider things which will connect to the device, such as a possible LiPo battery, which would mean placing the Feather on the far right side. Also consider cables that will be connecting to the device, such as a USB cable to the Feather to provide power, or the audio jack output on the Music Maker FeatherWing.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/330/medium800/feather_IMG_3201.jpg?1589855196 Putting it all together)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/331/medium800/feather_autocheer_arduino.jpg?1589855221 The assembled device)

# Daily Cheer Automaton

## Software

## Installing Boards and Libraries

Make sure to use [Arduino IDE 1.6.4 or higher](https://www.arduino.cc/en/Main/Software)&nbsp;and follow [this tutorial](../../../../add-boards-arduino-v164)&nbsp;to install the Adafruit boards.

Download [the code](https://github.com/andydoro/autocheer)&nbsp;from github by clicking&nbsp; **Download ZIP**. Uncompress the file and copy the contents of the **Arduino** folder to your Arduino sketchbook folder.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Daily_Cheer_Automaton/autocheer/autocheer.ino

You will also need to install some Adafruit Arduino libraries. Follow [this tutorial](../../../../adafruit-all-about-arduino-libraries-install-use)&nbsp;if you are unfamiliar with how to do this. You need to install the following Adafruit Arduino libraries:

- [VS1053](https://github.com/adafruit/Adafruit_VS1053_Library) for the Music Maker
- [RTClib](https://github.com/adafruit/RTClib) for the Real Time Clock (RTC)
- [DST\_RTC](https://github.com/andydoro/DST_RTC) for automatic Daylight Saving Time adjustments

All of the libraries should be available through [Arduino's Library Manager](https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/library-manager), or you can [install them manually](https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/how-to-install-a-library).

Once you have installed the libraries and have the correct boards installed, choose your board and check if the code compiles. If the libraries aren't installed correctly you will see errors.

## Audio File & SD Card

You'll also need an audio file for the Music Maker to play! We like [this sample of a crowd cheering for front-line medical staff](http://www.orangefreesounds.com/street-crowd-cheering-and-applauding/).

Rename the audio file **cheer.mp3** and make sure your [SD card is FAT32 formatted](https://learn.adafruit.com/adafruit-adalogger-featherwing/using-the-sd-card). Copy the file onto the SD card and insert into the Music Maker FeatherWing.

## Coin Cell

The Adalogger RTC FeatherWing needs a CR1220 coin cell installed in order to work properly and keep time when the device is unpowered.

## Understanding the Code

Conceptually the daily cheering device is simple: the microcontroller is attached to a clock and an MP3 player. Every second, the microcontroller checks the time. If the hour and minute match the appointed time, the microcontroller will have the MP3 player play an MP3.

The selected time is defined in the code here:

```cpp
// the hour and minute you'd like MP3 to start playing
const int PLAYHOUR = 19; // 24 hour time
const int PLAYMIN = 0;
```

The RTC gives time in [24 hour time](https://en.wikipedia.org/wiki/24-hour_clock), so 7 PM is 19:00.

### Daylight Saving Time

Do you live in a territory that observes&nbsp;[daylight saving time](https://en.wikipedia.org/wiki/Daylight_saving_time) (DST)? If you do, you usually have to reprogram your clocks twice a year! This clock includes some code so that the adjustments are made automatically. The code follows&nbsp;[the current rules for DST in the USA](https://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States) and Canada. If you live somewhere that follows different DST rules you may be able to modify the code to suit your rules— just look in the [DST\_RTC&nbsp;library functions](https://github.com/andydoro/DST_RTC). Wikipedia has [a great reference on daylight saving time rules](https://en.wikipedia.org/wiki/Daylight_saving_time_by_country).

If you live in a territory that doesn't observe daylight saving time, just alter the following line by changing the `1` to`0`.

```cpp
#define OBSERVE_DST 1
```

The daylight saving time code works by keeping the real time clock on "standard time" and checking to see if the current date falls within daylight saving time. If the date falls within daylight saving time, an hour is added to the displayed time to convert from standard time to daylight saving time.

## Troubleshooting

The serial console will be important for debugging. To see all of the serial output from startup, make sure to uncomment:

```cpp
// Wait for serial port to be opened, remove this line for 'standalone' operation
  /*while (!Serial) {
    delay(1);
    }
  */
```

However, this may prevent the device from working until you open the serial console.

You should see some startup messages, and then the date and time from the RTC being printed every second. Make sure the time is set correctly!

### No audio? MP3 not playing?

You should hear a 1 second tone on startup, to let you know that the Music Maker audio chip (VS1053) is working and able to produce sounds.

Otherwise, check the serial console for error messages. Make sure both the VS1053 and SD card are found. The serial console should indicate both `"VS1053 found"` and `"SD OK!"`.&nbsp; The serial console should also print the contents of the SD card, so you can check that to make sure the SD card is being read correctly.

You can always test that your mp3 will play by using the [VS1053 example sketch](https://learn.adafruit.com/adafruit-music-maker-featherwing/play-music). If you're having trouble, try this [tutorial to make sure your audio file is microcontroller compatible](https://learn.adafruit.com/microcontroller-compatible-audio-file-conversion).

# Daily Cheer Automaton

## CircuitPython version

There is an Arduino version and CircuitPython version of this project, and they each use different hardware.

The CircuitPython version uses and M4 Processor running CircuitPython v5.0+ for native MP3 playback, and a Adalogger FeatherWing for its Real Time Clock and SD card.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/158/medium800/feather_autocheer_circpy.jpg?1589470548 Daily Cheer Automaton- CircuitPython version)

# Daily Cheer Automaton

## Parts List

### Adafruit Feather M4 Express - Featuring ATSAMD51

[Adafruit Feather M4 Express - Featuring ATSAMD51](https://www.adafruit.com/product/3857)
It's what you've been waiting for, the Feather M4 Express featuring ATSAMD51. This Feather is fast like a swift, smart like an owl, strong like a ox-bird (it's half ox, half bird, OK?) This feather is powered by our new favorite chip, the **ATSAMD51J19** -&nbsp; with...

In Stock
[Buy Now](https://www.adafruit.com/product/3857)
[Related Guides to the Product](https://learn.adafruit.com/products/3857/guides)
![Angled shot of a Adafruit Feather M4 Express. ](https://cdn-shop.adafruit.com/640x480/3857-10.jpg)

An M4 processor is required to be fast enough to play an MP3.

### Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards

[Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards](https://www.adafruit.com/product/2922)
A Feather board without ambition is a Feather board without FeatherWings! This is the **Adalogger FeatherWing** : it adds both a battery-backed Real Time Clock and micro SD card storage to any Feather main board. Using our [Feather...](https://www.adafruit.com/products/2830)

In Stock
[Buy Now](https://www.adafruit.com/product/2922)
[Related Guides to the Product](https://learn.adafruit.com/products/2922/guides)
![Adalogger FeatherWing with Real time clock and SD card slot.](https://cdn-shop.adafruit.com/640x480/2922-11.jpg)

### FeatherWing Doubler - Prototyping Add-on For All Feather Boards

[FeatherWing Doubler - Prototyping Add-on For All Feather Boards](https://www.adafruit.com/product/2890)
This is the **FeatherWing Doubler** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are two! The magic of the Doubler comes when stacking a Feather and another...

In Stock
[Buy Now](https://www.adafruit.com/product/2890)
[Related Guides to the Product](https://learn.adafruit.com/products/2890/guides)
![Double prototyping feather wing PCB with socket headers installed](https://cdn-shop.adafruit.com/640x480/2890-01.jpg)

### SD/MicroSD Memory Card (8 GB SDHC)

[SD/MicroSD Memory Card (8 GB SDHC)](https://www.adafruit.com/product/1294)
Add mega-storage in a jiffy using this 8 GB class 4 micro-SD card. It comes with a SD adapter so you can use it with any of our shields or adapters. Preformatted to FAT so it works out of the box with our projects. Tested and works great with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1294)
[Related Guides to the Product](https://learn.adafruit.com/products/1294/guides)
![Hand removing/installing micro SD card from SD adapter](https://cdn-shop.adafruit.com/640x480/1294-03.jpg)

### CR1220 12mm Diameter - 3V Lithium Coin Cell Battery

[CR1220 12mm Diameter - 3V Lithium Coin Cell Battery](https://www.adafruit.com/product/380)
These are the highest quality & capacity batteries, the same as shipped with the iCufflinks,&nbsp;iNecklace, Datalogging and GPS Shields, GPS HAT, etc. One battery per order (you'll want one battery per cufflink or pendant.)  
  
Brand may vary but all battery brands are verified...

In Stock
[Buy Now](https://www.adafruit.com/product/380)
[Related Guides to the Product](https://learn.adafruit.com/products/380/guides)
![Angled shot of CR1220 12mm Diameter - 3V Lithium Coin Cell Battery - CR1220.](https://cdn-shop.adafruit.com/640x480/380-01.jpg)

### Breadboard-Friendly 3.5mm Stereo Headphone Jack

[Breadboard-Friendly 3.5mm Stereo Headphone Jack](https://www.adafruit.com/product/1699)
Pipe audio in or out of your project with this very handy breadboard-friendly audio jack. It's a stereo jack with disconnect-switches on Left and Right channels as well as a center ground pin. You can use any 3.5mm stereo cable with this jack. The pins are on 0.1" spacing so it plugs...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1699)
[Related Guides to the Product](https://learn.adafruit.com/products/1699/guides)
![Close-up of 3.5mm stereo headphone jack.](https://cdn-shop.adafruit.com/640x480/1699-00.jpg)

### Header Kit for Feather - 12-pin and 16-pin Female Header Set

[Header Kit for Feather - 12-pin and 16-pin Female Header Set](https://www.adafruit.com/product/2886)
These two&nbsp; **Female&nbsp;Headers** &nbsp;alone are, well, lonely. But pair them with any of our&nbsp;[Feather](https://www.adafruit.com/categories/777)&nbsp;boards and you're in business!

What do they do? They get soldered on either side of the Feather...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2886)
[Related Guides to the Product](https://learn.adafruit.com/products/2886/guides)
![Angled shot of a Header Kit for Feather - 12-pin and 16-pin Female Header Set. ](https://cdn-shop.adafruit.com/640x480/2886-00.jpg)

### 100uF 16V Electrolytic Capacitors - Pack of 10

[100uF 16V Electrolytic Capacitors - Pack of 10](https://www.adafruit.com/product/2193)
We like capacitors so much we made a&nbsp;[kids' show about them.](https://www.youtube.com/watch?v=sy_G1oYRQmM)&nbsp; &nbsp;They're super handy and it's really helpful to have a variety lying around to pick and choose from.

<p...></p...>In Stock
[Buy Now](https://www.adafruit.com/product/2193)
[Related Guides to the Product](https://learn.adafruit.com/products/2193/guides)
![Pack of 10 through hole 100uF 16V Electrolytic Capacitors](https://cdn-shop.adafruit.com/640x480/2193-00.jpg)

we need two 100uF capacitors

### Through-Hole Resistors - 100 ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 100 ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/4293)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 100Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/4293)
[Related Guides to the Product](https://learn.adafruit.com/products/4293/guides)
![Angled shot of 25 Through-Hole Resistors - 100 ohm 5% 1/4W.](https://cdn-shop.adafruit.com/640x480/4293-00.jpg)

we need two 100 ohm resistors

# Daily Cheer Automaton

## Assembly

You'll need a [soldering iron and solder](https://learn.adafruit.com/adafruit-guide-excellent-soldering), as well as some wire.

## Feather Assembly

We are building this project around the [FeatherWing Doubler](https://www.adafruit.com/product/2890) to connect the Feather M4 Express and Adalogger FeatherWing.

You could also use [Feather Stacking Headers](https://www.adafruit.com/product/2830) for a different form factor, to have the boards stacked on top of each other rather than next to each other. Decide what you'd like to do, then plan ahead accordingly!

In this example, we'll solder male headers onto the Feather M4 Express and FeatherWing, and female headers onto the FeatherWing Doubler.

Follow the instructions for [attaching male headers to your Feather board](https://learn.adafruit.com/adafruit-feather-m0-basic-proto/assembly). It helps to use a [solderless breadboard](https://www.adafruit.com/product/64) to get the headers on straight.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/040/medium800/feather_headers.jpg?1589224464)

Do the same for the [Adalogger FeatherWing](https://learn.adafruit.com/adafruit-adalogger-featherwing/assembly), attaching **male headers**.

Attach **female headers** to the FeatherWing Doubler. You can use one your soldered feathers to help keep the female headers straight while you solder.

&nbsp;

## Headphone Jack

We'll be playing the audio from the Feather M4 Express through this [headphone jack](https://www.adafruit.com/product/1699). We'll solder the headphone jack and some other components to the FeatherWing Doubler, under where the Feather M4 Express will go. The Feather M4 Express should go into the right Feather slot, in case you'd like to attach a LiPo battery.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/125/medium800/feather_autocheer2_bb_edit.png?1589393442 Frtizing diagram)

The headphone jack can fit under the Feather M4. I've moved the Feather M4 to the side so we can see where the headphone jack and other components go.

The middle three pins of the headphone will be connected to **ground**. You can connect them to the Doubler ground rail.

The outer pins of the headphone jack should be connected in series through a 100uF capacitor and a 100 ohm resistor to the Feather M4's A0 and A1 pins. Make sure the cathode sides of the capacitors are connected to the headphone jack. The A0 output (in green) will be the audio left channel and the A1 output (in blue) will be the audio right channel.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/111/medium800/feather_autocheer_eagle.png?1589315317 circuit schematic)

Here is a schematic of the circuit. Note that pin 1 of the stereo jack is the middle physical pin. Pins 3 and 4 are the next two inner physical pins. Pins 1, 3, and 4 are all electrically connected to ground. Note that they are **not** connected to pin 2.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/113/medium800/feather_headphone_ds.png?1589316868 diagram from headphone jack datasheet)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/150/medium800/feather_IMG_3026crop.jpeg?1589466392 bottom view of Doubler with middle three pins of headphone jack connected to Doubler ground rail)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/129/medium800/feather_IMG_3025.jpg?1589399853 top view of FeatherWing Doubler)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/127/medium800/feather_IMG_3028_cropped.jpeg?1589397612 the assembled device)

# Daily Cheer Automaton

## Software

## Hardware & Software Requirements

We've written software in [CircuitPython for the Feather M4 Express. This tutorial will get you started](https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51/circuitpython). We need to use an M4 (ATSAMD51 32-bit Cortex M4 core) because it's fast enough to play back MP3s. We also need to use CircuitPython version 5.3.0+. [Follow this tutorial to install a newer version of CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython).

## CircuitPython Libraries

The code requires a few libraries, which we need to use with the Adalogger FeatherWing. [Download The latest bundle](https://circuitpython.org/libraries) and install the libraries listed below into the **lib** folder on your Feather M4 Express:

- **adafruit\_bus\_device** folder
- **adafruit\_register** folder
- **adafruit\_pcf8523.mpy**

## CircuitPython Code

Download [the code](https://github.com/andydoro/autocheer)&nbsp;from github by clicking&nbsp; **Download ZIP**. Uncompress the file and copy **code.py** from the **CircuitPython** folder to your Feather M4 Express **CIRCUITPY** drive.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Daily_Cheer_Automaton/CircuitPython/code.py

## Audio File & SD Card

You'll also need an audio file for the Feather M4 to play! We like [this sample of a crowd cheering for front-line medical staff](http://www.orangefreesounds.com/street-crowd-cheering-and-applauding/).

The Feather M4 doesn't have enough storage space for this audio file, so we'll need to use an SD card. Rename the audio file "cheer.mp3" and make sure your [SD card is FAT32 formatted](https://learn.adafruit.com/adafruit-adalogger-featherwing/using-the-sd-card). Copy the file onto the SD card and insert it into the Adalogger FeatherWing.

## Coin Cell

The Adalogger RTC FeatherWing needs a CR1220 coin cell installed in order to work properly and keep time when the device is unpowered.

## Understanding the Code

Conceptually, the daily cheering device is simple: the Feather M4 Express is attached to a clock. Every second, the Feather M4 Express checks the time. If the hour and minute match the appointed time, the Feather M4 Express will play an MP3 off the SD card.

The selected time is defined in the code here:

```python
# selected time
# 24 hour time
playhour = 19 
playmin = 0
```

The RTC uses [24 hour time](https://en.wikipedia.org/wiki/24-hour_clock), so 7 PM is 19:00.

### Serial Monitor

You can use [Mu Editor](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor) or another program to examine the serial output from the Feather M4.

### SD Card & Audio File

On startup, the program will [mount the SD card and print its contents](https://learn.adafruit.com/adafruit-adalogger-featherwing/using-the-sd-card). This is a good way to troubleshoot the SD card.

It will find the specified audio file and set the file to play stereo audio on the A0 and A1 pins.

```python
data = open("/sd/cheer.mp3", "rb")
mp3 = audiomp3.MP3Decoder(data)
#a = audioio.AudioOut(board.A0) # mono
a = audioio.AudioOut(board.A0, right_channel=board.A1) # stereo sound through A0 &amp; A1
```

### RTC (Real Time Clock) & Setting The Time

Afterwards, you should see the date and time being printed every second.

```python
# Main loop:
while True:
    t = rtc.datetime

    # print(t)     # uncomment for debugging
    print(
        "The date is {} {}/{}/{}".format(
            days[int(t.tm_wday)], t.tm_mday, t.tm_mon, t.tm_year
        )
    )
    print("The time is {}:{:02}:{:02}".format(t.tm_hour, t.tm_min, t.tm_sec))
```

If the time is incorrect, you can set it in the following section of code by changing `False` to `True`:

```python
if False:  # change to True if you want to set the time!
    #                     year, mon, date, hour, min, sec, wday, yday, isdst
    t = time.struct_time((2020, 5, 13, 15, 15, 15, 0, -1, -1))
    # you must set year, mon, date, hour, min, sec and weekday
    # yearday is not supported, isdst can be set but we don't do anything with it at this time
    print("Setting time to:", t)  # uncomment for debugging
    rtc.datetime = t
    print()
```

This will change the time on the Adalogger FeatherWing's RTC. The RTC runs off the CR1220 coin cell battery when it isn't attached to power, which is how it continues to keep track of the time when the Feather is unpowered. Set `True` back to `False` once the time is set correctly. You can read more about the [RTC and setting the time in the Adalogger FeatherWing Learn Guide](https://learn.adafruit.com/adafruit-adalogger-featherwing/rtc-with-circuitpython).

# Daily Cheer Automaton

## Usage

https://www.youtube.com/watch?v=mH5QUKQ5w5k

![](https://cdn-learn.adafruit.com/assets/assets/000/091/234/medium800/feather_IMG_2947.jpg?1589602349)

Power the automaton through the Feather's microUSB port. These [5V power supplies with microUSB](https://www.adafruit.com/product/1995) work well.

With the audio jack output you can easily connect the device to a stereo amplifier or computer speakers for a louder volume.

![](https://cdn-learn.adafruit.com/assets/assets/000/091/232/medium800/feather_IMG_3107.jpg?1589602189)

![](https://cdn-learn.adafruit.com/assets/assets/000/091/233/medium800/feather_IMG_3105.jpg?1589602239)

### USB Powered Speakers

[USB Powered Speakers](https://www.adafruit.com/product/1363)
Add some extra boom to your audio project with these powered loudspeakers. We sampled half a dozen different models to find ones with a good frequency response, so you'll get quality audio output for music playback. Simply connect the standard 3.5mm stereo plug into your Raspberry Pi model...

In Stock
[Buy Now](https://www.adafruit.com/product/1363)
[Related Guides to the Product](https://learn.adafruit.com/products/1363/guides)
![Two square-ish USB Powered Speakers](https://cdn-shop.adafruit.com/640x480/1363-07.jpg)

### 3.5mm Stereo Male/Male Cable in Various Metal Colors - 1 meter

[3.5mm Stereo Male/Male Cable in Various Metal Colors - 1 meter](https://www.adafruit.com/product/4070)
Here is a gorgeous metal-covered audio cable straight from Blade Runner/cyberpunk heaven. And we have them in a couple different colors! They're a step up from plain rubber/ABS cables, with a sleek metal-wound cover.

This cable comes with two 3.5mm (1/8" headphone jack size)...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4070)
[Related Guides to the Product](https://learn.adafruit.com/products/4070/guides)
![Four metallic coiled cables](https://cdn-shop.adafruit.com/640x480/4070-00.jpg)

### 5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable

[5V 2.5A Switching Power Supply with 20AWG MicroUSB Cable](https://www.adafruit.com/product/1995)
Our all-in-one 5V 2.5 Amp + MicroUSB cable power adapter is the perfect choice for powering single-board computers like Raspberry Pi, BeagleBone, or anything else that's power-hungry!

This adapter was specifically designed to provide 5.25V, not 5V, but we still call it a 5V USB...

In Stock
[Buy Now](https://www.adafruit.com/product/1995)
[Related Guides to the Product](https://learn.adafruit.com/products/1995/guides)
![MicroUSB power supply with bundled cable and U.S. plugs.](https://cdn-shop.adafruit.com/640x480/1995-02.jpg)

## Going Further

- You can modify this project to perform different tasks at different times throughout the day, such as participate in [Pride Cheer](https://blog.adafruit.com/2020/06/26/pride-cheer-is-here-1pm-et-june-26th-pride2020-nycpridecheer2020-nycpride/) at 1pm, play [howling noises at 8pm](https://time.com/5819374/howling-ritual-coronavirus/), or even play "Happy Birthday" on a specific date.
- Using a [Motor FeatherWing](https://www.adafruit.com/product/2927) you could expand this project to have the device operate physical noisemakers, such as banging pots and pans together, or clapping animatronic hands. Or you could create a cuckoo clock!


## Featured Products

### Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0

[Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0](https://www.adafruit.com/product/2772)
Feather is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Feather M0 Basic Proto** ,&nbsp;it has a bunch of prototyping space...

In Stock
[Buy Now](https://www.adafruit.com/product/2772)
[Related Guides to the Product](https://learn.adafruit.com/products/2772/guides)
### Adafruit Music Maker FeatherWing - MP3 OGG WAV MIDI Synth Player

[Adafruit Music Maker FeatherWing - MP3 OGG WAV MIDI Synth Player](https://www.adafruit.com/product/3357)
Bend all audio files to your will with the **Adafruit Music Maker FeatherWing**! It's a fun-size version of our [Music Maker&nbsp;shield for Arduino](https://www.adafruit.com/product/1790)!&nbsp;This powerful wing features the VS1053, an encoding/decoding (codec)...

In Stock
[Buy Now](https://www.adafruit.com/product/3357)
[Related Guides to the Product](https://learn.adafruit.com/products/3357/guides)
### Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards

[Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards](https://www.adafruit.com/product/2922)
A Feather board without ambition is a Feather board without FeatherWings! This is the **Adalogger FeatherWing** : it adds both a battery-backed Real Time Clock and micro SD card storage to any Feather main board. Using our [Feather...](https://www.adafruit.com/products/2830)

In Stock
[Buy Now](https://www.adafruit.com/product/2922)
[Related Guides to the Product](https://learn.adafruit.com/products/2922/guides)
### SD/MicroSD Memory Card (8 GB SDHC)

[SD/MicroSD Memory Card (8 GB SDHC)](https://www.adafruit.com/product/1294)
Add mega-storage in a jiffy using this 8 GB class 4 micro-SD card. It comes with a SD adapter so you can use it with any of our shields or adapters. Preformatted to FAT so it works out of the box with our projects. Tested and works great with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1294)
[Related Guides to the Product](https://learn.adafruit.com/products/1294/guides)
### DS3231 Precision RTC FeatherWing - RTC Add-on For Feather Boards

[DS3231 Precision RTC FeatherWing - RTC Add-on For Feather Boards](https://www.adafruit.com/product/3028)
A Feather board without ambition is a Feather board without FeatherWings! This is the **DS3231 Precision RTC FeatherWing** : it adds an extremely accurate I2C-integrated Real Time Clock (RTC) with a Temperature Compensated Crystal Oscillator (TCXO)&nbsp; to any Feather main board....

Out of Stock
[Buy Now](https://www.adafruit.com/product/3028)
[Related Guides to the Product](https://learn.adafruit.com/products/3028/guides)
### CR1220 12mm Diameter - 3V Lithium Coin Cell Battery

[CR1220 12mm Diameter - 3V Lithium Coin Cell Battery](https://www.adafruit.com/product/380)
These are the highest quality & capacity batteries, the same as shipped with the iCufflinks,&nbsp;iNecklace, Datalogging and GPS Shields, GPS HAT, etc. One battery per order (you'll want one battery per cufflink or pendant.)  
  
Brand may vary but all battery brands are verified...

In Stock
[Buy Now](https://www.adafruit.com/product/380)
[Related Guides to the Product](https://learn.adafruit.com/products/380/guides)
### Adafruit Feather M4 Express - Featuring ATSAMD51

[Adafruit Feather M4 Express - Featuring ATSAMD51](https://www.adafruit.com/product/3857)
It's what you've been waiting for, the Feather M4 Express featuring ATSAMD51. This Feather is fast like a swift, smart like an owl, strong like a ox-bird (it's half ox, half bird, OK?) This feather is powered by our new favorite chip, the **ATSAMD51J19** -&nbsp; with...

In Stock
[Buy Now](https://www.adafruit.com/product/3857)
[Related Guides to the Product](https://learn.adafruit.com/products/3857/guides)
### FeatherWing Tripler Mini Kit - Prototyping Add-on For Feathers

[FeatherWing Tripler Mini Kit - Prototyping Add-on For Feathers](https://www.adafruit.com/product/3417)
This is the **FeatherWing Tripler** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are three! The magic of the Tripler comes when you want to connect your Feather to...

In Stock
[Buy Now](https://www.adafruit.com/product/3417)
[Related Guides to the Product](https://learn.adafruit.com/products/3417/guides)

## Related Guides

- [Adafruit Feather M4 Express](https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51.md)
- [Using LoraWAN and The Things Network with CircuitPython](https://learn.adafruit.com/using-lorawan-and-the-things-network-with-circuitpython.md)
- [MIDI Laser Harp with Time of Flight Distance Sensors](https://learn.adafruit.com/midi-laser-harp-time-of-flight-sensors.md)
- [No-Code Offline Data Logger with WipperSnapper](https://learn.adafruit.com/no-code-offline-data-logging-with-wippersnapper.md)
- [Debugging the SAMD21 with GDB](https://learn.adafruit.com/debugging-the-samd21-with-gdb.md)
- [Level Shifting 3.3V microcontrollers and NeoPixels](https://learn.adafruit.com/neopixel-levelshifter.md)
- [LED Snowboard with Motion-Reactive Animation](https://learn.adafruit.com/led-snowboard-with-motion-reactive-animation.md)
- [Mad Science Test Tube Rack](https://learn.adafruit.com/mad-science-test-tube-rack.md)
- [MIDI Melody Maker](https://learn.adafruit.com/midi-melody-maker.md)
- [Toy Car Speed Timer](https://learn.adafruit.com/toy-car-speed-timer.md)
- [CircuitPython 101: Basic Builtin Data Structures](https://learn.adafruit.com/basic-datastructures-in-circuitpython.md)
- [Build an ESP8266 Mobile Robot](https://learn.adafruit.com/build-an-esp8266-mobile-robot.md)
- [4x4 Rotary Encoder MIDI Messenger](https://learn.adafruit.com/4x4-rotary-encoder-midi-messenger.md)
- [Bluefruit LE Feather Robot Rover](https://learn.adafruit.com/bluefruit-feather-robot.md)
- [Connecting the MAX31855 Thermocouple Amplifier breakout to an Electric Imp](https://learn.adafruit.com/connecting-the-max31855-thermocouple-amplifier-breakout-to-an-electric-imp.md)
- [Building the Assistive Technology Ultimate Remote](https://learn.adafruit.com/building-the-assistive-technology-ultimate-remote.md)
