Closed qyc206 closed 3 years ago
Tested ADC MCP3004 with known reference voltages (gnd and 3.3V) Code:
Result:
CURRENT STATUS: does not seem to be sensing/detecting changes in distance (only detects one value... 0V when ADC read value is converted to voltage)
Code:
Current wiring:
Resource:
https://www.instructables.com/Using-IR-Sensor-TCRT-5000-With-Arduino-and-Program/
Current status: still doesn't work.. :'( Wiring has been changed to the following
Needed to find my pi's new ip address before accessing VNC viewer. This is the output when the C0 is connected to 3.3V.
This is the output when C0 is connected to GND.
Followed CompEDP1 lab 12 manual instructions and used the MCP3004 datasheet to wire the circuit.
I only get the following message even after adding an LED like most online tutorials recommend. This value is consistent no matter if I shine light directly onto the digital sensor or not.
I added a LED to the input of the digital sensor and wired the digital sensor output as the input to the ADC.
My current code:
Moved circuit onto a bigger breadboard yesterday and started testing it today. The values on the distance sensor works but the values seem inconsistent.
This is my current circuit as of yesterday. The green wire is only for for testing purposes. It usually holds a value of 23mV. The voltage drop across the distance sensor is 0.2-0.3mV.
This is the circuit schematic as of now. I think the issue lies in the 5kΩ I used to power the distance sensor's collector pin and/or the A pin of the digital sensor. Many resources say to connect it to a GPIO input, but I'm still not sure why.
Tried to change the pull down resistor but when using the following code, the digital sensor's readings dropped lower than expected.
Replaced 5x 1kΩ resistors with a 4.7kΩ resistor. Replaced GPIO16 and 100Ω resistor input to the A pin on the digital sensor with 100Ω resistor to ground and then removed a connected to the A pin altogether.
Resources: spidev documentation - https://pypi.org/project/spidev/ spidev and ADC example - https://learn.sparkfun.com/tutorials/python-programming-tutorial-getting-started-with-the-raspberry-pi/experiment-3-spi-and-analog-input distance measurement - https://tutorials-raspberrypi.com/infrared-distance-measurement-with-the-raspberry-pi-sharp-gp2y0a02yk0f/ https://jeremyblythe.blogspot.com/2012/09/raspberry-pi-distance-measuring-sensor.html?m=1 enable SPI - https://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/ tcrt5000 datasheet - https://www.vishay.com/docs/83760/tcrt5000.pdf pull_up_down resistor - https://www.14core.com/wiring-with-tcrt5000-reflective-optical-sensor-module-on-raspberry-pi/
Asking prof for help on piazza Current code
New circuit:
Voltage and ADC values change as objects move closer/further away
Code: