In this week, I tried to make demos with different sensors and objects which I haven't used before as digital/analog input and output. Try something new is really hard. I have gone through many failures and it toke me a lot of time. But now I know how those sensors work in Arduino, which I think can be very helpful to my future projects.
While I was using fruits as analog input, I came up with an idea that to make an installation which can interact with people by telling what food they are touching and whether it is fresh or not.
The idea is to make fruits as analog input and use a DFPlayer and a speaker as digital output.
I divided the project into three parts. Demo 1 is to make fruits as analog input and use a speaker as the output - just to make sound. Demo 2 is to use a digital input button and link a DFPlayer to the circuit to play mp3 files. Demo3 is to put Demo 1 and 2 together.
I learnt from a video by educ8s.tv. But the sound came with a loud and annoying “Dudududu". I checked the circuit, the description of DFPlayer and my speaker. They should work well together. Finally I found the answer by Google. The way to reduce the "Dududu" is to put a bigger resistance between the 5 volt and the VCC of DFPlayer.
After the first 2 demos were done, I think it was easy to put them together. But it didn't come out as I supposed. After I put fruits as analog input in Demo2's circuit, the analogRead was different as it was in Demo 1 (although I used the same fruit). And also I couldn't control the speaker by this analogRead. When I touched the fruit, the sound was played, but when my hand left, the sound didn't stop.
By the time I wrote this blog, I haven't figured out how to solve this problem. Still working on it.