Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This remix makes a vintage transistor oscillator produce one of two audible tones when a PIR sensor detects motion. A Raspberry Pi Pico reads the sensor and drives a transistor relay; the relay closes its normally open contacts across a 220 kΩ resistor, placing it in parallel with the oscillator’s 47 kΩ resistor. The resulting resistance is about 38.7 kΩ, changing the oscillator’s bias and pitch. The Pico controls the frequency state—it does not synthesize the audio waveform.

The design follows Don Wilcher’s project in All About Circuits, published November 26, 2023: the original project article. It can be built with a Science Fair kit or with an equivalent oscillator assembled from ordinary components.

What the finished circuit does

The signal chain is deliberately split between modern control electronics and an analog sound generator:

  1. A moving warm object changes the infrared pattern seen by the PIR module.
  2. The PIR output goes to Pico GPIO 14.
  3. The Pico drives GPIO 15 high when motion is detected.
  4. A transistor relay module energizes.
  5. Relay normally open (NO) contacts connect the 220 kΩ resistor across the oscillator’s 47 kΩ resistor.
  6. The transistor-capacitor oscillator changes operating point and pitch, and its 8 Ω speaker produces the second tone.

With no motion, the relay is open and the original resistance remains in circuit. With motion, the relay closes and selects the lower effective resistance. These are two nominal operating states, not a continuously swept frequency. Exact pitches depend on resistor and capacitor tolerances, transistor characteristics, supply voltage, and the particular kit layout; the project source does not provide measured frequencies.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Raspberry Pi Pico
  • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
  • Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz
  • 264KB of SRAM, and 2MB of on-board Flash memory
  • Castellated module allows soldering direct to carrier boards
  • 26 × multi-function GPIO pins

The Radio Shack circuit behind the remix

Science Fair kits used spring terminals and point-to-point wiring so students could alter a circuit without soldering. The source project identifies the original frequency-shift activity as Experiment 80 in the Science Fair 200-in-1 kit, while its final build uses a Science Fair 150-in-1 kit. Those editions are not automatically interchangeable: node numbers, component values, and layouts can differ.

In the original experiment, a manual key switch adds a 220 kΩ resistor in parallel with a 47 kΩ resistor. The equivalent resistance is:

Reffective = (47,000 × 220,000) ÷ (47,000 + 220,000) ≈ 38.7 kΩ

The oscillator’s timing network establishes its approximate audio rate. Changing the resistance around the transistor’s bias and timing network changes its operating conditions and therefore the resulting tone. The relay contacts perform exactly the same electrical job as the key switch; the Pico never needs to touch the oscillator’s timing node.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
2Pcs Raspberry Pi Pico Development Board, Raspberry Pi RP2040 Dual-core ARM Cortex M0+ Processor, Running Up to 133 MHz, Support C/C++/Python, 2MB Quad SPI Flash Integrated with SPI/I2C/UART Interface
  • The Raspberry Pi Pico is a beginner-friendly microcontroller board that uses MicroPython to give you a taste of the Internet of Things and microcontrollers. The RP2040 is a well-designed microprocessor that can be utilized in almost any Internet of Things project. It has enough power to complete the task quickly.
  • 【Raspberry Pi RP2040 Microcontroller】Raspberry Pi Pico features Dual-core ARM Cortex M0+ processor, flexible clock running up to 133 MHz. With 264KB of SRAM, and 2MB of on-board Flash memory.Supports up to 16 MB of off chip flash memory via a dedicated QSPI bus
  • 【Multiple Software Support】Pico has rich and complete software support, it comes with a complete Rasberry Pi official C/C++ SDK, Micropython SDK.The programming and burning of Pico need to be carried out on the computer. Supported operating systems and computers include:Raspberry Pie with Raspberry Pi OS,Other platforms equipped with Debian based Linux system Computer with MacOS, Computers with Windows, etc.
  • 【Rich Hardware Interface】Raspberry Pi Pico has 30 GPIO pins, 4 pins for analog signal input and 26 × multi-function GPIO pins, 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels.USB 1.1 supported by host and device, The installation mode can be flexibly selected by users to facilitate welding with other development boards.
  • 【Build Project in Tiny Size】Only 2.1cm*5.1cm ( as small as your thumb). Pico has been designed to use either soldered 0.1" pin-headers or can be used as a surface-mountable 'module'.

