You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_sections/_guide-primaries/sensors-and-actuators/color-sensors.md
+6-20Lines changed: 6 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,9 +25,9 @@ The APDS-9960 Color Sensor will allow you to complete the Color Challenge.
25
25
26
26
27
27
## How it Works
28
-
The RGB (Red Green Blue) sensor has an infrared LED light that detects color by emitting light and detecting with four photodiodes the reflected light. The photodiodoes are each filtered to sense the Red, Green, Blue, and Clear color components. The RGB provides the R G and B data in integer values of 0-255 (8 bit representation). We will grab that data using a communication protocol called I2C (Inter-integrated circuit), which is used in many electrical devices. Implementing I2C is out of the scope of this competition, but you can find more information about it [here.](https://learn.sparkfun.com/tutorials/i2c/all)
28
+
The RGB (Red Green Blue) sensor has an infrared LED light that detects color by emitting light and detecting with four photodiodes the reflected light. The photodiodoes are each filtered to sense the Red, Green, Blue, and Clear color components. The RGB provides the R G and B strength in integer values of 0-255 (8 bit representation). We will grab that data using a communication protocol called I2C (inter-integrated circuit), which is used in many electrical devices. Implementing I2C on our own is out of the scope of this competition, but you can find more information about it [here.](https://learn.sparkfun.com/tutorials/i2c/all)
29
29
30
-
For the competition, you will want to make sure you understand the RGB sensor also detect ambient light levels and proximity, so make sure your color sense is placed appropriately to successfully complete the color challenge.
30
+
You will definitely want to keep in mind that the sensor is affected by ambient light levels and proximity, so make sure your color sensor is placed appropriately and has sufficient (external🤔?) lighting to successfully complete the color challenge.
31
31
32
32
If you want more details on how the color sensor works, check out [this link!](https://www.utmel.com/components/everything-you-know-about-tcs34725-color-sensors-faq?id=1986)
33
33
@@ -46,16 +46,12 @@ If you're not sure about the ESP32 pinout, then check out [this page!](https://u
46
46
47
47
{: .highlight}
48
48
Make sure to connect the color sensor's power pin to 3.3V! A 5V connection will fry the sensor.
49
-
{: .callout-blue}
49
+
{: .callout-red}
50
50
51
51
The SDA and SCL on the color sensor MUST be connected to the specified GPIO pins on the ESP32. This is because they are the dedicated pins for I2C commmunication.
52
52
53
-
If you're not sure about the ESP32 pinout, then check out the diagram in [this page!](https://ut-ras.github.io/RobotathonESP32/getting-started/microcontroller-interface)
54
-
55
-
56
-
57
53
## Programming
58
-
For this tutorial, we’re only going to be reading the RGB sensor values from the TCS34725. Make sure that your pins are correctly connected or otherwise you won’t receive the data!
54
+
For this tutorial, we’re only going to be reading the color sensor values. Make sure that your pins are correctly connected or otherwise you won’t receive any data!
59
55
60
56
```cpp
61
57
@@ -86,19 +82,9 @@ void setup() {
86
82
87
83
voidloop() {
88
84
int r, g, b, a;
89
-
// Wait until color is read from the sensor
90
-
while (!apds.colorAvailable()) { delay(5); }
85
+
while (!apds.colorAvailable()) { delay(5); } // Wait until color is read from the sensor
91
86
apds.readColor(r, g, b, a);
92
-
// Read color from sensor apds.readColor(r, g, b, a);
Copy file name to clipboardExpand all lines: docs/_sections/_guide-primaries/sensors-and-actuators/ir-sensors.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,12 +54,13 @@ void setup() {
54
54
}
55
55
56
56
void loop() {
57
-
Serial.println(IRSensorName.getDistanceFloat());
57
+
Console.println(IRSensorName.getDistanceFloat());
58
58
delay(100);
59
59
}
60
60
```
61
61
62
62
## Extensions
63
-
You received values from the sensor, but do they mean anything? The next step for the IR sensor is translating and thresholding it. Take a look at the above graph. There is a strong linear relationship between your signal value and the distance away from the object. It’s your job now to code a function that returns an accurate distance given a voltage input value. After that, your team needs to threshold the data. When do the values become inconsistent (too close or too far)? What do you do with your robot when that happens?
63
+
You received values from the sensor, but what do they mean? The next step for the IR sensor is translating and thresholding it. Take a look at the above graph. There is a strong linear relationship between your signal value and the distance away from the object. It’s your job now to code a function that returns an accurate distance given a voltage input value. After that, your team needs to threshold the data. When do the values become inconsistent (too close or too far)? What do you do with your robot when that happens?
64
64
65
+
TODO review this extension thing and see if we want to make them actually calculate distance
Copy file name to clipboardExpand all lines: docs/_sections/_guide-primaries/sensors-and-actuators/line-sensors.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ You do NOT have to use all 8 of the LED/phototransistor pairs — You can leave
25
25
|:-------------|:------------------|
26
26
| 5V | 5V |
27
27
| GND | GND |
28
-
| Signal | Any ADC Capable Pin (i.e. GPIO32) |
28
+
| Signal | Any ADC Capable Pin (i.e. GPIO32, GPIO33) |
29
29
30
30
If you're not sure about the ESP32 pinout, then check out [this page!](https://ut-ras.github.io/RobotathonESP32/getting-started/microcontroller-interface)
31
31
@@ -52,21 +52,19 @@ void setup() {
52
52
// set up Serial Communication and sensor pins
53
53
Serial.begin(115200);
54
54
qtr.setTypeAnalog(); // or setTypeAnalog()
55
-
qtr.setSensorPins((const uint8_t[]) {33, 32}, 2); // pin numbers go in the curly brackets {}, and number of pins goes after
55
+
qtr.setSensorPins((const uint8_t[]) {32, 33}, 2); // pin numbers go in the curly brackets {}, and number of sensors in use goes after
56
56
57
57
// calibration sequence
58
58
for (uint8_t i = 0; i < 250; i++) {
59
-
Serial.println("calibrating");
59
+
Console.printf("calibrating %d/250\n", i); // 250 is the number of calibrations recommended by manufacturer
60
60
qtr.calibrate();
61
61
delay(20);
62
62
}
63
63
}
64
64
65
65
voidloop() {
66
-
qtr.readLineBlack(sensors); // Get calibrated sensor values returned in the sensors array
67
-
Serial.print(sensors[0]);
68
-
Serial.print(" ");
69
-
Serial.println(sensors[1]);
66
+
qtr.readLineBlack(sensors); // Get calibrated sensor values returned into sensors[]
0 commit comments