DIYables Web Apps Web Temperature
WebTemperature Example - Setup Instructions
Overview
The WebTemperature example creates a visual thermometer interface accessible from any web browser. Designed for Arduino Uno R4 WiFi and DIYables STEM V4 IoT educational platform with enhanced sensor monitoring capabilities, built-in temperature sensing features, and seamless integration with environmental monitoring educational modules. Perfect for monitoring temperature sensors, environmental conditions, or any temperature-based measurements requiring visual feedback.

Features
- Visual Thermometer Display: Interactive thermometer via web interface
- Configurable Temperature Range: Custom minimum and maximum temperatures with units
- Real-time Updates: Live temperature display with mercury-style animation
- Multiple Units Support: Celsius (°C), Fahrenheit (°F), Kelvin (K)
- Automatic Config Handling: Set range and unit once in constructor
- WebSocket Communication: Instant updates without page refresh
- Mobile Responsive: Works perfectly on desktop, tablet, and mobile devices
- Professional Design: Clean thermometer visualization with smooth animations
- Platform Extensible: Currently implemented for Arduino Uno R4 WiFi, but can be extended for other hardware platforms. See DIYables_WebApps_ESP32
Hardware Preparation
Or you can buy the following kits:
1 | × | DIYables STEM V4 IoT Starter Kit (Arduino included) | |
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Buy Note: Many DS18B20 sensors available in the market are unreliable. We strongly recommend buying the sensor from the DIYables brand using the link provided above. We tested it, and it worked reliably.
Setup Instructions
Detailed Instructions
Follow these instructions step by step:
- If this is your first time using the Arduino Uno R4 WiFi/DIYables STEM V4 IoT, refer to the tutorial on setting up the environment for Arduino Uno R4 WiFi/DIYables STEM V4 IoT in the Arduino IDE.
- Connect the Arduino Uno R4/DIYables STEM V4 IoT board to your computer using a USB cable.
- Launch the Arduino IDE on your computer.
- Select the appropriate Arduino Uno R4 board (e.g., Arduino Uno R4 WiFi) and COM port.
- Navigate to the Libraries icon on the left bar of the Arduino IDE.
- Search "DIYables WebApps", then find the DIYables WebApps library by DIYables
- Click Install button to install the library.

- You will be asked for installing some other library dependencies
- Click Install All button to install all library dependencies.

- On Arduino IDE, Go to File Examples DIYables WebApps WebTemperature example, or copy the above code and paste it to the editor of Arduino IDE
- Configure WiFi credentials in the code by updating these lines:
- Click Upload button on Arduino IDE to upload code to Arduino UNO R4/DIYables STEM V4 IoT
- Open the Serial Monitor
- Check out the result on Serial Monitor. It looks like the below
- If you do not see anything, reboot Arduino board.
- Open a web browser on your PC or mobile phone.
- Type the IP address shown in the Serial Monitor to the web browser
- Example: http://192.168.1.100
- You will see the home page like below image:

- Click to the Web Temperature link, you will see the Web Temperature app's UI like the below:

- Or you can also access the page directly by IP address followed by /web-temperature. For example: http://192.168.1.100/web-temperature
- You will see a visual thermometer display showing real-time temperature readings
Web Interface Features
Thermometer Display
- Visual Thermometer: Classic thermometer design with mercury-style animation
- Temperature Scale: Clear scale markings with configurable range
- Real-time Updates: Live temperature display with smooth transitions
- Unit Display: Shows configured temperature units (°C, °F, K)
- Professional Design: Clean, educational-style thermometer visualization
Real-time Monitoring
- Live Data: Temperature updates automatically via WebSocket connection
- Smooth Animation: Mercury level moves smoothly between readings
- Status Feedback: Connection status indicator
- Mobile Optimized: Touch-friendly interface for all devices
Code Configuration
Temperature Setup
Sending Temperature Values
Temperature Sensor Integration
DS18B20 Digital Temperature Sensor
DHT22 Temperature/Humidity Sensor
Analog Temperature Sensor (TMP36)
Unit Conversion
Supporting Multiple Units
Customization Options
Temperature Range
- Minimum Temperature: Set lowest expected reading
- Maximum Temperature: Set highest expected reading
- Units: Display unit string (°C, °F, K, or custom)
- Scale: Thermometer scale automatically adjusts to range
Update Frequency
Common Use Cases
Educational Projects
- Weather Monitoring: Indoor/outdoor temperature tracking
- Physics Experiments: Heat transfer, thermal dynamics
- Environmental Science: Climate monitoring, greenhouse control
- Electronics Learning: Sensor interfacing, data visualization
Practical Applications
- Home Automation: HVAC control, energy monitoring
- Greenhouse Control: Plant growth optimization
- Food Safety: Temperature monitoring for storage
- Industrial: Process monitoring, quality control
Troubleshooting
Temperature Not Updating
- Check WiFi connection and WebSocket status
- Verify sensor wiring and power supply
- Ensure callback function is properly set
- Check Serial Monitor for sensor readings
Incorrect Temperature Values
- Verify sensor calibration and accuracy
- Check voltage reference for analog sensors
- Ensure proper sensor initialization
- Test sensor independently with basic code
Sensor Connection Issues
- Check wiring connections (power, ground, data)
- Verify pull-up resistors for digital sensors
- Test sensor with multimeter for proper operation
- Check sensor library installation and compatibility
Advanced Features
Multiple Temperature Sensors
Monitor multiple locations with separate thermometers:
Temperature Logging
Combine with Web Plotter for historical temperature data:
Alert System
Implement temperature alerts:
Educational Integration
STEM Learning Objectives
- Temperature Physics: Understanding thermal concepts
- Sensor Technology: Learning digital and analog sensors
- Data Visualization: Real-time data display techniques
- Programming: Callback functions, sensor integration
Classroom Activities
- Sensor Comparison: Compare different temperature sensor types
- Calibration Exercise: Learn measurement accuracy principles
- Environmental Monitoring: Track temperature changes over time
- System Integration: Combine with other environmental sensors
Science Experiments
- Heat Transfer: Monitor temperature changes during experiments
- Phase Changes: Observe temperature during melting/boiling
- Insulation Testing: Compare insulation effectiveness
- Climate Study: Long-term temperature monitoring
This example provides a comprehensive foundation for temperature monitoring and visualization, perfect for both educational and practical environmental monitoring applications.