How to Make a Conductible Material Test With Arduino

by Sarah W in Circuits > Arduino

205 Views, 1 Favorites, 0 Comments

How to Make a Conductible Material Test With Arduino

Arduino_Uno_-_R3.jpg

Hi I'm Sarah and today I will teach you how to make a Conductible Material Test With Arduino. Before I start I'd like to give credit to ArdusatCHoffman for his Instructables and Tom Igoe for his Tone Melody TinkerCAD start-up set. Both of their designs and codes inspired my work and helped me create it.

Please feel free to give me feedback on my circuit or Instructable.

Supplies

Arduino Uno Rev 3- official Made in Italy CAD $28.95

LED-5G, 5mm Green Diffused LED CAD $0.15

330 Ohm Resistor With 5% Tolerance Carbon Film CAD $ 11.99

Piezo Speaker CAD $2.89

Digital Multimeter CAD $65.92

Solderless Breadboard Jumper Cable Wire Kit CAD $9.89

Breadboard-830 CAD $8.23

Get the Needed Components for This Project

Screenshot 2022-01-13 10.24.05.png

Components and Quantity Needed

Arduino Uno R3 (1)

LED (Green) (1)

330 Ω Resistor (2)

Piezo (1)

Amperage Multimeter (1)

Assemble the Circuit

Screenshot 2022-01-13 17.07.13.png
Screenshot 2022-01-13 17.23.46.png

Part 1: Sensor

You want to start by connecting your 330 Ω Resistor to your Arduino and your multimeter. Connect the left end of your resistor to the ground pin of the Arduino (black wire) and the right side of the resistor to the A1 analog pin of the Arduino (dark blue wire). Next you want to connect the positive wire from your multimeter to the 5V pin (red wire) and the negative wire from the multimeter to the same side of the resistor as the dark blue wire. Look at part one picture.

Part 2: LED

Connect the second 330 Ω resistor to the anode end of your LED. Then connect the other end of that resistor to the digital pin 11 (orange wire). Now connect a wire from another ground pin to the vertical negative rails on the bottom of the Breadboard (yellow wire). Next connect a wire from the negative side of the rail to the cathode end of LED. Look at part two picture.

Part 3: Speaker

Connect pin 8 to the positive end of the speaker (purple wire) and connect another ground pin to the negative rail and then to the negative end of the speaker (green wire). Look at part three picture below.

Change the Wire Colours

Screenshot 2022-01-13 18.32.06.png
Screenshot 2022-01-13 10.06.03.png

Now you have finished creating the circuit, that last part of the hardware is to change any wire connecting to ground to black. When your first building a circuit it's ok to use different colour wires to keep track and not get mixed up, but to make your circuit more professional you typically want to keep red wires for positive and black wires for negative. Also after programming, make sure your multimeter is in the amps setting or else the circuit would not work.

Programming (Find the Code File at the Bottom of This Step)

Screenshot 2022-01-13 10.25.25.png

int conductSensor = A1; //Declaring variables

int conduct_val;

int Spkr = 8;

int greenLED = 11;

#define NOTE_C4 262

#define NOTE_G3 196

#define NOTE_A3 220

#define NOTE_B3 247

#define NOTE_C4 262 //Defining the notes and the frequency.

int melody[] = { NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4 }; //

int noteDurations[] = { 4, 8, 8, 4, 4, 4, 4, 4 }; // The melody and what notes you want to be played like quarter notes or eight notes.

void setup() {

Serial.begin(9600);

pinMode(Spkr, OUTPUT); // Will the pin act as output or input?

pinMode(greenLED, OUTPUT);

pinMode(conductSensor, INPUT);

}

void sound()

{

for (int thisNote = 0; thisNote < 8; thisNote++) {

// Calculation of note duration is one second divided by note type.

int noteDuration = 1000 / noteDurations[thisNote]; tone(8, melody[thisNote], noteDuration);

// This distinguish the notes,this lets you set a minimum time between them. // the note's duration + 30% seems to work well:

int pauseBetweenNotes = noteDuration * 1.20; delay(pauseBetweenNotes); // stop the tone playing: noTone(8); } }

void loop() //Everything here will repeat.

{

conduct_val = analogRead(conductSensor);

Serial.print("Conduction sensor reads "); // Read if there is current flowing and that value is called conduct_val

Serial.println( conduct_val );

delay(100);

if (digitalRead (conductSensor) == HIGH){ // if the sensor reads that current is flowing then turn the led on.

digitalWrite (greenLED, HIGH);

digitalWrite; sound();

}

if (digitalRead (conductSensor) == HIGH){

sound(); // if the sensor reads that current is flowing then activate the void sound command.

} }