amc:ss2025:group-b:start
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
amc:ss2025:group-b:start [2025/07/27 13:35] – created 33189_students.hsrw | amc:ss2025:group-b:start [2025/07/29 19:14] (current) – 34284_students.hsrw | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ... | + | ====== Automated Temperature Profiling Using Microcontroller ====== |
+ | ==== Applied Measurement and Control 2025 ==== | ||
+ | == Prof. Dr. Rolf Becker == | ||
+ | |||
+ | === Hannah Pearly Shelly David, 33189; Kirandeep Kaur, 34284; Amir-Hamza Akash, 32425 === | ||
+ | |||
+ | |||
+ | ===== Introduction ===== | ||
+ | (by Hannah Pearly Shelly David) | ||
+ | |||
+ | The European Union’s Water Framework Directive (2024) (European Union, 2024) regularly monitors water bodies, and one among the many water profiling methods include detailed vertical profiles of lakes. Organizations like LINEG typically conduct this by manually lowering a multisensor into the water in 0.5-meter increments. At each depth, the operator has to wait for the sensor to stabilize before logging the readings using a handheld. This repetitive process takes 20 to 30 minutes and ties up personnel who could otherwise taking other necessary samples parallelly. | ||
+ | The current manual system, although effective, lacks efficiency and consistency. This project is about automating the descent of a temperature sensor (demo purpose), controlling the timing of data collection with the help of a microcontroller to manage all system components. The intended result is of a more autonomous process that replicates the same profiling steps with a lot more consistency. | ||
+ | |||
+ | ===== Materials and Methods ===== | ||
+ | (by Amir-Hamza Akash) | ||
+ | |||
+ | The prototype (Figure 1.) was constructed with an Arduino Uno microcontroller, | ||
+ | |||
+ | {{: | ||
+ | |||
+ | //Figure 1. View of the electronics setup showing the Arduino Uno, motor shield, 9V battery and DS18B20 sensor connections// | ||
+ | |||
+ | {{: | ||
+ | |||
+ | //Figure 2. DS18B20 digital temperature sensor wired to digital pin D2, with a 4.7kΩ pull-up resistor between data and VCC// | ||
+ | |||
+ | {{: | ||
+ | |||
+ | //Figure 3. 12V DC worm gear motor for lowering and raising the sensor.// | ||
+ | |||
+ | Power was supplied via a 9V battery instead of a 12V battery due to availability constraints, | ||
+ | |||
+ | This method is grounded in the geometry of the spool and the known motor characteristics. A spool diameter of approximately 4 cm was assumed. From this, the circumference of the spool was calculated using the formula for the circumference of a circle: | ||
+ | |||
+ | **Circumference = π × Diameter = π × 4cm ≈ 12.57cm** | ||
+ | |||
+ | This implies that one complete rotation of the spool releases approximately 12.57 cm of wire. | ||
+ | |||
+ | The DC worm gear motor in the system has a rated speed of 90 RPM at 12V. However, due to the use of a 9V battery instead of the rated 12V power supply, a proportional reduction in speed was assumed. A reduction of approximately 25% was estimated, resulting in an adjusted motor speed of around 67.5 RPM, or: | ||
+ | |||
+ | **67.5 RPM ÷ 60 ≈ 1.125 rotations per second** | ||
+ | |||
+ | To descend 0.5 meters (50 cm) of wire, the number of required spool rotations was calculated as: | ||
+ | |||
+ | **50cm ÷ 12.57 cm per rotation ≈ 3.98 rotations** | ||
+ | |||
+ | The time required to complete this number of rotations at the given speed is: | ||
+ | |||
+ | **3.98 rotations ÷ 1.125 rotations/ | ||
+ | |||
+ | To ensure reliable descent, the descent duration was rounded up to 4 seconds per 0.5 meters. This time-based approach was used to approximate sensor depth at each step, aiding with the automated collection of temperature data at predefined intervals. By assuming a spool diameter of approximately 4 cm and a reduced RPM (75% of original speed at 12V) due to under-voltage conditions, each 0.5-meter descent was timed for 4 seconds due to t. | ||
+ | |||
+ | The code was written in Arduino IDE and configured to move the motor forward in short bursts, pause for 30 seconds at each stop to simulate thermal stabilization, | ||
+ | |||
+ | ====== Results ====== | ||
+ | (by Kirandeep Kaur) | ||
+ | |||
+ | The Arduino code successfully controlled the descent and temperature reading collection. For the sole purpose of a demo, the code was written in such a way it samples a 3 meter deep lake or water body. This would mean a total of 5 depth levels were configured, corresponding to a total descent of 2.5 meters. Readings are not taken at the 3 meter mark as by then the temperature readings would be affected by the temperature of the waterbed. Therefore, at each step, the system printed the estimated depth and corresponding temperature reading onto the serial monitor. The readings were separated by 30-second delays to mimic the real sampling procedure. Once all data points were collected, the motor reversed and reeled in the sensor based on the total descent time. The final message confirmed the completion of the measurement cycle (Figure 5.). | ||
+ | |||
+ | <code C++> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | // Motor Shield Setup | ||
+ | Adafruit_MotorShield AFMS = Adafruit_MotorShield(); | ||
+ | Adafruit_DCMotor *motor = AFMS.getMotor(1); | ||
+ | |||
+ | // DS18B20 Setup | ||
+ | #define ONE_WIRE_BUS 2 | ||
+ | OneWire oneWire(ONE_WIRE_BUS); | ||
+ | DallasTemperature sensors(& | ||
+ | |||
+ | // Parameters | ||
+ | int totalSteps = 5; // 5 steps = 2.5 meters | ||
+ | int delayPerStep_ms = 4000; // 4 seconds per 0.5m descent (estimated at 9V) | ||
+ | int waitAfterStep_ms = 30000; | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(9600); | ||
+ | AFMS.begin(); | ||
+ | sensors.begin(); | ||
+ | |||
+ | Serial.println(" | ||
+ | Serial.println(" | ||
+ | |||
+ | // Descent loop | ||
+ | for (int i = 1; i <= totalSteps; i++) { | ||
+ | Serial.print(" | ||
+ | Serial.print(i * 0.5); | ||
+ | Serial.println(" | ||
+ | |||
+ | // Lower motor | ||
+ | motor-> | ||
+ | motor-> | ||
+ | delay(delayPerStep_ms); | ||
+ | motor-> | ||
+ | |||
+ | // Wait before reading | ||
+ | Serial.println(" | ||
+ | delay(waitAfterStep_ms); | ||
+ | |||
+ | // Read temperature | ||
+ | sensors.requestTemperatures(); | ||
+ | float tempC = sensors.getTempCByIndex(0); | ||
+ | |||
+ | Serial.print(" | ||
+ | Serial.print(i * 0.5); | ||
+ | Serial.print(" | ||
+ | Serial.print(tempC); | ||
+ | Serial.println(" | ||
+ | } | ||
+ | |||
+ | // Rewind sensor to surface | ||
+ | Serial.println(" | ||
+ | |||
+ | motor-> | ||
+ | motor-> | ||
+ | delay(totalSteps * delayPerStep_ms); | ||
+ | motor-> | ||
+ | |||
+ | Serial.println(" | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | {{: | ||
+ | |||
+ | //Figure 5. Real-time output from Arduino serial monitor showing temperature readings at every 0.5m depth.// | ||
+ | |||
+ | The motor behaved as expected in both directions when supplied with 9V, although noticeably under-powered compared to its rated 12V specification. The DS18B20 sensor responded with temperature values at each level. The encoder component of the motor did not produce usable signals during testing and was omitted from the final implementation. An SD card module was not connected during this prototype phase due to time constraints, | ||
+ | |||
+ | <code C++> | ||
+ | #include < | ||
+ | |||
+ | // SD Card Setup | ||
+ | const int chipSelect = 10; // CS pin for SD card | ||
+ | |||
+ | void setup() { | ||
+ | // Initialize SD Card | ||
+ | Serial.print(" | ||
+ | if (!SD.begin(chipSelect)) { | ||
+ | Serial.println(" | ||
+ | while (1); // Halt program | ||
+ | } | ||
+ | Serial.println(" | ||
+ | |||
+ | // Open file and write header | ||
+ | dataFile = SD.open(" | ||
+ | if (dataFile) { | ||
+ | dataFile.println(" | ||
+ | dataFile.close(); | ||
+ | } else { | ||
+ | Serial.println(" | ||
+ | } | ||
+ | |||
+ | // Log to SD | ||
+ | dataFile = SD.open(" | ||
+ | if (dataFile) { | ||
+ | dataFile.print(depth, | ||
+ | dataFile.print(", | ||
+ | dataFile.print(timestamp); | ||
+ | dataFile.print(", | ||
+ | dataFile.println(tempC, | ||
+ | dataFile.close(); | ||
+ | } else { | ||
+ | Serial.println(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Discussion ===== | ||
+ | (by Hannah Pearly Shelly David) | ||
+ | |||
+ | The system presented here is an improvement over the manual sampling method in terms of operator efficiency especially. While the current version operates in a lab setting, the core components mimic the actual field conditions. One of the key limitations was the lack of a working encoder, which would have allowed for real-time depth feedback. The workaround was the use of timed descent and an assumed spool diameter which proved effective for this prototype, but use of the encoder in the future would benefit greatly from direct feedback systems. | ||
+ | |||
+ | Another limitation was power delivery. The 9V battery used was insufficient to fully drive the motor at its rated speed and torque, which could be problematic in outdoor or deeper water environments. Additionally, | ||
+ | |||
+ | Despite these limitations, | ||
+ | |||
+ | ====== Conclusion ====== | ||
+ | (by Kirandeep Kaur) | ||
+ | |||
+ | This project has somewhat successfully demonstrated a microcontroller-based prototype for automated water temperature profiling. Using an Arduino Uno, DS18B20 sensor, and a motorized mechanism, the system automates a previously manual process, reducing sampling time and improving consistency. Although limited by certain hardware constraints such as encoder failure and underpowered supply, the prototype fulfills its educational and functional goals. Future versions will aim to integrate data logging, improved power systems, real-time feedback, and a deployable mechanical structure to enable field use. | ||
+ | |||
+ | ===== References ===== | ||
+ | |||
+ | 1. European Union. (2024). Water Framework Directive. https:// | ||
+ | 2. Rufián, R. (n.d.). Guide for DS18B20 Temperature Sensor with Arduino. Random Nerd Tutorials. https:// | ||
+ |
amc/ss2025/group-b/start.1753616129.txt.gz · Last modified: 2025/07/27 13:35 by 33189_students.hsrw