Labs / Bipes + MicroPython / 8 Actuators (Outputs / Actuators)

8.10 Want to build an ultraviolet germicidal lamp? Control the switching of the UV lamp array! โ€”โ€” MOSFET-based UV ultraviolet lamp matrix module

Author: Li Zisheng ยท Source: FreakStudio open documentation ยท License: CC BY 4.0

Contents

Young makers, today letโ€™s unlock a "magic matrix that emits invisible ultraviolet light" ๐Ÿ”ฎ!

We cannot see ultraviolet light with our naked eyes in daily life, yet it can make fluorescent paper glow and sterilize small items. The MOSFET-based UV lamp matrix module acts just like a "canvas for invisible light"; it also supports PWM adjustment of ultraviolet intensity, making it incredibly cool for fluorescent graffiti or as a mini sterilization device โœจ!

1. Module Introduction

Ultraviolet rays are invisible light, and the pins of ordinary development boards cannot directly drive UV lamps. The core of this module is a MOSFET driving circuit: UV lamps require a large current to turn on; the MOSFET acts as an "electronic switch" that can control a large current with the small signal (PWM) output from the development board. This not only protects the development board but also enables the UV lamp to emit light stably, and it also supports precise adjustment of ultraviolet intensity via PWM.

Compared with conventional direct-drive UV lamps, it features the following characteristics:

In graphical programming, these blocks are commonly used:

In practical projects, it is often used for the following purposes:

Popular Science: Why Use MOSFETs to Drive UV Lamps?

UV lamps require a higher current than the pins of a development board can supply when operating, and direct connection will burn out the development board. A MOSFET can use a small signal (such as PWM) output by the development board to control a large current, just like using a small key to open a large sluice gate โ€” this is not only safe but also enables the UV lamp to work stably.

2. Wiring Instructions

To make the UV lamp matrix emit "invisible light", it is necessary to separate the signal circuit from the power supply circuit for wiring:

8.10 Want to build an ultraviolet germicidal lamp? Control the switching of the UV lamp array! โ€”โ€” MOSFET-based UV ultraviolet lamp matrix module

2.1๐Ÿ”Œ Signal Loop (Development Board โ†” Module)

This part transmits the control signals of the development board. We will connect the MOSFET-based UV ultraviolet lamp matrix module to the digital interface DIO0 of the development board, and the corresponding relationship is as follows:

Development Board Pins

Matrix light module pins

Description

Pin 6

DOUT

The pin on the MCU that generates PWM waveform output or high/low level output

Pin 7

NC

-

2.2โšก Power Supply Circuit (Power Supply โ†” Module)

This section supplies the operating current for the UV lamp matrix.

LM2596S Adjustable Power Supply Module

Matrix Light Module Pins

Description

VOUT

Green terminal

Power Supply 5V

VIN

-

Connect the battery

๐Ÿ“Œ Note

3. Example: Demonstration of UV Intensity Gradient

Objective of the Experiment:

Let the UV intensity of the UV lamp matrix start from 0, increase by one gear (step size: 3000) every 1 second until reaching 36000, then automatically turn off the matrix, and meanwhile print the current intensity value in the terminal to intuitively experience the effect of PWM dimming.

Little Life Insight: The ultraviolet disinfection lamps in hospitals can adjust their intensity, which follows a similar principle. Now let's make an "Ultraviolet Intensity Gradient Demonstrator"!

The graphical program is as follows:

8.10 Want to build an ultraviolet germicidal lamp? Control the switching of the UV lamp array! โ€”โ€” MOSFET-based UV ultraviolet lamp matrix module

Building Block Assembly Steps:

  1. Generate intensity gradient values
    • Drag in count with i from 0 to 36000 by 3000 blocks;
    • Let the variable i start from 0 and increment by 3000 each time to simulate the change of ultraviolet intensity from 0 to the maximum.
  2. Configure PWM output
    • Drag PWM #6 block into the loop;
    • Selected Pin: Pin 9 / GPIO6 (corresponding to DIO0 interface);
    • Set the Frequency to 1000 (the frequency for stably driving the UV lamp);
    • Set Duty to i (use variable i to control the duty cycle to achieve intensity variation).
  3. Print strength value
    • Add print "Current output PWM" and print i blocks to display the current intensity in the terminal.
  4. Control the rate of change
    • Drag in the delay block and set it to 1 second โ†’ this makes the intensity change smoother and easier to observe.
  5. Turn off the UV lamp matrix
    • After the loop ends, drag in the set output pin block;
    • Selected Pin: Pin 9 / GPIO6;
    • Set to false โ†’ turn off the output, and the UV lamp matrix stops emitting light;
    • Add the print "Turn off the UV matrix" block to indicate the end of the experiment.

Experimental Effect:

C2179.MP4 140.0 MB

Graphical blocks will be automatically converted into MicroPython code, and the running results will be displayed:

8.10 Want to build an ultraviolet germicidal lamp? Control the switching of the UV lamp array! โ€”โ€” MOSFET-based UV ultraviolet lamp matrix module
8.10 Want to build an ultraviolet germicidal lamp? Control the switching of the UV lamp array! โ€”โ€” MOSFET-based UV ultraviolet lamp matrix module

Directly importable building blocks:

UV matrix.xml 4 KB

Tips

  1. ๐Ÿ”” Safety Reminder:
    • Ultraviolet rays are harmful to the eyes and skin. Do not look directly at the UV lamp during the experiment, and do not touch the glowing lamp beads with your bare hands.
    • Be sure to turn off the UV lamp array after the experiment to avoid prolonged exposure to ultraviolet rays.
  2. If the UV lamp does not turn on:
    • Check whether the signal pins are connected correctly (Pin 9 / GPIO6) and whether the wiring is secure;
    • Confirm that the 5V power supply is normal, and check whether the GND of the module is connected to the GND of the development board.
  3. Advanced Gameplay:
    • Draw a hidden pattern on paper with fluorescent paper, and turn on the UV light matrix to make the pattern visible;
    • Paired with a light sensor, it automatically activates the UV lamp when ambient light dims, simulating an automatic disinfection scenario.

โœจ Interactive Quick Question

  1. Just think: Why is ultraviolet light invisible? How do we know that a UV lamp is emitting light?
  2. Try this: Change the step size in count with from 3000 to 6000, and see whether the intensity change will become faster or slower?

Summary

  1. The MOSFET-based UV lamp matrix module is a invisible light output module that drives UV lamps to emit ultraviolet rays via MOSFETs;
  2. It supports PWM dimming, which enables continuous intensity adjustment from dim to bright, making it suitable for applications such as fluorescence interaction and disinfection experiments.
  3. The basic application is to achieve intensity gradient through "loop + PWM", while the advanced application is to combine fluorescent materials to create interactive devices;
  4. Always pay attention to safety during the experiment and avoid direct exposure of ultraviolet rays to your eyes and skin.