Why use a relay?

A relay is an understandable bridge between a GPIO program and an old circuit. Its coil is controlled by the module’s transistor driver, while its contacts can switch the oscillator’s resistor network as an electrically separate circuit.

Benefits

  • Useful electrical separation between Pico logic and an unknown or separately powered vintage circuit.
  • Direct replacement for the original mechanical key switch.
  • Easy visual feedback from the module’s indicator LED and an audible click when the state changes.

Limitations

  • Mechanical switching is slower than a transistor or analog switch and contacts can bounce.
  • The coil draws substantially more current than a logic input.
  • Clicks may be audible, and the module may need a separate supply.
  • “Transistor relay module” is not a complete specification. Check coil voltage, input threshold, contact ratings, terminal labels, and whether flyback protection is fitted.

Never connect a relay coil directly to a Pico GPIO. A module advertised as a 5 V relay may or may not recognize 3.3 V logic, so verify its documentation or test its input before wiring the controller.

PIR behavior you must account for

A PIR module detects changes in infrared radiation, usually caused by a moving warm body. It is not a distance sensor and does not guarantee detection of a stationary person or object. Range, field of view, sensitivity, output hold time, startup settling, and retrigger mode vary by module.

  • Allow the sensor’s normal startup stabilization period before judging its behavior.
  • A hand moving toward the sensor is a different thermal event from a person crossing its field of view.
  • Sunlight, heaters, warm airflow, curtains, and other changing heat sources can cause false triggers.
  • The output may remain high after motion stops; software should treat that as a hold period rather than as a new event.
  • Connect the sensor ground as required and keep its output within the Pico’s GPIO voltage limits.

Parts and compatibility checklist

Vintage oscillator side

  • Science Fair/Radio Shack oscillator kit, or an equivalent transistor oscillator.
  • 47 kΩ and 220 kΩ resistors in the switchable network.
  • Original capacitors, transistor(s), wiring terminals, and an 8 Ω speaker.
  • Battery or low-voltage supply appropriate to that oscillator.

Controller side

  • Raspberry Pi Pico or pre-headered Pico H.
  • USB data cable, solderless breadboard, and Dupont jumpers.
  • PIR sensor module.
  • Relay module with a documented 3.3 V-compatible input and suitable contact rating.
  • MicroPython firmware and Thonny (or another MicroPython-capable environment).
  • Optional LED and current-limiting resistor for status indication.

Raspberry Pi lists the Pico as a 21 × 51 mm RP2040 board with 26 multifunction GPIO pins, three analog inputs, 16 PWM channels, 2 MB flash, 264 kB SRAM, USB 1.1, and MicroPython support. Its product page showed a manufacturer price signal from $4 for Pico and $6 for Pico W on August 18, 2026; these are U.S. list-price signals, not guaranteed retail prices. See Raspberry Pi’s Pico page. Wireless capability is unnecessary for this local motion-to-tone project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
With Pre-Soldered Header Raspberry Pi Pico Microcontroller Development Board Based on Raspberry Pi RP2040 Chip,Dual-Core ARM Cortex M0+ Processor
  • with pre-soldered header Raspberry Pi Pico. RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
  • Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz. 264KB of SRAM, and 2MB of on-board Flash memory.
  • Castellated module allows soldering direct to carrier boards. USB 1.1 with device and host support. Low-power sleep and dormant modes. Drag-and-drop programming using mass storage over USB. 26 × multi-function GPIO pins.
  • 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels.Accurate clock and timer on-chip.Temperature sensor.
  • Accelerated floating-point libraries on-chip.8 × Programmable I/O (PIO) state machines for custom peripheral support

