I am new to arduino and processing. I have a very a basic knowledge of code and a little bit better knowledge of wiring. So I apologize for my ignorance.
What I want to do is use multiple switches to control the volume of sound coming out of a speaker. The general idea is to attach the switches to seats and depending on the number of switches pressed (i.e. people sitting in the chairs) the volume of sound coming out of the speaker gets louder.
Eventually I would like to have the switches turn on lights as well. Perhaps even have the sound coming out of the speaker visualized as text on the screen using Processing.
Could anyone point me in the right direction? I know how to wire a switch to turn on a light, however I don't know how to use the switch to turn sound on and make it progressively louder as more switches are pressed.
Any help would be appreciated. Thanks!
How many seats are we talking about?
You could just make a circuit that connects another resistor in parallel with a known voltage divider.. for each 10k resistor thats added to the circuit the total resistance will go down..
1 / RTOTAL = (1 / R1) + (1 / R2) + (1 / R3) + ...
If you have 5 resistors @ 10k connected in parallel you get 2k Ohms
If you have 100 resistor @ 10k connected in parallel you get 100 Ohms
Use the analogRead-function to read the voltage, and you get a value that increases with each button thats pressed...
Or you could sample the switch values and then use that value to set the wiper position of a digital potentiometer chip that served as the volume control of your audio amplifier.
Thanks for the tips. Sorry for not responding sooner.
Those are very good suggestions, but my problem lies more in the coding side than the way to achieve it physically. Do you know where there would be some sample codes I could piece together to get something resembling what I’m looking for?
The coding for controlling the volume will depend on the hardware. Describe what hardware you've elected to go with, and then the coding can be done.
You guys get started coding, and I'll go see what the requirements are
doesn't usually work out too well.
Determining the input data in this problem is relatively easy. But the original question was how to use Arduino output data to control the amplifier. You could put resistances or transistors into the speaker wires to reduce the power transmission to each speaker, but it would probably be better to control the amplifier.
I haven't tried it, but my husband suggests hacking into an universal remote controller for the amplifier. You would replace the contact switches on the volume "up" and "down" buttons with solenoids to produce a momentary contact each time you wanted to increase or decrease the volume. You would use the Arduino to detect either button pushes or occupancy at the chairs and to control the solenoids. By experimentation, you would have to determine how long to keep the "remote" circuit closed in order to alert the amplifier, and program the Arduino appropriately.
You can put the remote in a box to keep it aimed at the amplifier receiver.
For instance, using a resistance network to provide occupancy data, you could send a pulse to the appropriate solenoid whenever you detect a change in the resistance (e.g.voltage). Or you could have individual "up" and "down" buttons on the chairs, and use the Arduino to change the volume when it detects that any of the buttons are pushed. Of course, it might be easier just to pass the remote around.
One issue - with the multiple button solution, you might end up with dueling buttons, leading to hilarity and/or combat!
hook it to the arduino
find out the code for volume-up and volume-down, make arduino blink code functions.
IR-LED is made to blink to stereo, volume-up if someone sits down and vice-verce.
Simple solution: (few-seats)
each touch sensor in seat is sending own signal to own pin in the arduino.
Loop over pins and count those who are live into counter (int)
compare to another counter, old_counter (int)
if new counter is different from old then:
if it is less: blink volume-down for each integer (old_counter - counter)
if it is more: blink volume-up for each integer (counter - old_counter)
go to step 1 (loop).
.... you get the gesture...
The harder way:
(not harder just more hardware)
IR-step same (get code, program to Arduino…)
Make ResistorLadder R-2R that can hold values to all seats and gives 0-5V response accordingly.
assign each seat binary value eg. 0101.
each seat has equally many wires from it as its 1 values.
(this example 0101 has two wires from it)
the wires are linked to the r-2r ladder in right binary position.
when a person sits down, all wires from seat are with voltage.
EDIT: just forgot, use diodes when linking, do not want current to travel backwards through all the chairs and messing everything up in counting.
R2R is linked to analog in
analog in gives values from 0-1023 according to peapole sitting down
mesure analog in
compare to old_analog_in
put current counter as old_counter
but here you divide total number of seats with max analog in to get the step size
counter/stepsize=number of people sitting…
Where/how do you get the blink codes and frequencies for each TV, stereo, DVR, etc?
manufaturers, search the internet…
just DIG, its bound to be there…
or you could tap the ir led of the remote
connect it to the aruino and put it in an array from digital read…
just a thought…
found tv-remote arduino project for sony:
just search the forum…
Just realized that you asked about using processing and arduino.
Is this an artwork thingy?
And by volume are you talking about the PC-VOLUME?
in processing sketch?
post your question then in the software section ::)
like how to control sound volume from processing...
or interfacing with media-player in processing...
Thanks for all the help! I'm not so sure I'm advanced enough to do what you were saying. It makes logical sense, but I have a problem implementing it.
Anyway, what I've ended up doing is using a piezzo buzzer as the sound output device and have the button control the value using digital read with a short delay time after the button is pressed for it to turn off.
In a real life situation, this would allow people to leave the lecture hall, auditorium, etc. and still be able to hear the speaker's last few announcements.
For light, I've used a simple button press situation again. In this case, I'm going to place the button behind a door so when it is open, the lights are on. Closed, the button releases and turns the lights off. This is a good situation for a room that requires darkness when the doors are shut, such as a movie theater.
I know it's simple and could be handled with IR sensors, etc. but I'll work my way up there. :)