# Mini GIF Players

## Overview

https://youtu.be/G8YGo2eVU8M

## Build a mini GIF player

Use CircuitPython and Ardunio to build a tiny GIF player.&nbsp;

These 3D Printed enclosures to look like a small retro TV and a portable gaming console that can play animated GIFs.

This project uses CircuitPython’s USB mass storage capability to emulate a flash drive so we can just drag and drop GIF images.

&nbsp;

![projects_adabot-sit-loop.gif](https://cdn-learn.adafruit.com/assets/assets/000/112/133/medium640thumb/projects_adabot-sit-loop.jpg?1653932140)

## Feather RP2040

Powered by the Feather RP2040, this dev board is packed with lots of great features and has the ability to be used in both Arduino and Adafruit's CircuitPython.

## Displays

Design around a 1.9 and 1.47 sized display, these displays make the player look like a retro TV or a Nintendo switch!&nbsp;

Both of these displays feature SPI interfacing, for quick wiring, and are IPS so look nice and crisp.

![projects_hero-board.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/134/medium640/projects_hero-board.jpg?1653932235)

![projects_hero-dispays.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/135/medium640/projects_hero-dispays.jpg?1653932277)

![](https://cdn-learn.adafruit.com/assets/assets/000/112/136/medium800thumb/projects_tv-loop.jpg?1653932546)

# Parts
![](https://cdn-learn.adafruit.com/assets/assets/000/112/148/medium800/projects_parts.jpg?1653937378)

### Adafruit Feather RP2040

[Adafruit Feather RP2040](https://www.adafruit.com/product/4884)
A new chip means a new Feather, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the Feather Treatment" and so we did! This Feather features the&nbsp; **RP2040** , and all niceties you know and...

In Stock
[Buy Now](https://www.adafruit.com/product/4884)
[Related Guides to the Product](https://learn.adafruit.com/products/4884/guides)
![Angled shot of black rectangular microcontroller "Feather RP2040"](https://cdn-shop.adafruit.com/640x480/4884-04.jpg)

### Adafruit 1.47" 320x172 Round Rectangle Color IPS TFT Display

[Adafruit 1.47" 320x172 Round Rectangle Color IPS TFT Display](https://www.adafruit.com/product/5393)
Don't be such a _square_ - throw a curveball into your electronics with a curved-edge miniature display. Here's a new "round rect" TFT display&nbsp;- it's 1.47" diagonal and has high-density 250 ppi, 172x320 full-color pixels with IPS any-angle viewing....

Out of Stock
[Buy Now](https://www.adafruit.com/product/5393)
[Related Guides to the Product](https://learn.adafruit.com/products/5393/guides)
![TFT display breakout soldered and assembled onto a half-size breadboard and wired up to a microcontroller. The color TFT screen displays a boot-up screen.](https://cdn-shop.adafruit.com/product-videos/640x480/5393-09.jpg)

### Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh](https://www.adafruit.com/product/4236)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 420mAh for a total of about 1.55 Wh. If you need a larger (or smaller!) battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4236)
[Related Guides to the Product](https://learn.adafruit.com/products/4236/guides)
![Lithium Ion Polymer Battery 3.7v 420mAh with JST 2-PH connector and short cable](https://cdn-shop.adafruit.com/640x480/4236-04.jpg)

### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

In Stock
[Buy Now](https://www.adafruit.com/product/805)
[Related Guides to the Product](https://learn.adafruit.com/products/805/guides)
![Small, black, SPDT slide switch.](https://cdn-shop.adafruit.com/640x480/805-03.jpg)

### Adafruit 1.9" 320x170 Color IPS TFT Display

[Adafruit 1.9" 320x170 Color IPS TFT Display](https://www.adafruit.com/product/5394)
This lovely little display breakout is the best way to add a small, colorful, and very bright display to any project. Since the display uses 4-wire SPI to communicate and has its own pixel-addressable frame buffer, it can be used with every kind of microcontroller. Even a very small one with...

In Stock
[Buy Now](https://www.adafruit.com/product/5394)
[Related Guides to the Product](https://learn.adafruit.com/products/5394/guides)
![TFT display breakout soldered and assembled onto a half-size breadboard and wired up to a microcontroller. The color TFT screen displays a cycle of animations.](https://cdn-shop.adafruit.com/product-videos/640x480/5394-10.jpg)

### Part: USB Cable A to C
quantity: 1
3 feet/1 meter
[USB Cable A to C](https://www.adafruit.com/product/4474)

### Part: M2.5x6mm Screw
quantity: 8
M2.5x6mm Screw
[M2.5x6mm Screw](https://www.albanycountyfasteners.com/2-5-MM-x-45-Phillips-Flat-Head-Machine-Screw-p/1011-1002.htm)

# Mini GIF Players

## Circuit Diagram

The wiring diagram below provides a visual reference for connecting the components. It is not true to scale, it is just meant to be used as reference. This diagrams was created using the&nbsp;[Fritzing software package](http://fritzing.org/download/).

Take a moment to review the components in the circuit diagram. This illustration is meant for&nbsp;referencing wired connections - the length of wire,&nbsp;position and size of components are not exact.&nbsp;

Wires are measured and cut to have enough slack to reach each component.

Silicone ribbon wire is used to make them easier to coil and manage each wire inside the tight enclosure space.

## 1.47 Display
![](https://cdn-learn.adafruit.com/assets/assets/000/112/142/medium800/projects_1.4_CircuitPython-feather2040-fritz.jpg?1653935309)

## 1.9 Display
![](https://cdn-learn.adafruit.com/assets/assets/000/112/143/medium800/projects_1.9_CircuitPython-feather2040-fritz.jpg?1653935329)

# Mini GIF Players

## Install CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## CircuitPython Quickstart

Follow this step-by-step to quickly get CircuitPython running on your board.

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/adafruit_feather_rp2040/)
 **Click the link above to download the latest CircuitPython UF2 file.**

Save it wherever is convenient for you.

![install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/655/medium640/install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg?1618943202)

![](https://cdn-learn.adafruit.com/assets/assets/000/102/705/medium800/adafruit_products_FeatherRP_buttons_highlighted.jpg?1623167565)

To enter the bootloader, hold down the **BOOT/**** BOOTSEL button**(highlighted in red above), and while continuing to hold it (don't let go!), press and release the**reset button**(highlighted in red or blue above).&nbsp;**Continue to hold the BOOT/BOOTSEL button until the RPI-RP2 drive appears!**

If the drive does not appear, release all the buttons, and then repeat the process above.

You can also start with your board unplugged from USB, press and hold the BOOTSEL button (highlighted in red above), continue to hold it while plugging it into USB, and wait for the drive to appear before releasing the button.

A lot of people end up using charge-only USB cables and it is very frustrating! **Make sure you have a USB cable you know is good for data sync.**

You will see a new disk drive appear called **RPI-RP2**.

&nbsp;

Drag the **adafruit\_circuitpython\_etc.uf2** file to **RPI-RP2.**

![install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/656/medium640/install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg?1618943666)

![install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/657/medium640/install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg?1618943674)

The **RPI-RP2** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it, you're done! :)

![install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/658/medium640/install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg?1618943864)

## Safe Mode

You want to edit your **code.py** or modify the files on your **CIRCUITPY** drive, but find that you can't. Perhaps your board has gotten into a state where **CIRCUITPY** is read-only. You may have turned off the **CIRCUITPY** drive altogether. Whatever the reason, safe mode can help.

Safe mode in CircuitPython does not run any user code on startup, and disables auto-reload. This means a few things. First, safe mode _bypasses any code in_ **boot.py** (where you can set **CIRCUITPY** read-only or turn it off completely). Second, _it does not run the code in_ **code.py**. And finally, _it does not automatically soft-reload when data is written to the_ **CIRCUITPY** _drive_.

Therefore, whatever you may have done to put your board in a non-interactive state, safe mode gives you the opportunity to correct it without losing all of the data on the **CIRCUITPY** drive.

### Entering Safe Mode
To enter safe mode when using CircuitPython, plug in your board or hit reset (highlighted in red above). Immediately after the board starts up or resets, it waits 1000ms. On some boards, the onboard status LED (highlighted in green above) will blink yellow during that time. If you press reset during that 1000ms, the board will start up in safe mode. It can be difficult to react to the yellow LED, so you may want to think of it simply as a slow double click of the reset button. (Remember, a fast double click of reset enters the bootloader.)

### In Safe Mode

If you successfully enter safe mode on CircuitPython, the LED will intermittently blink yellow three times.

If you connect to the serial console, you'll find the following message.

```terminal
Auto-reload is off.
Running in safe mode! Not running saved code.

CircuitPython is in safe mode because you pressed the reset button during boot. Press again to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.
```

You can now edit the contents of the **CIRCUITPY** drive. Remember, _your code will not run until you press the reset button, or unplug and plug in your board, to get out of safe mode._

## Flash Resetting UF2

If your board ever gets into a really _weird_ state and CIRCUITPY doesn't show up as a disk drive after installing CircuitPython, try loading this 'nuke' UF2 to RPI-RP2. which will do a 'deep clean' on your Flash Memory. **You will lose all the files on the board** , but at least you'll be able to revive it! After loading this UF2, follow the steps above to re-install CircuitPython.

[Download flash erasing "nuke" UF2](https://cdn-learn.adafruit.com/assets/assets/000/101/659/original/flash_nuke.uf2?1618945856)
# Mini GIF Players

## Coding the Mini GIF Players

![](https://cdn-learn.adafruit.com/assets/assets/000/112/146/medium800/projects_code-cp-drive.jpg?1653936694)

The code for this project is written in Arduino, but you will use the **CIRCUITPY** drive filesystem to store your GIF images on the Feather RP2040.

## Copy Your GIF's Onto the CIRCUITPY Drive
Danger: 

Once you've finished setting up your Feather RP2040 with CircuitPython, plug your Feather RP2040 into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called&nbsp; **CIRCUITPY**. You can drag and drop your GIF image files onto the **CIRCUITPY** drive.

You can download some Adafruit-themed GIFs below. There are versions sized for both the 1.4" and 1.9" displays.

[Adafruit GIFs](https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/main/Mini_GIF_Players/adafruit_gifs)
## Arduino Usage
After copying your GIF files, [follow the steps for using the Feather RP2040 with the Arduino IDE](https://learn.adafruit.com/adafruit-feather-rp2040-pico/arduino-ide-setup). When your Arduino IDE is setup and working with the Feather RP2040, download the code file and open it in the Arduino IDE.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Mini_GIF_Players/Mini_GIF_Players.ino

![](https://cdn-learn.adafruit.com/assets/assets/000/112/147/medium800/projects_code-cp-ardunio.jpg?1653936721)

Plug your Feather RP2040 into the computer's USB port with a known good USB data+power cable and upload the code with the Arduino IDE. After the code finishes uploading, you should see your GIFs playing on your screen.

## Customize the Code
You can change the TFT's pin numbers depending on how you have wired the screen to your board.

```cpp
#define TFT_CS 7
#define TFT_DC 8
#define TFT_RST 9
```

You can change the `DISPLAY_WIDTH` and `DISPLAY_HEIGHT` to match your display's dimensions.

```cpp
#define DISPLAY_WIDTH 320
#define DISPLAY_HEIGHT 174
```

By default, all of the GIF's that are loaded onto the Feather RP2040's main directory will play, looping five times each. If you only want one GIF to play, then you can edit the `GIFDIRNAME` to point to a specific file or folder rather than the main directory. If you want to change the number of times that a GIF loops, edit the `NUM_LOOPS` variable.

```cpp
#define GIFDIRNAME "/"
#define NUM_LOOPS 5
```

# Mini GIF Players

## 3D Printing

## Parts List

STL files for 3D printing are oriented to print "as-is" on FDM style machines. Parts are designed to 3D print without any support material. Original design source may be downloaded using the links below.

![projects_3d-parts-ninendo.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/138/medium640/projects_3d-parts-ninendo.jpg?1653933303)

![projects_3d-parts-tv.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/150/medium640/projects_3d-parts-tv.jpg?1653939084)

[Edit 1.47 Display Design](https://a360.co/46mmbsP)
[Edit 1.9 Display Design](https://a360.co/4gJyfrw)
[Download STLs](https://www.thingiverse.com/thing:5400032)
## Slice with settings for PLA material&nbsp;

The parts were sliced using CURA using the slice settings below.

- PLA filament 220c extruder
- 0.2 layer height
- 10% gyroid infill
- 60mm/s print speed
- 60c heated bed

![projects_slice.gif](https://cdn-learn.adafruit.com/assets/assets/000/112/139/medium640thumb/projects_slice.jpg?1653934054)

## Supports

- Support Extrusion Width: .2
- Support Density: 4%
- Support Overhang Angle: 60
- Support Z Height: .21
- Interface: On
- Support Roof: On
- Support Pattern: Zig Zag

## Build Plate Adhesion&nbsp;

- Type: brim
- Line Count: 8

![projects_slice-frame.gif](https://cdn-learn.adafruit.com/assets/assets/000/112/141/medium640thumb/projects_slice-frame.jpg?1653934537)

# Mini GIF Players

## Assemble

## Solder Display&nbsp;

Use silicone ribbon cable to solder the display to the pins on the Feather board.&nbsp;

## Frame

The frame cutout can pass through the wires. Align the standoffs to the display and feather board.

&nbsp;

![projects_frame-align.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/123/medium640/projects_frame-align.jpg?1653930944)

![projects_frame-aligned.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/124/medium640/projects_frame-aligned.jpg?1653930996)

## Secure Frame&nbsp;

Use M2.4x6mm screws to secure the display and Feather board to the frame.

&nbsp;

![projects_frame-screw-feather.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/125/medium640/projects_frame-screw-feather.jpg?1653931050)

![projects_frame-screw-display.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/126/medium640/projects_frame-screw-display.jpg?1653931090)

## Slide Switch&nbsp;

Measure and cut wires to connect the slide switch to the EN and GND pins on the Feather board.

## Place in Case

Connect the 420mAh battery to the JST port. Fit the battery wires into the case and angle the display and board to fit into the case.

&nbsp;

![projects_battery-plugged.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/127/medium640/projects_battery-plugged.jpg?1653931154)

![projects_case-place.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/128/medium640/projects_case-place.jpg?1653931214)

## Fit Slide Switch&nbsp;

Align the slide switch to the walls inside the case. Press fit the switch at and angle to secure it to the case.

## Attach Lid

Align the lid and face plate to the case. Press fit to attach.

&nbsp;

![projects_case-slide-switch.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/129/medium640/projects_case-slide-switch.jpg?1653931287)

![projects_case-lid.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/130/medium640/projects_case-lid.jpg?1653931330)

## Face Plates

&nbsp;

The Nintendo joystick pieces are glued to the face plate and press fitted over the case.

The TV face plate aligns to the screen cut out and press fit over the case.

![projects_face-glue.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/131/medium640/projects_face-glue.jpg?1653931472)

![projects_face-swap-loop-gif.gif](https://cdn-learn.adafruit.com/assets/assets/000/112/132/medium640thumb/projects_face-swap-loop-gif.jpg?1653931684)

## TV Antenna&nbsp;

&nbsp;

Use two pieces of 1.75mm filament to create the VCR antenna!

![projects_tv-antenna.jpg](https://cdn-learn.adafruit.com/assets/assets/000/112/149/medium640/projects_tv-antenna.jpg?1653937874)

## Complete

And that's it! We think these cute displays would go great with dioramas, lego builds or really any projects with miniatures. &nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/112/151/medium800thumb/projects_hero-loop-.jpg?1653955230)


## Featured Products

### Adafruit Feather RP2040

[Adafruit Feather RP2040](https://www.adafruit.com/product/4884)
A new chip means a new Feather, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the Feather Treatment" and so we did! This Feather features the&nbsp; **RP2040** , and all niceties you know and...

In Stock
[Buy Now](https://www.adafruit.com/product/4884)
[Related Guides to the Product](https://learn.adafruit.com/products/4884/guides)
### Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh](https://www.adafruit.com/product/4236)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 420mAh for a total of about 1.55 Wh. If you need a larger (or smaller!) battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4236)
[Related Guides to the Product](https://learn.adafruit.com/products/4236/guides)
### Adafruit 1.47" 320x172 Round Rectangle Color IPS TFT Display

[Adafruit 1.47" 320x172 Round Rectangle Color IPS TFT Display](https://www.adafruit.com/product/5393)
Don't be such a _square_ - throw a curveball into your electronics with a curved-edge miniature display. Here's a new "round rect" TFT display&nbsp;- it's 1.47" diagonal and has high-density 250 ppi, 172x320 full-color pixels with IPS any-angle viewing....

Out of Stock
[Buy Now](https://www.adafruit.com/product/5393)
[Related Guides to the Product](https://learn.adafruit.com/products/5393/guides)
### Adafruit 1.9" 320x170 Color IPS TFT Display

[Adafruit 1.9" 320x170 Color IPS TFT Display](https://www.adafruit.com/product/5394)
This lovely little display breakout is the best way to add a small, colorful, and very bright display to any project. Since the display uses 4-wire SPI to communicate and has its own pixel-addressable frame buffer, it can be used with every kind of microcontroller. Even a very small one with...

In Stock
[Buy Now](https://www.adafruit.com/product/5394)
[Related Guides to the Product](https://learn.adafruit.com/products/5394/guides)
### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

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

## Related Guides

- [Introducing Adafruit Feather RP2040](https://learn.adafruit.com/adafruit-feather-rp2040-pico.md)
- [Adafruit 1.47" Round Rectangle TFT Display](https://learn.adafruit.com/adafruit-1-47-round-rectangle-tft-display.md)
- [Adafruit 1.9" Color IPS TFT Display](https://learn.adafruit.com/adafruit-1-9-color-ips-tft-display.md)
- [Optical Sensor Drum Track Sequencer](https://learn.adafruit.com/drum-track-sequencer.md)
- [How to Choose a Microcontroller](https://learn.adafruit.com/how-to-choose-a-microcontroller.md)
- [Deco Two-Key Feather Macro Pad](https://learn.adafruit.com/deco-two-key-keypad-macropad-circuitpython-feather.md)
- [MIDI for Makers](https://learn.adafruit.com/midi-for-makers.md)
- [Flying Faders](https://learn.adafruit.com/flying-faders.md)
- [Quickstart - Raspberry Pi RP2040 with BLE and CircuitPython](https://learn.adafruit.com/quickstart-raspberry-pi-rp2040-with-ble-and-circuitpython.md)
- [Driving TM1814 addressable LEDs](https://learn.adafruit.com/driving-tm1814-addressable-leds.md)
- [Pi SSD Media Server](https://learn.adafruit.com/pi-ssd-media-server.md)
- [Discord and Slack Connected Smart Plant with Adafruit IO Actions](https://learn.adafruit.com/discord-and-slack-connected-smart-plant-with-adafruit-io-triggers.md)
- [Soundboard Speaker for Bikes & Scooters](https://learn.adafruit.com/soundboard-speaker-for-bikes-scooters.md)
- [DeviceScript, TypeScript for Microcontrollers](https://learn.adafruit.com/devicescript.md)
- [Bubble Table with LED Animations and IR Remote Control](https://learn.adafruit.com/bubble-table-with-led-animations-and-ir-remote-control.md)
- [Introducing Adafruit Feather](https://learn.adafruit.com/adafruit-feather.md)
