Double Transducer: Rotational Speed to Heat

Project by Vincent and Maeve

Overview

Photo of the double transducer on, from above

Vincent's final device.

Maeve's two noisy boys, fully wired and brought to life.

Rotational Speed →Hall effect sensor →→Speaker → Audio input →→ Heat

A sensor reads RPM from another team's device. If the RPM is fast a speaker gets louder, if the RPM is slow the speaker is quieter. A mic listens to the volume, and if the volume is high a light bulb gets brighter and hotter, if it is low the light bulb dims and cools down.

doubTransducerTest.mp4

Video of Vincent's final device working. Testing Hall sensor/RPM by moving magnet by hand.

VID_20230924_141718989.mp4

Close up video blowing on the sound detector to illustrate LCD screen, LED, and bulb reacting to audio levels.

Above shot of the board, all parts turned on, but components have been slightly shifted out of their slots.

Parts from the device are all slotted in via balsa wood supports so they can be removed easily if something needs fixed- none of them/the wires are directly glued to the board. Came in handy for moving the LCD screen and resouldering it (suffered loose wiring in the crit).

IMG_5422.mp4

Video of Maeve's final device

Detail photo of the hall effect sensor embedded into the sculpted hand of boy number one.

Process

Really just a moderately sized jumble of wires and breadboards being a mess on the table.

Progress photo of Vincent's device coming along. working out hall sensor, sound detector, and mic.

VID_20230915_123804833.mp4

Progress video of Vincent's device where notably the bulb and sound detector are malfunctioning. Issue was resolved by moving the bulb to its own power supply.

Monitor screen - the line is NOT a steady 5 volts.

Photo of electrical noise caused by the bulb.

A hall effect sensor and and sound detector plugged into a breadboard, which is hooked up to an arduino

Maeve's testing rig for the initial sound detector and hall effect sensor

a photo of electronic components mounted on a chip board, such as an arduino, an lcd screen, a speaker, a microphone, and a 5 watt lamp.

Maeve's first hookup for all the components on the board

Discussion

In reflection, one of the newest/ most difficult parts to work with for me on this was working with something both physical and digital, and with it having so many different places an issue could be coming from.  Working to grasp what would be a bug in code vs. bad wiring vs. a limitation of a device vs. an actual malfunctioning part was a bit tricky. I'm glad I didn't leave an issue like the bulb not working till last second to try to remedy. it was interesting to come across that Arduino had less people posting online running into the same issues than previous little bits of code I've tried to learn before. That made it so I had to focus on a lot more of the problem solving from scratch, which felt a bit frustrating to have no idea how to solve some issues. 

Part of the reason I skipped using any breadboards in the final version was to practice soldering & having clean wiring. I found the breadboards were hard to read just by looking at, and that made things a little harder to know which/if a specific part was malfunctioned. I'm glad I spent the extra time on that for the final, even if was mainly aesthetic. I do really like about this that the wiring/building of the physical thing can be done efficiently. I think it would've helped to use that efficiency in translating from a diagram to a physical thing, rather than jumping straight to trying to wire things on breadboards.

-VW

Using a whole host of new components at once was quite the challenge, but it helped me to create a work flow for every new piece, where I would go from researching, to testing to implementing. Every individual device presented its own collection of complications and bugs in the code, but approaching each components one at a time helped greatly to break down the whole assignment into manageable chunks.  I did have to show self restraint every time I got deep into a component, such as trying not to spend too much time coding the speaker to play little songs on startup.

Translating every piece from the tests to the final board wasn't too bad! by doing each piece one at a time, it was fairly straightforward to get the whole board working. Most of the problems/bugs I encountered in the final step turned out to be janky wiring, but once that was cleaned up, all the work from the prototyipng and testing translated directly into the final product.

-Maeve

Schematic & Code

Block Diagram

Schematic

// Double transducer project, RPM to Heat. 

// Code uses hall sensor to pick up RPM, maps that to volume of speaker, mic picks up volume, vol

