DIGITAL I/O, ANALOG IN, SENSORS

Week 02 - 09/14/2022

Mistakes + Learning

The second week of Physical Computing — everything was moving towards the right direction — which I think, is making mistakes and learn from them. The quiz helped to strengthen some basic knowledges, which I think is necessary to know, even they are not often used outside this class.

I am still working on the name of come components, but it is getting much better compare to last week.I found myself referring to the Arduino Nano 33 IoT diagram basically every time when something needs to be connected. One of the goals of next week is definitely getting more familiar with all the ports and their functions.


Digital Input & Output w/ Arduino

This lab did not start well.

Instead of the 10-kilohm resistors, I took the wrong one in blue. They were in the same box.

When everything was perfectly connected and I was ready to see my LED light up, it did not work. I did think its the resistor but I did not recognize that I took the wrong one at all.

Since the example online was using Arduino Uno, and it provides 5V power, and the Nano 33 Iot provides 3.3V, so I thought maybe 10-kilohm resistor is too great for Nano 33 Iot. Instead of getting a resistor with a lower number, I made my second mistake — I connected the 9V battery to the breadboard without fully knowing and understanding how it should be connected to the board when Arduino is on. Based on my knowledge from last week, I connect the power directly to the board and hoped it would work. Obviously, it didn’t.

I went to Kota’s desk and asked for some help. He took a look at my board and mentioned that I was using the wrong resistor — that was a huge help. Kota also showed me how to connect battery to the board when Arduino is on.

I also made some small mistakes due to my own negligence. For example, accidentally connecting power to ground, inserting wire one row off, etc. I know these would happen on and off, however, learning form these mistakes helps me apply more patience, precision and care when working on the labs.

figure 1 - lighting up a led with switch using the power form Nano 33 Iot

figure 2 - right connection, wrong 10-kilohm resistor

figure 3 - powered from battery, but wrong connection to Nano 33 Iot and switch

video 1 - powered from battery, right connection to switch but wrong ports to Nano 33 Iot

figure 4 - how power should be connected when Nano 33 Iot is on — help from Kota

video 2 - with the correct resistor, powered from Nano 33 Iot directly, it worked!


Analog Input w/ Arduino

An error occurred when a file was being uploaded on Arduino. The board and port info on Arduino were selected correctly.

The error was fixed after I simply switched the USB to a different outlet on the laptop.

I strictly followed the examples on the lab online page for this lab due to my unfamiliarity with the software and the lack of use of C (last time I used C was in 2014).

More iterations will be made in the following weeks, by tweaking the code, or writing my own ones.

figure 5 - error : no device was found

figure 6 - error fixed

video 3 - negligence: black line connected to voltage bus instead of ground

video 5 - force sensor - pressed separately

video 4 - connection updated - it worked!

video 6 - force sensor - pressed together

Sensor Change Detection, Sensor Testing

figure 7 - phototransistor on breadboard

figure 8 - phototransistor testing when released

figure 9 - phototransistor testing when pressed

figure 10 - force sensor on breadboard

figure 11 - force sensor testing when pressed

figure 12 - force sensor testing when released

figure 13 - force sensor testing when pressed with mapping

figure 14 - force sensor testing when released with mapping

figure 15 - pushbutton on breadboard

figure 16 - pushbutton press detection

figure 17 - pushbutton long press, short press and tap detection

figure 18 - reading sensor threshold crossing

Idea of the Week — Poop Bag Retractor and Distance Detector(wip)

I have not gotten a chance to work on it yet — but it should get started shortly.

I would like to:

  1. Add a potentiometer on the motor set up, so the rolling speed can be controlled

  2. When one pulls a poop bag from its holder, one can easily pull out too much — which creates annoyance and inconvenience, because one might need to open the holder and roll back the extra part. I would like to add a distance sensor on the holder and let it detect its distance to the hand that pulls the bag — when the ideal range is reached, it will play a pleasant sound to notify the user.