Robotics Education: Detector Building Part 2
2024-01-19 | By Antonio Velasco
License: Attribution
In the last installment of the series, we talked about how we created a rudimentary conductivity sensor and output the basic conductivity and resistance on our LCD! We were able to make significant progress on our detector-building journey and create our prototype, demonstrating that the design worked and that we were on the right track. Over the next couple of days, we worked on improving the design, calibration, and making an LED indicator to meet the specifications set by the rules for the Science Olympiad. To do well at the competition, the students will not only need to adhere to the rules but also include certain features that will grab them some bonus points--and in our case, that's in the form of LEDs.
Debugging and Improving - The Slow Part!
Our design last time displayed the resistance and conductivity--which is great, but for our purposes, we need to display the voltage and eventually the PPM (parts per million) of NaCl (salt) in the water solution. This would just be the direct analog value from the A0 pin that we used, so that was easy to implement. The PPM would be much harder and would take a lot of calibration and testing in the later phases.
We did have a major issue: the value on the LCD would spike randomly. It'd be consistent at maybe 200 mV but then spike randomly to 500 mV or more. This could be chalked up to several reasons, whether it's the very makeshift probe (we just used regular jumper wires, something that will be changed later on) or something else, it was something that would have to be dealt with. I let this be a little bit of a homework assignment for the students so they can practice their coding skills and get used to the device. I met with them today, and what they came up with was quite cool!
To find the most "consistent" value, they decided to find the average of several values over a specified amount of time. To do this, they took 20 measurements across 20 seconds, added them all together, and then divided it by 20 to get the "average" value. This was really cool, as I didn't actually give them that idea, and it showed that they picked up a thing or two along the way!
Instead of the spiked values, they were able to get reasonable values and had it remain relatively consistent. The average voltage value from the ORP ended up being in the 200's for basic 5% saltwater. They even added in PPM on the second row on their own but didn't know how to calibrate it yet. Extra credit for being on top of things, though!
Work Session #2
For work session 2, we moved away from the LCD and focused on the LED aspect I previously mentioned as those points are very important to score. A big thing with the LEDs was that they needed to show at specific ranges--something that would be given on the day of, meaning that they'll need to adjust their device accordingly.
We spent the first half of the session discussing the objective and talking about how we'd get the LEDs to show at certain values. A possible idea was to let the Arduino control it given the ORP value, but we ended up going with somebody else's idea: connecting the LEDs directly to the probe via the breadboard and having resistors control the voltage (and thus the brightness). This ended up being a great opportunity to teach the students about resistors (in series and parallel) and for them to also have a "double-check" on the LCD, essentially seeing if the LCD was displaying a value consistent with what the LEDs would show.
The idea is that for the 3 LEDs (red, green, blue), there'd be resistors with increasing values for each so that one LED would show for a low value, two for a medium, and three for a high value, where the relative brightness would also be considered. They'd have to play a lot with combining certain resistors to get certain resistance values, but this wouldn't be as much of an issue as they now understood how to add up the resistor bands to find the value and how to connect them in series!
Here, you can see the first pass at it, using 1k, 10k, and 100k ohm resistors. The 1k was used for red, 10k for blue, and 100k for green. The red and blue LEDs are lit up, but the green LED is dormant, likely because the resistance was way too high. Additionally, the red and blue LEDs were super bright--even for a rather low concentration salt solution, meaning that 10k ohms was likely too low for the "middle" range.
It is worth noting that they will have to modify the code based on the ranges that the test coordinator gives on the day of, but the first step would be calibrating the resistance to the relative PPM or salt concentration. This would also help to give us an idea of the equation to use for the LCD PPM value.
So, the next task I gave them was to play around with resistance values and connect multiple in series to get different values that might better fit our range. I gave them a 0%, 5%, 10%, 25%, and 40% salt solution and had them use different resistors to get a "low" (which would light up at 5-10%), "medium" (at roughly 10-25%), and "high" (at 40%+). This ended up requiring a lot of playing around, but it seems like we found a nice combination at 1k, 15k, and 30k Ohms.
That being said, for the competition itself, they'll end up using the Arduino to light up the specific LEDs for concentration ranges, but for our purposes, this taught them about resistances and proved to us that the values on the LCD were relatively valid, showing that the voltage really does depend through the probe.
Moving Forward
We did experience some issues with the LCD at times, since after a certain run-time it would show "hieroglyphics."
I'll have to look into why it shows that, but I think it might be a memory thing. Outside of that, the LCD seems to be working as intended. The students are working on calculating a PPM value with respect to the voltage received by the Arduino and creating a graph for it, and soon, hopefully the PPM value will be filled in on the LCD as well. The salt solutions that we created will come in handy as this goes through, and individually, they're working on collecting all the data necessary.
We've also got to work on getting better probes to make the data more accurate. Right now, it's just jumper wires, which work relatively okay, but for more precise values later on won't be as helpful. The difference in data isn't as big as we'd want it to be, and although the students are tinkering with it to try to find solutions, I believe professional plated probes may make the difference. I have some copper wire that I'll give them to try out though, so we'll see the difference between the copper vs. the jumper wires.
Overall, the Pearl City HS students have made a ton of progress, and what's even better is that they're starting to understand the device and the science behind it a lot more. I'm happy to say that I'm starting to be a lot more hands-off and a lot more "directional" with them as they've really nailed down the basics. Stay tuned for the next part where we'll (hopefully!) have a PPM value and start to do a lot more intensive calibration.
If you'd like to see the previous articles in the series, click the links below!
Robotics Education: The Basics
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum