Skip to content

Latest commit

 

History

History
279 lines (191 loc) · 5.83 KB

File metadata and controls

279 lines (191 loc) · 5.83 KB

UNIWA

UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS

University of West Attica · Department of Computer Engineering and Informatics


Internet of Things

Traffic Light Sequence with Arduino UNO, ESP-01 and ThingSpeak

Vasileios Evangelos Athanasiou
Student ID: 19390005

GitHub · LinkedIn

Angelos Vasileios Mantzoukas
Student ID: 19390128

GitHub · LinkedIn

Christos Pylarinos
Student ID: 20390278

GitHub


Supervision

Supervisor: Panagiotis Karkazis, Associate Professor

UNIWA Profile · LinkedIn

Co-supervisor: Rania Garofalaki, Laboratory Teaching Staff

UNIWA Profile · LinkedIn


Athens, January 2025



INSTALL

Traffic Light Sequence with Arduino UNO, ESP-01 and ThingSpeak

This guide explains how to install, configure, and run the IoT Traffic Lights project using Arduino UNO, ESP-01 (ESP8266), and ThingSpeak.


1. Prerequisites

1.1 Hardware Requirements

  • Arduino UNO
  • ESP-01 (ESP8266) WiFi module
  • Breadboard
  • Jumper wires (Male–Male, Male–Female)
  • Resistors for voltage divider (e.g., 1.8kΩ and 3.3kΩ)
  • USB cable (Arduino ↔ PC)

Warning:
ESP-01 uses 3.3V logic. A voltage divider is required between Arduino TX (5V) and ESP-01 RX.


2. Software Requirements

  • Operating System: Windows / Linux / macOS
  • Arduino IDE (v1.8.x or newer)
  • USB drivers (CH340 or ATmega16U2, depending on board)
  • Internet connection

3. Online Services


4. Software Installation

4.1 Install Arduino IDE

  1. Download from: https://www.arduino.cc/en/software
  2. Install with default options.
  3. Launch Arduino IDE.

5. Verify Arduino Connection

  1. Connect Arduino UNO via USB.
  2. In Arduino IDE:
    • Tools → Board → Arduino UNO
    • Tools → Port → Select correct port
  3. Upload the Blink example to verify functionality.

6. Hardware Setup

6.1 ESP-01 Wiring

Arduino UNO ESP-01 Description
3.3V VCC Power
GND GND Common ground
TX (Pin 1) RX Via voltage divider
RX (Pin 0) TX Direct
3.3V CH_PD Enable

6.2 Voltage Divider

  • Arduino TX → 1.8kΩ → ESP-01 RX
  • ESP-01 RX → 3.3kΩ → GND

7. ThingSpeak Configuration

7.1 Create Channel

  1. Log in to ThingSpeak.
  2. Create a new channel.
  3. Enable fields:
    • Field 1: Red
    • Field 2: Orange
    • Field 3: Green
    • Field 8: Remote Control

8. Obtain API Keys

  • Navigate to Channel Settings → API Keys
  • Copy:
    • Write API Key
    • Read API Key

9. Repository Setup

git clone https://github.com/Internet-of-Things-aka-Uniwa/Traffic-Lights.git
cd Traffic-Lights

10. Arduino Code Configuration

10.1 Open a Scenario

Open one of the following in Arduino IDE:

  • src/A4/A4.ino
  • src/B/B.ino
  • src/C1/C1.ino
  • src/C2/C2.ino

10.2 Configure WiFi

AT+CWJAP="YOUR_SSID","YOUR_PASSWORD"

10.3 Configure ThingSpeak Keys

String writeAPIKey = "YOUR_WRITE_API_KEY";
String readAPIKey  = "YOUR_READ_API_KEY";

11. Upload & Execution

11.1 Upload Code

  1. Temporarily disconnect ESP-01 TX/RX.
  2. Click Upload in Arduino IDE.
  3. Reconnect ESP-01 after upload completes.

12. Monitor Serial Output

  1. Open Tools → Serial Monitor
  2. Set correct baud rate (as defined in code).
  3. Verify:
    • WiFi connection
    • Data transmission to ThingSpeak
    • JSON responses

13. System Operation

13.1 Normal Mode

  • ThingSpeak Field 8 = 0
  • Sequence: Red → Green → Orange

13.2 Standby Mode

  • ThingSpeak Field 8 = 1
  • Orange light only

14. Troubleshooting

  • ESP-01 not responding: Check 3.3V supply and voltage divider
  • No ThingSpeak data: Verify API keys and WiFi credentials
  • Upload errors: Disconnect ESP-01 TX/RX during upload

15. Open the Documentation

  1. Navigate to the docs/ directory
  2. Open the report corresponding to your preferred language:
    • English: Electrical-Signal-Light.pdf
    • Greek: Ηλεκτρικός-Φωτεινός-Σηματοδότης.pdf