Power and wiring rules

  • Use the Pico as a logic controller, not as the power source for the entire project.
  • Power the relay module according to its specification. Do not assume a Pico pin can supply its coil.
  • Share ground between Pico, PIR, and relay input only where the module’s wiring requires a common reference.
  • Keep the oscillator’s battery or supply electrically separate from Pico GPIO. Unknown kit voltages must never be connected to a GPIO pin.
  • Use the relay’s COM and NO contacts across the same two nodes occupied by the original key switch.
  • Confirm polarity and voltage before connecting USB or batteries. Pico supply limits do not make its GPIO pins 5 V tolerant.

The relay contacts can provide useful isolation when correctly rated and wired, but they are not an automatic safety guarantee.

Install MicroPython and bring up the controller

  1. Install the current Thonny release.
  2. Connect the Pico with a data-capable USB cable. If firmware installation is required, hold BOOTSEL while connecting and install the official MicroPython UF2 for the exact board variant.
  3. In Thonny, select the Pico/MicroPython interpreter and the board’s serial device. Labels vary by operating-system and Thonny version; consult the current Pico documentation portal if the board is not detected.
  4. Wire PIR VCC, OUT, and GND; connect OUT to GPIO 14. Connect the relay module input to GPIO 15 and its supplies as specified by the module.
  5. Test the PIR and Pico output before attaching the vintage circuit.
  6. After the analog oscillator works by itself, wire relay COM and NO to the original switch nodes, then power the oscillator.

Raspberry Pi’s MicroPython and Thonny walkthrough is available at this official magazine guide. The Python SDK reference is at the Pico Python SDK PDF.

Corrected MicroPython program

The published example contains a blocking delay and a variable typo: it defines pir_pin but later attempts to read pin_pin. The following is the minimally corrected version:

from machine import Pin
import utime

pir_pin = Pin(14, Pin.IN)
output_pin = Pin(15, Pin.OUT)

while True:
    pir_state = pir_pin.value()

    if pir_state == 1:
        output_pin.value(1)
        utime.sleep(1)
    else:
        output_pin.value(0)
        utime.sleep(0.1)

Use normal Python indentation when entering the program in Thonny.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
KEYESTUDIO Raspberry Pi Pico Basic Starter Kit with Headers Micro USB Cable, Pico RP2040 Microcontroller, Flexible 26 Multifunction GPIO Pins, Temperature Sensor, Programmable in C & MicroPython
  • New Flexible Microcontroller Board --- Raspberry Pi Pico is a tiny, fast, and versatile board. It's based on RP2040 chip, which features a dual-core Arm Cortex-M0+ processor with 264KB internal RAM and support for up to 16MB of off-chip Flash, flexible clock running up to 133 MHz.
  • Multi-Function GPIO Pins---It has 26 multifunction GPIO pins, including 3 analogue inputs, 2 × UART, 2 × SPI controllers, 2 × I2C controllers, 16 × PWM channels.
  • Rich Peripheral Set---A wide range of flexible I/O options includes I2C, SPI, and — uniquely —8 × Programmable I/O (PIO) state machines for custom peripheral support.
  • Multiple Software Support---Raspberry Pi Pico has rich and complete software support and community resources. Programmable in C and MicroPython. Drag-and-drop programming using mass storage over USB.
  • Low-power sleep and dormant modes; Accurate on-chip clock; Temperature sensor; Accelerated integer and floating-point libraries on-chip

More responsive, nonblocking version

This version keeps sampling the PIR during the hold period, which is preferable when the sensor retriggers or when you later add indicators and counters:

from machine import Pin
import time

pir = Pin(14, Pin.IN)
relay = Pin(15, Pin.OUT)

hold_time_ms = 1000
last_motion_ms = 0

while True:
    now = time.ticks_ms()

    if pir.value():
        last_motion_ms = now

    active = time.ticks_diff(now, last_motion_ms) < hold_time_ms
    relay.value(1 if active else 0)

    time.sleep_ms(20)

