# Motion Sensor Bat

## Overview

https://youtu.be/n2cuiZ1W8Zs

## Build a Motorized Bat

Build a motion activated flying bat! Add this Halloween decoration to a candy bowl to spook trick-or-treaters. When the motion sensor detects a hand, it actives a fluttering bat with sound effects!

![sensors_hero-clear.gif](https://cdn-learn.adafruit.com/assets/assets/000/133/333/medium640thumb/sensors_hero-clear.jpg?1730165279)

## Motion Activated

A VL53L1X time of flight sensor detects when an object is nearby. Different audio is played depending on the distance, making this an advanced decor that's more than just a typical store-bought Halloween amusement.

You may customize the CircuitPython code to change the distances, servo movement, sound effects and more.

![sensors_hero-sense.gif](https://cdn-learn.adafruit.com/assets/assets/000/133/334/medium640thumb/sensors_hero-sense.jpg?1730165433)

## PropMaker RP2040

This dev-board is our favorite go-to that’s designed for making prop projects. It’s got the RP2040 chip with a built-in audio amplifier and accelerometer!

A 2200mAh lipo battery will provide several hours of use and can be recharged over USB.

![sensors_hero-board.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/335/medium640/sensors_hero-board.jpg?1730165601)

![](https://cdn-learn.adafruit.com/assets/assets/000/133/366/medium800thumb/sensors_hero-top.jpg?1730211458)

## Parts
### Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier

[Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier](https://www.adafruit.com/product/5768)
The Adafruit Feather series gives you lots of options for a small, portable, rechargeable microcontroller board. By picking a feather and stacking on a FeatherWing you can create advanced projects quickly. One popular combo is our [Feather M4](https://www.adafruit.com/product/3857)...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5768)
[Related Guides to the Product](https://learn.adafruit.com/products/5768/guides)
![Video of a white hand pressing a button to briefly turn an LED strip into white lights. Also wired up to the microcontroller are a servo motor and a speaker.](https://cdn-shop.adafruit.com/product-videos/640x480/5768-09.jpg)

### Continuous Rotation Micro Servo

[Continuous Rotation Micro Servo](https://www.adafruit.com/product/2442)
Need to make a _tiny_ robot? This little micro servo rotates 360 degrees fully forward or backward, instead of moving to a single position. You can use any servo code, hardware, or library to control these servos. Good for making simple moving robots. Comes with five horns and...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2442)
[Related Guides to the Product](https://learn.adafruit.com/products/2442/guides)
![Demo Video of the Continuous Rotation Micro Servo with a "t" shaped propeller connected to the gear and spinning.](https://cdn-shop.adafruit.com/product-videos/640x480/2442-02.jpg)

### Adafruit VL53L1X Time of Flight Distance Sensor - ~30 to 4000mm

[Adafruit VL53L1X Time of Flight Distance Sensor - ~30 to 4000mm](https://www.adafruit.com/product/3967)
The&nbsp; **Adafruit VL53L1X Time of Flight Distance Sensor** (also known as VL53L1CX) is a&nbsp;_Time of Flight_&nbsp;distance sensor that has a massive 4 meter range and LIDAR-like precision. The sensor contains a very tiny invisible laser source and a matching sensor....

Out of Stock
[Buy Now](https://www.adafruit.com/product/3967)
[Related Guides to the Product](https://learn.adafruit.com/products/3967/guides)
![Top view of Adafruit VL53L1X Time of Flight Distance Sensor hooked up to an OLED display. A white manicured hand waves at the sensor, and the OLED displays the distance.](https://cdn-shop.adafruit.com/product-videos/640x480/3967-05.jpg)

### Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt

[Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/4227)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

In Stock
[Buy Now](https://www.adafruit.com/product/4227)
[Related Guides to the Product](https://learn.adafruit.com/products/4227/guides)
![Mini Oval Speaker with Short Wires ](https://cdn-shop.adafruit.com/640x480/4227-06.jpg)

### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
![Angled shot of STEMMA QT / Qwiic JST SH 4-pin Cable.](https://cdn-shop.adafruit.com/640x480/4210-00.jpg)

### Lithium Ion Cylindrical Battery - 3.7v 2200mAh

[Lithium Ion Cylindrical Battery - 3.7v 2200mAh](https://www.adafruit.com/product/1781)
Need a big battery for your project? This lithium-ion battery contains a 2200mAh and a protection circuit that provides over-voltage, under-voltage, and over-current protection. Yet, it is slim and easy to fit into many project cases.  
  
This cell can provide 2 **C** of...

In Stock
[Buy Now](https://www.adafruit.com/product/1781)
[Related Guides to the Product](https://learn.adafruit.com/products/1781/guides)
![Lithium Ion Cylindrical Battery - 3.7v 2200mAh with JST PH connector](https://cdn-shop.adafruit.com/640x480/1781-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)

### 1.25mm Pitch 2-pin Cable Matching Pair - 40cm long

[1.25mm Pitch 2-pin Cable Matching Pair - 40cm long](https://www.adafruit.com/product/4720)
When 0.1" is too big, and JST PH's too chunky, these ultra-slim 1.25mm connectors are a reliable alternative. These are only 1.25mm pitch, but have a nice clicky connection.

These cables are&nbsp;nice and long, 40cm in fact. They've&nbsp;got both small form factor and are a...

In Stock
[Buy Now](https://www.adafruit.com/product/4720)
[Related Guides to the Product](https://learn.adafruit.com/products/4720/guides)
![1.25mm Pitch 2-pin Cable Matching Pair](https://cdn-shop.adafruit.com/640x480/4720-04.jpg)

### Part: M2.5x6mm Screws
quantity: 6
M2.5x6mm Screws
[M2.5x6mm Screws](https://amzn.to/3ZvDMvg)

### Part: M2x6mm Screws
quantity: 2
M2x6mm Screws
[M2x6mm Screws](https://amzn.to/47AsYhn)

### Part: 0.65mm Round Silver-Plated Memory Wire
quantity: 1
0.65mm Round Silver-Plated Memory Wire
[0.65mm Round Silver-Plated Memory Wire](https://www.michaels.com/product/beadalon-silver-plated-memory-wire-large-bracelet-10376078?michaelsStore=8744&inv=2)

# Motion Sensor Bat

## Circuit Diagram

The diagram below provides a general visual reference for wiring of the components once you get to the **Assembly** page. This diagram was created using the software package [Fritzing](http://fritzing.org/download/)

## Adafruit Library for Fritzing

Adafruit uses the Adafruit's Fritzing parts library to create circuit diagrams for projects. You can download the library or just grab individual parts. Get the library and parts from&nbsp;[GitHub - Adafruit Fritzing Parts](https://github.com/adafruit/Fritzing-Library/tree/master/parts).

![](https://cdn-learn.adafruit.com/assets/assets/000/133/364/medium800/sensors_Bat-CircuitDiagram.jpg?1730210833)

## Wired Connections

- The speaker is connected to the pins on the screw block terminal
- The slide switch is connected to the **EN** and **GND** pins on the Feather
- The Lipo battery plugs into the Battery port
- The time of flight sensor plugs into the STEMMA QT port on the Feather

# Motion Sensor Bat

## 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_prop_maker/)
 **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/121/865/medium800/adafruit_products_boot_reset.jpg?1686710555)

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)
# Motion Sensor Bat

## Coding the Bat

Once you've finished setting up your Feather RP2040 Propmaker with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.

To do this, click on the **Download Project Bundle** button in the window below. It will download to your computer as a zipped folder.

![sensors_hero-code.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/337/medium640/sensors_hero-code.jpg?1730166359)

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

## Upload the Code, Sound Effects and Libraries to the Feather RP2040 Propmaker

After downloading the Project Bundle, plug your Feather RP2040 Propmaker 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 **CIRCUITPY**. Unzip the folder and copy the following items to the Feather RP2040 Propmaker's **CIRCUITPY** drive.

- **lib** folder
- **code.py**
- **bat0.wav**
- **bat1.wav**
- **bat2.wav**
- **music-loop-1.wav**

Your Feather RP2040 Propmaker **CIRCUITPY** drive should look like this after copying the **lib** folder, **.wav** files&nbsp;and the **code.py** file.

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/Motion_Sensor_Bat.png )

## How the CircuitPython Code Works

At the top of the code, there are some user configurable settings that you can edit. `distance_delay` affects how often the time of flight sensor is read. The `servo_delays` array has four different delay amounts for spinning the servo. These correspond with the distances in the `distances` array. In the loop, when you pass certain distances with the time of flight sensor, the delay for the servo changes.

Finally, the music and sound effect audio files are opened. You can change which music loop and sound effects you want to have for the project. A few options are included in the project bundle.

```python
distance_delay = 4 # how often vl53 is read
servo_delays = [2.0, 1.5, 1.0, 0.5] # servo spin delay
distances = [70, 50, 40, 50] # in centimeters
max_audio = 1
# audio files
music = audiocore.WaveFile(open("music-loop-1.wav", "rb"))
fx_1 = audiocore.WaveFile(open("bat0.wav", "rb"))
fx_2 = audiocore.WaveFile(open("bat1.wav", "rb"))
fx_3 = audiocore.WaveFile(open("bat2.wav", "rb"))
```

## I2C and Audio

The time of flight sensor is instantiated over I2C. Next, the I2S audio is instantiated followed by a mixer object. Each of the four audio files will be played on separate voices.

```python
i2c = board.STEMMA_I2C()
vl53 = adafruit_vl53l1x.VL53L1X(i2c)

tracks = [music, fx_1, fx_2, fx_3]
audio = audiobusio.I2SOut(board.I2S_BIT_CLOCK, board.I2S_WORD_SELECT, board.I2S_DATA)
mixer = audiomixer.Mixer(voice_count=4, sample_rate=22050, channel_count=1,
                         bits_per_sample=16, samples_signed=True)
audio.play(mixer)
mixer.voice[0].play(tracks[0], loop=True)
mixer.voice[0].level = 0.0
```

## Input, Output and PWM

The external power pin is enabled as an output. This gives power to the external components on the Feather. The slide switch is attached to the `EXTERNAL_BUTTON` pin. In the loop, the slide switch controls the state of the external power pin. A PWM object is setup for the `EXTERNAL_SERVO` pin for the continuous servo.

```python
# enable external power pin
# provides power to the external components
external_power = DigitalInOut(board.EXTERNAL_POWER)
external_power.direction = Direction.OUTPUT
external_power.value = True

switch = DigitalInOut(board.EXTERNAL_BUTTON)
switch.direction = Direction.INPUT
switch.pull = Pull.UP

# servo control
pwm = pwmio.PWMOut(board.EXTERNAL_SERVO, duty_cycle=2 ** 15, frequency=50)
servo = servo.ContinuousServo(pwm, min_pulse=750, max_pulse=2250)
```

## The Loop

In the loop, if the time of flight sensor does not detect anything in front of it, the mixer and servo are paused. If the sensor detects something, `lamba` is used to calculate which value in distances that the reading is closest to. This result determines the sound effect played and the servo speed.

```python
while True:
    if switch.value:
        external_power.value = True
        if prop_time:
            if ticks_diff(ticks_ms(), servo_clock) &gt;= servo_time:
                print(servo_throttle)
                servo.throttle = servo_throttle
                servo_throttle = not servo_throttle
                servo_clock = ticks_add(servo_clock, servo_time)
        if ticks_diff(ticks_ms(), vl53_clock) &gt;= vl53_time:
            if vl53.data_ready:
                print(f"Distance: {vl53.distance} cm")
                vl53.clear_interrupt()
            if vl53.distance is None:
                prop_time = False
                mixer.voice[0].level = 0.0
                servo_time = int(servo_delays[0] * 1000)
                servo.throttle = 1.0
            else:
                closest_distance = min(distances, key=lambda x: abs(vl53.distance - x))
                # print(closest_distance)
                if vl53.distance &lt;= distances[0]:
                    prop_time = True
                    mixer.voice[0].level = max_audio
                else:
                    prop_time = False
                    mixer.voice[0].level = 0.0
                    servo.throttle = 1.0
                if closest_distance == distances[1]:
                    mixer.voice[1].play(tracks[1], loop=False)
                    servo_time = int(servo_delays[1] * 1000)
                elif closest_distance == distances[2]:
                    mixer.voice[2].play(tracks[2], loop=False)
                    servo_time = int(servo_delays[2] * 1000)
                elif closest_distance == distances[3]:
                    mixer.voice[3].play(tracks[3], loop=False)
                    servo_time = int(servo_delays[3] * 1000)
            vl53_clock = ticks_add(vl53_clock, vl53_time)
    else:
        external_power.value = False
```

# Motion Sensor Bat

## 3D Printing

## 3D Printed Parts

STL files for 3D printing will need to be oriented for print using either FDM or SLS machines.

Parts were built with PLA filament.

Original design source files may be downloaded using the links below.

![sensors_parts-3d.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/358/medium640/sensors_parts-3d.jpg?1730169889)

[Edit Design](https://a360.co/3NKqhRi)
[Bat Servo STEP files](https://cdn-learn.adafruit.com/assets/assets/000/133/361/original/Bat_Servo_STEP.zip?1730206191)
[Download STLs]()
## Slice with Settings for PLA Material&nbsp;

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

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

![sensors_slice.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/359/medium640/sensors_slice.jpg?1730170382)

## Supports

- For the Servo Horn: Normal
- Placement: Everywhere
- Support Patten: Concentric&nbsp;
- Support Overhang Angle: 50
- Support Destiny: 10%
- Enable Support Interface Off
- Support Z Distance: .21
- Support Brim: 22

![sensors_slice-supports.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/360/medium640/sensors_slice-supports.jpg?1730170513)

# Motion Sensor Bat

## Assembly

## Solder Slide Switch

Measure wires for the slide switch to reach where the Feather board mounts to the printed plate, about 120mm.

## Speaker Socket Wire

Use Pico Blade socket wires to easily connect the oval speaker to the terminal block.&nbsp;

![sensors_switch-speaker-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/338/medium640/sensors_switch-speaker-wire.jpg?1730166442)

## Place board screws

Add screws to mount the Feather board to the standoffs on the plate part. Use M2x6mm screws for the screws holes close to the terminal block. Use M2.5x6mm screws for the screw holes next to the USB C port.

![sensors_mount-feather.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/339/medium640/sensors_mount-feather.jpg?1730166589)

## Mount Lipo Clip

Turn the printed plate over, behind the Feather, to mount the LiPo clip.

Use two M2.5mm screws to mount the Lipo clip to the center of the plate.

## Mount Slide switch holder

Use two more M2.5mm screws to fasten the slide switch holder to the side of the plate.

![sensors_lipo-clip-switch-mount.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/340/medium640/sensors_lipo-clip-switch-mount.jpg?1730166785)

## Mount Slide Switch&nbsp;

Pass the slide switch through the cut out on the plate.

The slide switch press fits at an angle into the holder.

![sensors_switch-thread.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/341/medium640/sensors_switch-thread.jpg?1730167130)

![sensors_switch-mount.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/342/medium640/sensors_switch-mount.jpg?1730167196)

## Attach the Servo

Use the included screws to mount the servo to the tabs on the plate. Coil wires to fit between the servo and the terminal block.

Plug in a Right-Angle Female/Socket Header to the Feather to help fit the servo connector into the case.

&nbsp;

![sensors_servo-mount-header.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/343/medium640/sensors_servo-mount-header.jpg?1730167258)

## Attach Lipo Battery

Slide the lipo battery into the clip part.

Place the battery wire to make it taut on the side of the plate and connect to the port on the Feather.

![sensors_lipo-mount.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/344/medium640/sensors_lipo-mount.jpg?1730167728)

![sensors_lipo-mounted.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/345/medium640/sensors_lipo-mounted.jpg?1730167766)

## Attach Speaker

Plug the oval speaker into the Pico socket connector wire.

The speaker press fits into the cavity inside the case.

![sensors_speaker-plug.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/346/medium640/sensors_speaker-plug.jpg?1730167899)

![sensors_speaker-mount.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/347/medium640/sensors_speaker-mount.jpg?1730167954)

## STEMMA QTcable

Pass the STEMMA QT cable through the cutout on the case to plug into the socket connector on the Feather.

## Guide Rails

Place the assembled plate into the rails inside the case with the slide switch aligned to the cutout on the side of the case.&nbsp;

![sensors_stemma-thread.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/348/medium640/sensors_stemma-thread.jpg?1730168016)

![sensors_circut-place.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/349/medium640/sensors_circut-place.jpg?1730168127)

## Mount Sensor

Use M2.5x6mm screws to fasten to the sensor the standoffs on the case.

![sensors_sensor-mount.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/350/medium640/sensors_sensor-mount.jpg?1730168327)

## Assemble the Servo Horn

Measure and cut about 25 cm of Memory wire and bend into a curve.

Use a dark spray paint to help hide the wire.

![sensors_parts-bat.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/351/medium640/sensors_parts-bat.jpg?1730168435)

![sensors_bat-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/352/medium640/sensors_bat-wire.jpg?1730168556)

## Assemble Servo horn

Pass the wire through the printed wheel horn attachment and then into the inner holes on the included servo horn wheel.&nbsp;

Use flat pliers to add a small bend to the end of the wire.

The servo horn wheel press fits into the printed attachment.

&nbsp;

![sensors_bat-horn-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/353/medium640/sensors_bat-horn-wire.jpg?1730168656)

## Attach bat

Thread the end of the wire through the printed bat.

![sensors_bat-wire-thread.jpg](https://cdn-learn.adafruit.com/assets/assets/000/133/354/medium640/sensors_bat-wire-thread.jpg?1730168928)

## Attach lid&nbsp;

Align the cut out on the lid and press fit to the case.

## Attach Servo horn

The assembled servo horn press fits onto servo shaft.

![sensors_hero-top.gif](https://cdn-learn.adafruit.com/assets/assets/000/133/357/medium640thumb/sensors_hero-top.jpg?1730169684)


## Featured Products

### Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier

[Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier](https://www.adafruit.com/product/5768)
The Adafruit Feather series gives you lots of options for a small, portable, rechargeable microcontroller board. By picking a feather and stacking on a FeatherWing you can create advanced projects quickly. One popular combo is our [Feather M4](https://www.adafruit.com/product/3857)...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5768)
[Related Guides to the Product](https://learn.adafruit.com/products/5768/guides)
### Continuous Rotation Micro Servo

[Continuous Rotation Micro Servo](https://www.adafruit.com/product/2442)
Need to make a _tiny_ robot? This little micro servo rotates 360 degrees fully forward or backward, instead of moving to a single position. You can use any servo code, hardware, or library to control these servos. Good for making simple moving robots. Comes with five horns and...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2442)
[Related Guides to the Product](https://learn.adafruit.com/products/2442/guides)
### Adafruit VL53L1X Time of Flight Distance Sensor - ~30 to 4000mm

[Adafruit VL53L1X Time of Flight Distance Sensor - ~30 to 4000mm](https://www.adafruit.com/product/3967)
The&nbsp; **Adafruit VL53L1X Time of Flight Distance Sensor** (also known as VL53L1CX) is a&nbsp;_Time of Flight_&nbsp;distance sensor that has a massive 4 meter range and LIDAR-like precision. The sensor contains a very tiny invisible laser source and a matching sensor....

Out of Stock
[Buy Now](https://www.adafruit.com/product/3967)
[Related Guides to the Product](https://learn.adafruit.com/products/3967/guides)
### Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt

[Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/4227)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

In Stock
[Buy Now](https://www.adafruit.com/product/4227)
[Related Guides to the Product](https://learn.adafruit.com/products/4227/guides)
### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
### Lithium Ion Cylindrical Battery - 3.7v 2200mAh

[Lithium Ion Cylindrical Battery - 3.7v 2200mAh](https://www.adafruit.com/product/1781)
Need a big battery for your project? This lithium-ion battery contains a 2200mAh and a protection circuit that provides over-voltage, under-voltage, and over-current protection. Yet, it is slim and easy to fit into many project cases.  
  
This cell can provide 2 **C** of...

In Stock
[Buy Now](https://www.adafruit.com/product/1781)
[Related Guides to the Product](https://learn.adafruit.com/products/1781/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)
### 1.25mm Pitch 2-pin Cable Matching Pair - 40cm long

[1.25mm Pitch 2-pin Cable Matching Pair - 40cm long](https://www.adafruit.com/product/4720)
When 0.1" is too big, and JST PH's too chunky, these ultra-slim 1.25mm connectors are a reliable alternative. These are only 1.25mm pitch, but have a nice clicky connection.

These cables are&nbsp;nice and long, 40cm in fact. They've&nbsp;got both small form factor and are a...

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

## Related Guides

- [Adafruit VL53L1X Time of Flight Distance Sensor](https://learn.adafruit.com/adafruit-vl53l1x.md)
- [Adafruit RP2040 Prop-Maker Feather](https://learn.adafruit.com/adafruit-rp2040-prop-maker-feather.md)
- [Guitar Synth with CircuitPython SynthIO](https://learn.adafruit.com/guitar-synth-with-circuitpython-synthio.md)
- [LED Masquerade Masks with n00ds](https://learn.adafruit.com/led-masquerade-masks-with-n00ds.md)
- [Haunted Air Blaster](https://learn.adafruit.com/automated-air-blaster.md)
- [Bricktunes: LEGO Synthesizer Glove](https://learn.adafruit.com/bricktunes-lego-glove-synthesizer.md)
- [Close Encounters of the MIDI NeoPixel Visualizer Kind](https://learn.adafruit.com/midi-neopixel-visualizer.md)
- [PropMaker Jack O'Lantern](https://learn.adafruit.com/propmaker-jack-o-lantern.md)
- [Tombstone Prop-Maker RP2040](https://learn.adafruit.com/tombstone-prop-maker-rp2040.md)
- [MIT Green Building NeoPixel Tetris](https://learn.adafruit.com/tetris-building.md)
- [Stomp-Reactive Light Up Slippers](https://learn.adafruit.com/stomp-reactive-light-up-slippers.md)
- [Zelda Echoes Of Wisdom Tri Rod](https://learn.adafruit.com/zelda-tri-rod.md)
- [Talking HAL 9000 with RP2040 Prop Maker Feather](https://learn.adafruit.com/hal-9000-rp2040-prop-maker.md)
- [Soundbox RP2040](https://learn.adafruit.com/soundbox-rp2040.md)
- [ Faz-Wrench - Five Nights at Freddy's](https://learn.adafruit.com/faz-wrench.md)
- [10" Raspberry Pi Desktop](https://learn.adafruit.com/10-raspberry-pi-desktop.md)