// from mic maps to bulb brightness. Extra LED to check if mic picking up vol above a certain level.

// Pins:

//Speaker: INPUT --> pin 5. 

//Hall Sensor: INPUT --> pin 3. 

//LED: INPUT --> pin 13.

//Mic: envelope--> INPUT--> pin A0.

//Bulb: OUTPUT --> pin 6.

//LCD: SDA, SCL.



#include <Wire.h>

#include <LiquidCrystal_I2C.h>

#include "Volume.h"

Volume vol;


int speakerPin = 5;     // only

int hallSensorPin = 3;  // + to 5v

int ledPin = 13;        // testing purposes

int micPin = A0;        // + to 5v

int bulbPin = 6;        // closed 5v, + to main ground


int delayLCD = 500;

unsigned long LCDtimer = 0;

LiquidCrystal_I2C screen(0x27, 16, 2);


int micState = 0;

int rotations = 0;  // below all for hall sensor & rpm

int rpm = 0;

bool hallPrevious = 1;

bool hallState = 1;

unsigned long hallPreviousTime = 0;

unsigned long hallCurrentTime = 0;


void setup() {

  Serial.begin(9600);

  pinMode(ledPin, OUTPUT);

  pinMode(bulbPin, OUTPUT);

  pinMode(hallSensorPin, INPUT);

  pinMode(speakerPin, OUTPUT);

  pinMode(micPin, INPUT);


  screen.init();

  screen.backlight();

  screen.home();


  vol.begin();  // note that volume library uses vol.millis() & vol.delay()

}

void loop() {

  hallState = digitalRead(hallSensorPin);          // check if hallState has changed

  if (hallState == HIGH && hallPrevious == LOW) {  // if the magnet state has changed from off to on

    rotations += 1;

    rpm = 60000 / (hallCurrentTime - hallPreviousTime);  // time inbetween rotations

    hallPreviousTime = vol.millis();                     // reset rotation timer

  }

  hallCurrentTime = vol.millis();

  hallPrevious = digitalRead(hallSensorPin);                // log current hallState

  int rpmMap = map(constrain(rpm, 0, 500), 0, 500, 0, 99);  // map for LCD

                                                            // have seen rpm hit > 5000, sensor is very finicky

                                                            // pretty sure I have bad wiring on hall & LCD chip board

  vol.delay(15);                                            // hopefully helps here?


  int speakerVol = map(constrain(rpm, 0, 500), 0, 500, 0, 255);  // map for Speaker output

  int speakerVolMap = map(speakerVol, 0, 255, 0, 99);            // map for LCD

  vol.tone(150, speakerVol);                                     // (frequency, volume 0 to 255)


  int micState = constrain(analogRead(micPin), 5, 150);  // (speakerVol = 255) = (micState ~ 137)

  int micMap = map(micState, 5, 150, 0, 99);             // map for LCD

  int brightness = map(micState, 5, 150, 0, 255);        // map for Bulb output

  int brightnessMap = map(brightness, 0, 255, 0, 99);    // map for LCD


  analogWrite(bulbPin, brightness);  // Bulb output happening


  if (micState > 127) {  // misc LED for testing audio vvv

    digitalWrite(ledPin, HIGH);

  } else {

    digitalWrite(ledPin, LOW);

  }


  if (vol.millis() - LCDtimer >= delayLCD) {  //LCD

    screen.clear();

    screen.setCursor(0, 0);

    screen.print("i:");

    screen.setCursor(3, 0);

    screen.print(rpmMap);  // rpm (hall sensor) input

    screen.setCursor(7, 0);

    screen.print("m:");

    screen.setCursor(9, 0);

    screen.print(speakerVolMap);  // speaker volume output

    screen.setCursor(9, 1);

    screen.print(micMap);  // mic (sensor) input

    screen.setCursor(12, 1);

    screen.print("o:");

    screen.setCursor(14, 1);

    screen.print(brightnessMap);  // bulb brightness output

    LCDtimer = vol.millis();

  }

}