Technical University of Iasi - Faculty of Automatic Control and Computers
Microprocessor Systems

Laboratory No. 8

  • L8.1 Title

  • Rpi Pico - musical gestures generator


  • L8.2 General Presentation, Purpose

  • The laboratory work explores interfacing ultrasonic distance sensors with the RPi Pico platform and generating PWM signals for sound, lighting, DC motor control, etc. Through the BT module, interconnections with other equipment can be made. The aim is to use gestures to generate musical notes. At the end of the laboratory, detailed information will be available about building gesture-controlled musical instruments as a project model
    SpinOFF.

  • L8.3 Resources


  • Hardware: Platforme Raspberry pi Pico , sensor cu ultrasunete Hc-SR04, LED, modul BT RN42/HC05, modul audio tip GF1002, difuzor 8ohmi 0,25W.


    Software: MicroPython

    Documentation : Circuit audio PAM 8403



  • L8.4 Example Program Sources

  • 1. PWM to control LED brightness
    2. Ultrasound - distance visualization
    3. Generate PWM notes for score - “One Elephant”------See video
    4. Generate sounds with ultrasonic sensor



  • L3a.5 Experiment Execution/Monitoring

  • Interfacing the HC-SR04 ultrasonic sensor to the Raspberry Pi Pico platform is shown in the schematic below:


    The frequency spectrum of ultrasonic signals is shown in the following figure:


    The sensor emits trains of ultrasonic signals after the Trig command is validated, and the travel distance of the ultrasonic waves is proportional to the duration of the echo signal, as shown in the figure below:



    In prototype program 1 there is a solution for determining the duration, and thus the distance to an object. Frequently, this sensor is used in vehicles for object detection as follows:

    PWM signals can be generated by the 7 dedicated blocks, allowing programmable values for period and duty cycle. The corresponding MicroPython classes support the following operations:



















  • L8.6 Proposed Problems
  • 1. Create a Python script that allows adjusting the brightness of an LED via a mobile phone equipped with a BT Terminal.
    2. Create a MicroPython application that, through a mobile phone equipped with a BT Terminal, will generate musical notes with a duration of 1 second when pressing keys 1, 2...8.
    3. Create an application that allows displaying on a mobile phone equipped with a BT Terminal the distance provided by the ultrasonic sensor.
    4. Create a MicroPython application that generates musical notes accompanied by harmonics;
    5. Create a musical instrument that allows generating sounds with 2 hands according to prototype program no. 4 (see NASA SPIN OFF).

  • L8.7 The Experiment Can Be Extended To:


  • - Building gesture-activated musical instruments;
    - Building active objects for the visually impaired;
    - Building systems for object detection;
    - Developing applications for motor control, lighting, inverters/converters;
    - Developing the universe of Wearable computing



  • L8.8 Additional Information


  • © 2024 - Florin Pantilimonescu - Faculty of Automatic Control and Computers