The one-second hold time is an editable software choice, not a measured property of the relay or PIR.

Bring-up sequence

  1. Oscillator alone: build the kit circuit and prove that the speaker sounds with its original manual switch.
  2. PIR alone: print or observe its output and allow startup settling before testing motion.
  3. Pico output alone: substitute an LED and resistor for the relay input to verify GPIO 15.
  4. Relay module: confirm its supply and 3.3 V input behavior; listen for a click and observe its indicator.
  5. Contacts: with power removed, use a multimeter to verify that COM-to-NO closes only when energized.
  6. Combined circuit: connect COM and NO across the original switch nodes and confirm the baseline tone first.
  7. Motion test: trigger the PIR and verify the second tone. Adjust sensitivity and hold-time controls only after wiring is proven.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

No sound

Disconnect the Pico and relay. Check the battery, speaker, transistor, capacitors, resistor placement, spring terminals, and kit-specific layout. Restore the original manual-switch operation before adding the controller.

Relay clicks but pitch does not change

Check that COM and NO—not the normally closed terminal—are across the same two switch nodes. Confirm the 220 kΩ value and test continuity while energizing the relay. Temporarily short the switch nodes manually to prove the frequency-shift section.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Freenove Raspberry Pi Pico Board Pre-Soldered Header, Dual-core Arm Cortex-M0+ Microcontroller, Development Board, Python C Java Code, Tutorial Example Projects
  • Raspberry Pi Pico: A tiny, fast, and versatile board built using dual-core Arm Cortex-M0+ processor (Comes with pinout card and stickers)
  • Detailed Tutorial: Provides step-by-step guide with MicroPython, C and Processing (Java) Code (The download link can be found on the product box) (No paper tutorial)
  • Example Projects: Each project has schematics, wiring diagrams, complete code and detailed explanations (Need extra items)
  • Easy to Use: Just connect the board to your computer (installed IDE) with the USB cable to program it
  • Get Support: Our technical support team is always ready to answer your questions

The Pico resets when the relay operates

Suspect coil-current or supply noise, inadequate USB power, poor grounding, or a module without proper flyback suppression. Use a separately powered, transistor-driven module, add local supply decoupling, and keep high-current wiring away from sensor signals.

PIR stays high

Allow startup stabilization, reduce sensitivity or delay, move the sensor away from heat sources, and use the nonblocking hold-time program. Continuous output can be normal module behavior rather than a Pico fault.

MicroPython raises a name error

Check the spelling: the input object is pir_pin (or pir in the improved program), not pin_pin. Also verify indentation and that the selected interpreter matches the board.

When this remix is—and is not—the right design

Choose it if you want a hands-on bridge between a vintage analog oscillator, PIR sensing, relays, and MicroPython, or if you have a Science Fair kit and want to modify it without soldering.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose another architecture when you need a precise frequency, continuous pitch sweeps, silent or very fast switching, minimal battery consumption, a compact production device, or guaranteed parts availability. A transistor/MOSFET, analog-switch IC, 555/CMOS oscillator, or Pico-generated PWM tone can meet those goals, but each changes the educational character of the original project. A Pico-generated tone also needs an amplifier stage; an 8 Ω speaker should not be driven directly from a GPIO.

Useful extensions

  • Add several switchable resistors for more than two nominal pitches.
  • Measure the oscillator with a frequency counter or oscilloscope instead of claiming unmeasured frequencies.
  • Add an LED that follows the relay state.
  • Replace the relay with an electronic switch after measuring the oscillator’s voltage and leakage requirements.
  • Rebuild the oscillator from currently available transistor, 555, or CMOS parts when the original kit cannot be sourced.
  • Use Pico PWM or a DAC for a separate digitally synthesized version with programmable melodies or sweeps.

The original Science Fair kit is optional, not a requirement. What matters electrically is a working transistor oscillator, an 8 Ω speaker, and a resistor path that the relay can switch without exposing the Pico to the oscillator’s supply.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.