Week 9 – Analog Input & Output

Week 9 – Analog Input & Output

For this assignment, I decided to expand on my previous assignment of the unusual switch. I was thinking about a way to expand on it in a practical and useful way. Since I already had a digital sensor, for the analog sensor, I decided to use the light sensor. I was thinking that this would be a beneficial addition to the idea of the shoes because it allows it to not only glow when they are put on, but also has a built in LED light that automatically adjusts its brightness based on the ambient light. The idea of this is that the LED light is brighter when it is dark, so that you can easily find the shoes, and it dims when it is brighter because you have a clearer vision. This idea came from the countless times I’ve woken up in the middle of the night or early in the morning and wished I had a light source that would guide me without stumbling around for a switch in the dark.

I started by gathering the materials I needed: 

  • Arduino
  • Breadboard
  • Wires
  • Resistor (330k, 10k)
  • LED (multi-colour, blue)
  • Cardboard
  • Aluminum
  • Sponge
  • Tape
  • Scissors

I started by cutting out a piece of cardboard in the shape of a shoe, then cut two smaller cardboard pieces to act as the soles. I wrapped each sole in aluminum foil and built a sandwich-like structure. 

→ Taped the first aluminum sole to the base of the shoe

→ Placed a sponge layer over it as a barrier

→ Placed the second foil-wrapped sole on top

 

The sponge was necessary as it acts like a spacer that keeps the two foil layers apart unless pressure is applied (someone steps on it). When someone steps on the shoe, the pressure compresses the sponge, which allows the two foil layers to touch and complete a circuit.

After that, I set up the arduino and breadboard by starting off with what we have done in class. First, I made sure that the LED is connected to a digital output pin (pin 13) instead of directly to 5V. Then I added a wire to the bottom foil and connected it to GND and added another wire to the top foil and connected it to Digital Pin 2. Lastly I updated my code, and made sure to print in order to test the output, (0 = foot pressed→LED ON, 1 = no contact → LED OFF). 

Then, I added the light sensor circuit, connected a voltage divider using 10k and 330k resistors. I connected this to analog pin A2 and added a blue LED on pin 9, which allows me to control its brightness using analogWrite(). I chose this colour because I was hoping it would provide a more calming feeling. Using the Serial Monitor, I was able to verify that the LDR readings worked correctly. In the dark, the LED brightness increased and when I turned on a flashlight on the sensor, the brightness decreased. In the video demonstration, you can see that the brightness numbers of the LED were high when it was darker, and once I put a flash light on top of it, the brightness numbers went down. This allowed me to double check it was working correctly, even if the change was not as drastic.  

Code highlight:

int brightness = map(lightLevel, 1023, 0, 0, 255);
analogWrite(ledAnalog, brightness);

This allows the LED to fade dynamically depending on the amount of light in the room. The darker it gets, the brighter the LED glows, which is useful for locating the shoes at night.

 

Challenges and Future Improvements:

One of the challenges I faced was ensuring that the foil switch is stable. At first, it was difficult to get consistent readings from the foil layers. The sponge helped, but I also experimented with the positioning and pressure to make sure it only activated when stepped on.  Also, at first I thought the LED brightness was not changing, however, using the Serial Monitor I was able to confirm that it was working, even if the brightness was subtle. For future improvements, I was thinking that I could even add a soft chime when the shoe is worn in the dark so that it can enhance the feedback and add a helpful alert. Additionally, I could also work on the aesthetic aspect of it a little more. Overall, I am very satisfied with the way the shoe turned out.

Link to photos of the process

Link to final video demonstration

Leave a Reply