This week’s PComp assignment was to create some interesting Arduino project, with analog input & digital output.
I happened to get IR (Infrared light) receiver and sound sensor at my hand, I tried to use them!
The projects below are what I have done after class3:
– Arduino Project with IR receiver
*FYI: IR light is invisible, but can be a bit felt as a heat by humans. IR radiations are really a lot around us, and for example, almost all the remote control (of TV, audio, projector…) are using IR to transmit some instructions.
and the projector remote control of our PComp classroom 🙂 –
* This IR receiver has 3 legs: VCC, GROUND, OUTPUT
As you can see, super-interestingly, I could figure out what kinds of codes are emitted by this projector’s remote control, and based on that information, I could make codes to figure out what button was pushed, even though I don’t see the button! Isn’t it like a sort of magic!?
* I picked up 8 buttons there as samples: Power, Search, Computer, Video, USB, Center Button, Help!!!, and Freeeeeze!!! 🙂
Also, the input of IR is converted into digital signals at IR receiver, and I made Arduino to send those information out to control LED flash!
– Arduino Project with IR receiver,
the projector remote control of our PComp classroom, and 3 LEDs –
– If you push “Power”, the red LED turns ON.
– If you push “Help” button, the yellow LED turns ON.
– If you push “Freeze” button, the blue LED turns ON.
– and…If you push the center button, all the 3 LEDs turn ON!
*read the IR signals and convert those into digital electric power to turn LEDs on!
It really was fun to control “invisible” signals.
I also found that these kinds of IR signals are used in various places like TV, projectors, Air Conditioners, audio, …. at any kinds of remotely controlled machines. Actually, I found LED-like IR emitter embedded in the TV remote control at my house!
Now, I learned that each of these emitted IRs (about 38 kHz, rare frequency in the nature so that the IR receiver can recognize the signals) is assigned to some message like “Power” “Search” “Menu”… under some protocol by NEC, Toshiba, Hitachi,…
*The projector remote control of our PComp Classroom actually seems to be using NEC protocols.
So, I suppose, if the IR sent by the IR emitter on the remote control is received by the IR receiver, the machine would start to act according to the protocol (instructions) for that IR message.
This seems to be a kind of modern CODEs/steganography, invisible to human beings…
*That’s why sometimes it takes time if you are far away from the IR receiver, or your remote control is not directed to the IR receiver… (I tried various ways to put buttons on the TV remote control, and confirmed these!)
Also, with a sound sensor, I made a bit “club-like” dancing lights machine.
– Arduino Project with Sound Sensor
and the intro of my original song “SHAKUNETSU (scorching heat)” –
Actually, I wrote the code like the below:
First, define 4 integers: threshold1 < threshold2 < threshold3 < threshold4. Then,
1) If the sound volume is more than threshold4, all the 4 LEDs (RED/YELLOW/BLUE/GREEN) turn ON.
2) If the sound volume is between threshold3 and threshold4, only RED/YELLOW/BLUE LEDs turn ON.
3) If the sound volume is between threshold2 and threshold3, only RED/YELLOW LEDs turn ON.
4) If the sound volume is between threshold1 and threshold2, only RED LED turn ON.
5) If the sound volume is below threshold1, all the 4 LEDs turn OFF.
Sound Sensor has, like IR receiver, 3 legs: OUT, GROUND, VCC
This output signals would be INPUT to Arduino through A0 (and analogRead on the serial monitor), and would be OUTPUT through i.e. 6, 9, 11, 13 as voltage (electric power) to turn LEDs ON.
The difficulty here was… that the sound sensor is so delicate and unstable…
Every time I read the Arduino codes, the sound volume range somehow changes and it was really hard to determine the suitable threshold1/2/3/4 value. Also, how to control the LED ON/OFF by sound volume was also really tough!
Here in the video, I used a part of my original song called Shakunetsu (Scorching Heat) played by my jazz piano TRIO (Sachiko Nakajima: piano, Yasushi Yoneki: bass, Tamaya Honda: drums).
As you can see, sometimes, the LED motions just matches to the sound, but not always…
Anyway, for me, these projects were really really FUN!!!
But, honestly, I also had really hard time… because, Arduino seemed to be suddenly totally NOT WORKING today!!!
I checked all the details and various Arduino projects, searched the information, uninstall & reinstall… almost everything I could do. I thought that something serious happened to my Arduino (shorted!?)… and finally had the courage to ask Professor Daniel Rozin.
And… he kindly checked all the details and found that … just one wire was not working!!!
WOW… a bit shame… but this experience gave me SO RICH learnings, for the way Daniel took was so logical, simple, and organized!
He just checked the possible cause one by one, effectively using the MultiMeter (today, I think I finally understood how important MultiMeter is!), and that inspired me! as well as relieved me a lot.
Even after that, I encountered with similar strange situations in SoundSensor project (only 2 LEDs works but other 2 LEDs NOT).
I carefully checked all the details (I thought) following what Daniel did, and found that even if I change some wires, LEDs, registers, the same weird thing still happened. Also, I gradually simplified the codes until it totally changed into very very simple basic codes (not with SoundSensor), but STILL I could not figure out what was the reason.
So, finally, I started to check all the wires at my hand, and……. found that MANY of the wires at my hand were DISCONNECTED…(So, possibly, when I switched the wire, both wires were disconnected…)
It actually wasted my time, but also gave me rich and severe learnings again.
I think I am now getting used to these “physical” matters, and that also excites me a lot now!
Finally, as an observation, not only TV remote control etc., but also I have been observed “elevator buttons” at ITP floor during this whole week!
My assumption is that:
1) as for the floor number light’s ON/OFF, I think the elevator touches to the conductive thing for each floor (the distance between those two could be just the same as the elevator height) and that makes the circuit to turn on that floor’s number.
2) when “DOWN” button on the 4th floor (ITP) is pushed, the signal “go to the 4th to go down” to both elevators.
Based on the timeline of those (multiple) instructions and its current status, each elevator re-order the instructions and follow that each by each, converting electric energy into motion energy.
*I think I could write down the codes for that, mathematically!:)
3) from my observations, as both elevators are slow, even though the signals might be speedily conveyed to those, it often takes some time for them to get to the 4th floor with “DOWN”…
There might be more efficient codings, but I am not sure yet…
*About 30 seconds to 3 minutes waiting time
Sachiko Nakajima, Sep. 26th, 2018