ediy / Ubidots-Lua-OpenWRT-router-Ubidots-Real-time-data-monitoring

A tool to monitor data in real time
3 stars 7 forks source link

Why use a router? #4

Open electronicsguy opened 8 years ago

electronicsguy commented 8 years ago

What is the data you're collecting? I'm curious why you want to use the router to publish it to ubidots, rather than say an arduino or esp8266?

smching commented 8 years ago

The router is installing in a skylift. An USB 3G modem is plugged into the router that allows the router access to the internet anywhere. Without connecting to an AP, the ESP8266 is not able to access to internet.

electronicsguy commented 8 years ago

@smching Yes I know how the esp8266 works. But in order to actually collect data, you'll have to interface the sensors with something like an arduino, esp8266 or raspberry pi correct? How are you connecting sensors directly to the router for collecting data?

smching commented 8 years ago

This is a long long story......

I can interface the sensor without an microcontroller, I would not use this since the router needs about 30 seconds to boot up before I can read/write the sensors. Browse this link below to get some ideas. http://ediy.com.my/tutorials/item/131-openwrt-control-led-manually http://ediy.com.my/projects/item/130-wi-fi-controlled-remote-control-car-without-microcontroller http://ediy.com.my/blog/item/123-lua-gpio-gpio-read-write-functions-for-lua

There are a few ways to interface with Arduino:

  1. Via USB
  2. Via Serial
  3. Via I2C & etc

My router only have a USB port, it is not possible to connect two USB devices (3G modem & Arduino UNO) at the same time.

Most of the wifi router embedded with serial-port which is easily accessible via though holes or headers. I'm using this for my project.

The router uses 3.3V for its IO, therefore I need an Arduino which is running at 8MHz clock (16MHZ will not run at 3.3V), you can buy a 8MHZ Mini Pro or built one for yourself. http://ediy.com.my/tutorials/item/94-arduino-running-at-8mhz-internal-clock-with-optiboot-bootloader http://ediy.com.my/projects/item/86-minimal-arduino-with-8mhz-internal-clock

The project

  1. A USB 3G modem is connected to the router via USB port
  2. An Arduino is connected to the router via Serial port
  3. An optocoupler soldered on the Arduino is used to detect a High or Low signal in order to calculating the amount of Time Elapsed
  4. The amount of Time Elapsed is stored in the Arduino EEPROM on every 30 minutes or during power shut-down.
  5. The amount of Time Elapsed is read during Arduino power ON.
  6. The amount of Time Elapsed is send to the router when router is boot-up ready
  7. Data is send to ubidots.com on every router reboot or every 30 minutes
electronicsguy commented 8 years ago

Ok now I get it. Thanks for the info. :+1: