Projects:Spacestate: verschil tussen versies

Naar navigatie springen Naar zoeken springen
308 bytes toegevoegd ,  29 okt 2022
geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Regel 15: Regel 15:
Originally the Arduino Nano was powered by its USB connection, but it's connected via a very long USB cable and the range extenders are iffy, so it receives only ~3.8V over USB. Therefore, the Arduino is now powered from the LED board (~10V) through its Vin port, where a linear regulator transforms it to 5V (or it should, but it actually seems to produce 6V for some reason).
Originally the Arduino Nano was powered by its USB connection, but it's connected via a very long USB cable and the range extenders are iffy, so it receives only ~3.8V over USB. Therefore, the Arduino is now powered from the LED board (~10V) through its Vin port, where a linear regulator transforms it to 5V (or it should, but it actually seems to produce 6V for some reason).


The state of the switch is measured by pulling the bottom to ground, and then measuring the voltage at the top using the D3 pin with an internal pull-up. This will be ground when the space is OPEN (the two sides connect), and internal pull-up when the space is CLOSED.
The state of the switch is measured by pulling the bottom to ground (green wire in the image to the right), and then measuring the voltage at the top using the D5 pin with an internal pull-up (yellow wire). This will be ground when the space is OPEN (the two sides connect), and internal pull-up when the space is CLOSED.
 
[[Bestand:Spacestate-measure.jpg|miniatuur|267x267px|State measurement wires. Green = GND, connected to the bottom of the state switch. Yellow is where the Arduino measures, connected to the top of the state switch and with an internal pull-up resistor.]]
Then, the D2/D4/D5 control the LEDs in such a way that they switch colors using some nice animation when the state changes.
Then, the D2/D4/D5 control the LEDs in such a way that they switch colors using some nice animation when the state changes.


Navigatiemenu