I built this as a final year project — an embedded system that reads temperature from sensors, stores the data, and makes it available over a serial connection. Nothing fancy, but it was a useful exercise in getting hardware and software to talk to each other.
You can download the project report.
What it does
The system reads temperature from external sensors, converts the analog signal to digital, logs the readings with timestamps, and exposes the data over a serial link so a PC can pull it. A 16x2 LCD shows the current state locally.
The whole thing runs on an AT89C52 microcontroller — a classic 8051 chip. It’s not the most powerful microcontroller in the world, but it’s well documented, cheap, and good enough for what I needed.
The parts
- AT89C52 — the microcontroller. 8K bytes of flash, 256 bytes of RAM, 32 I/O lines.
- ADC0808 — 8-bit analog-to-digital converter. The temperature sensors output analog voltages, and this chip turns them into numbers the microcontroller can work with.
- DS1307 — real-time clock. Gives the system a sense of time so every reading gets stamped. Battery backed up, so it keeps ticking even if power drops.
- AT24C08 — 8Kbit serial EEPROM. Stores the logged data. I2C interface, so it shares two pins with the RTC.
- MAX232 — RS-232 transceiver. The 8051 talks UART at TTL levels; this chip converts to actual RS-232 voltages so a PC serial port can read it.
- 16x2 LCD — local display. Shows temperature, time, and status.
Why I2C for the peripherals
Both the RTC and the EEPROM use I2C — a two-wire serial bus. That’s just two pins (SDA and SCL) handling communication with both devices, each identified by a unique address. Saves pins on the microcontroller, and the protocol is straightforward once you get past the initial confusion about start/stop conditions and acknowledge bits.
The DS1307 runs as a slave on the bus. The microcontroller initiates every conversation — sends a start condition, addresses the device, reads or writes registers sequentially, then sends a stop. The RTC handles leap years automatically, which is nice. You set it once and forget it.
The AT24C08 is similarly simple. 1024 bytes of storage, page writes of 8 bytes, and a hardware write-protect pin if you need it. I used it for logging temperature readings with timestamps.
RS-232 communication
The MAX232 sits between the 8051’s serial port and the PC. It generates the ±10V RS-232 levels from a single 5V supply using on-board charge pumps — no need for a dual polarity power supply, which would have been a pain.
The 8051’s UART runs in mode 1 (standard 8-bit UART) with a variable baud rate from one of the timers. The PC side just needs a terminal program or a custom application to read the data.
The software
Wrote it all in C using the Raisonance RIDE compiler (KEIL-compatible). C was the obvious choice — gives you direct hardware access without the tedium of assembly, and the 8051 toolchain is mature.
The main loop reads the ADC, fetches the current time from the RTC, stores the reading in EEPROM, and pushes data out over serial when requested. There are routines for I2C communication, serial I/O, LCD display, and EEPROM management.
The RIDE IDE handles compilation, linking, simulation, and debugging. It generates Intel HEX files that you load into the microcontroller’s flash. Pretty standard embedded workflow.
What I learned
- I2C is deceptively simple until you try to debug a timing issue at 3am.
- The 8051 has enough resources for this kind of project, but you feel the constraints compared to modern microcontrollers. Every byte of RAM counts.
- RS-232 is dead technology by 2013 standards, but it works. USB-to-serial adapters solve the “my laptop has no COM port” problem.
- Writing embedded C is a different beast from application programming. You’re managing hardware registers, dealing with interrupts, and thinking about timing in a way that web development never prepares you for.
Limitations
- Single-channel temperature input (one sensor at a time via the ADC multiplexer).
- No wireless capability — it’s serial only.
- The LCD is basic. No graphs, no menus, just numbers.
- EEPROM write endurance is a concern if you log too frequently.
Future work
A proper version would add multiple sensor inputs, maybe a web interface instead of serial, and some kind of alerting if temperatures go out of range. But for a first pass, it does what it’s supposed to do.