Skip to content

tfbern/m121

Repository files navigation

Arduino IoT Tutorial

This is a tutorial to get started with Arduino Uno. We will measure the temparature and the luminance and display the results on a webpage. However, the implementation will be generic so that any analog and digital input can be read. As well all digital outputs can be changed.

Setup the Environment

  1. Get an Arduino Kit. We are working with learning set #8 from Funduino
  2. Install Visual Studio Code if you haven't already.
  3. Make sure Node.js and NPM are installed on your machine.
  4. Install the Arduino CLI

Run the Project via Internet

In this setup the WebSocket sever will run on websocksrv.herokuapp.com and the webserver on tfbern.github.io.

  1. Attach the temperature sensor TMP36 to analog input A0 (make attention to the polarization)
  2. Attach Arduino Uno to the Computer via USB
  3. Compile the sketch genericReadWrite and upload it to Arduino
    arduino-cli compile arduino/genericReadWrite -u or use Ctrl+Shift+B
  4. In the in the gateway folder.
    • Run npm i to install the dependencies
    • Run nodemon to start the serial-to-websocket gatway
  5. Open the GUI from https://tfbern.github.io.samhess.ch/m121/index.html

Run the Project Locally

In this setup the WebSocket sever will run on localhost:81 and the webserver on localhost.

  1. Attach the temperature sensor TMP36 to analog input A0 (make attention to the polarization)
  2. Attach Arduino Uno to the Computer via USB
  3. Compile the sketch genericReadWrite and upload it to Arduino
    arduino-cli compile arduino/genericReadWrite -u or use Ctrl+Shift+B
  4. In the in the server folder.
    • Run npm i to install the dependencies
    • Run nodemon to start the server
  5. Open the GUI on https://localhost

Links

Hardware Setup

Tools

Sketch Programming

Dependencies / Libraries