Introduction: ReRouter - Make an Extensible IoT Router

Picture of ReRouter - Make an Extensible IoT Router

A few months ago, I shared my project about

Router named Smart router with WiFi Connection Visualization

. which can tell you the number of devices that are connected to your router and monitors the network speed. Luckily I've got more than 96k views and 760 Favorites on that project. I was so delighted as I regards it as a solution that can help out the people who are in the same troubles as I did.

I've thought a lot after that and comes a new idea about this. I think I can go further and make it helpful to some special communities - Like my grandpa, who was once a tough guy and now suffering from AD(Alzheimer’s disease) in his old age. It happens a lot that he always forget what he planed to do in the next morning. Writing things on a note won't be possible as he is too old to hold a pen. But as I figured, maybe he can type, even with just one finger, he can still push the buttons and type words on the computer. So I thought, what if I integrate a printer to my Router, so he or me can write things down at a web page and let the printer print it out. In every morning he just need to look at the note and then knows about the plans he made. Also me or any other family members can leave him a note in this way any time we want. Take me for example, I wish I can write 'I love you, grandpa' every day in the morning so he can see my greetings miles away without getting tired with my voice (just joking).

Since I had this idea I started to work on it.

In addition to the printer, I planned to let the router also connects to Grove Sensors and Grove Relay. So I can control the relay and upload the sensor values to MediaTek Cloud Sandbox.

To be honest, I hope that there will be more people pay attention to this open source project and engage to these kind of things to help special people like my grandpa.

Well, now let’s get on the journey of making.

Step 1: What Do We Need

Picture of What Do We Need

Step 2: Wiring

Picture of Wiring

Now, we should connect the Grove Modules to the Arduino Breakout for LinkIt Smart 7688 Duo just as the picture shows below.

Step 3: Setup the Linkit Smart 7688 Duo

Picture of Setup the Linkit Smart 7688 Duo
The software work of the router consists of 5 parts, compatible with the previous router, control the relay from Mediatek Cloud Sandbox(MCS), upload the Grove Sensors to MCS, a website to write something for printer to print out, the code on ATmega32U4.

I assume you have been familiar with Linkit Smart 7688 Duo, if not, please click here to get started. Then go to the MT7688 terminal by SSH or serial.

Modify the configure file to change MT7688 into router mode.

vi /etc/config/network

Change the configure interface ‘lan’ and ‘wan’ as below shows.

config interface 'lan'

option proto 'static'

option netmask '255.255.255.0'

option ipaddr '192.168.100.1'

config interface 'wan'

option ifname 'eth0'

option proto 'dhcp'

We use the yunbridge for communicating between MT7688 and ATmega32U4, so, enable the yunbridge.

> uci set yunbridge.config.disabled='0'

> uci commit

Requests is the only Non-GMO HTTP library for Python, safe for human consumption. Requests allows you to send organic, grass-fed HTTP/1.1 requests, without the need for manual labor, I use it to communicate with MCS.

I use flask web framework for this Web APP, Flask is a lightweight Python web framework based on Werkzeug, Jinja 2 and good intentions. You can click http://flask.pocoo.org/ to learn more information.

Next, install Python dependencies.

pip install requests flask Flask-WTF wtforms

Step 4: Configure the MediaTek Cloud Sandbox

Picture of Configure the MediaTek Cloud Sandbox

MediaTek Cloud Sandbox (MCS) is a cloud based data service platform for Internet of Things devices. If you don’t have an account please click https://mcs.mediatek.com/oauth/en/signup to sign up.

MCS has already provided some useful tutorials, you can create the prototype and test device in MCS step by step following here.

Then in my project I create a new prototype for Linkit Smart 7688 named LinkitRouter, and add three data channels for this prototype they’re Button Temperature and Humidity just as picture below shows.

Now, you’ll get the Device ID, Device Key and 3 Data Channel ID, you can find the information in the test device detail page, and we will need them later.

Step 5: Upload the Arduino Code

Picture of Upload the Arduino Code

1. Download demo code at https://github.com/Lee-Kevin/20.IoTRouter

2. Click “Download zip” button on right side of webpage to download all codes.

3. Decompress the downloaded zip files to“C:\Users\Administrator\Documents\Arduino\” and remove “-master” in decompressed file name.

4. Launch Arduino IDE.

5. Click Sketch =>Add file to add routerBox_Arduino.ino file from“C:\Users\Administrator\Documents\Arduino\20.IoTRouter\RouterArduinoCode\routerBox_Arduino.ino

6. Click Tools =>Board and select “Linkit Smart 7688 Duo” and chose the right port, as shown in the picture below.

7. Press CTRL +U to upload codes to your board. Wait a while, there will be saying “Done uploading”.

8. Congratulations, you have already completed the whole of the work on Arduino.

Step 6: Download the Code From Github

Picture of Download the Code From Github

Now, we have already install the requirements, download the code from github.

cd ~ & git clone https://github.com/Lee-Kevin/20.IoTRouter

Navigate to 20.IoTRouter and you can find there’re 3 folders, RouterArduinoCode, RouterScript and Drawings. RouterArduinoCode is the code that should be run on Arduino, RouterScript is the Python code should to be run on Linkit Smart 7688. Now we mv the RouterScript to /root/.

cd 20.IoTRouter/ & mv RouterScript/ /root/

Navigate to /root/RouterScript/ and edit the UpdateSensor.py and relay.py using vi editor.

cd ~ & cd /root/RouterScript/

vi UpdateSensor.py

vi relay.py

Change the deviceID, deviceKey and dateChannelID to your device. As shown in the following figure.

Step 7: Setup the The Startup Script

Picture of Setup the The Startup Script

Navigate to /root/RouterScript/

cd ~ & cd /root/RouterScript/

Then setting the startup script.

chmod +x router & mv router /etc/init.d/

/etc/init.d/router enable

/etc/init.d/router start &

And then reboot the router.

reboot

When the router is reboot done, you have done all the software work.

Step 8: Prepare the Things for Hardware Work

Picture of Prepare the Things for Hardware Work
  • 4mm wood
  • M3*10 Screws – 8 PCS
  • M3*8 Scews – 2 PCS
  • M3*5+6 Studs – 2 PCS
  • M3 Screw nuts – 10 PCS
  • R30100 Nylon rivets – 4 PCS
  • R2075 Nylon rivets – 6 PCS

Tools:

  • 502 glue
  • Scotch tape
  • Screw driver
  • Laser Cutter

Step 9: Laser Cut the Wood

Picture of Laser Cut the Wood

In this part, we need to make an box as the picture below shows, this work is by my workmate Nosk, and he is an intelligent industry designer, you can download the drawings by click here.

Then we need to cut the the board using laser cutting. I guess you don’t have a laser cutting at home, you can find some in the hacker space near from you easily. If there's no hacker space nearby, you can try the Laser Cutting Service supply by Seeed.

Here's we use 4mm wood~

Step 10: Hardware Assembly

Picture of Hardware Assembly
  1. Fixed the frame by M3*10 screw and nut. (Image1,2)
  2. Mounting stud on PCB, then fixed it on wood. (Image 3,4)
  3. Fixed sensor and relay on wood by R2075 nylon rivet. (Image 5)
  4. Fixed the printer. (Image 6,7)

Step 11: Shell Assembly

Picture of Shell Assembly
  1. Fixed the RGB LED by scotch tape. (Image 1)
  2. Fixed both side wood. (Image 2, 3)
  3. Lampshade made of paper, fixed it by scotch tape. (Image 4, 5)
  4. Fixed the outside shell by nylon rivet, don’t forgot to install button. (Image 6, 7, 8)

Step 12: The Finished Look

Picture of The Finished Look

Here is the finished look of the router.

Step 13: The Result

Picture of The Result

Now, you can connect to the Linkit Smart 7688 Wifi AP, and input mylinkit.local:8000 or your 7688 local IP :8000 in your web browser, and you can see the Router Printer web page just as below shows. Input something in the textbox and click Print Message and you’ll find the Printer can print it out.

The go to the MCS website, and check your our test device, you can click the button to control the relay and view the sensor values just as picture below shows.

Step 14: Make. Invent. Do.

This project is made as an Open Source Project. It's a starting point. Let your creativity go wild with the mechanical, electrical and software design. Make the demo your own. Decorate it. Improve the work. No matter what, write a recipe about it.

Let's do something special for special people together.

Cheers!

Comments

Kevin - Lee (author)2016-06-20

Wow, it's so cool, I like it very much, you guys from seeed always do something amazing, please keep it up.

diy_bloke (author)2016-06-19

Looks great. I already would be happy with that case just sitting on my desk. It is gorgeous

Seeed Studio (author)diy_bloke2016-06-20

Thanks, remember to click I MADE IT when it's completed.

diy_bloke (author)Seeed Studio2016-06-20

:-) I will, but still alot of other projects waiting

NoskW (author)2016-06-19

Wood cut like this so handsome, but really it is easily broken............

Also here wood lazer cutting design reference to the following project, thanks again ~
https://www.instructables.com/id/Curved-laser-bent-wood/

Seeed Studio (author)NoskW2016-06-20

Thanks for sharing, it's great!!

michaelmacnz (author)2016-06-19

Wow... Is it possible to use the thermal printer that is in thousands of POS Credit Card readers.. The readers are routinely made redundant (security updates) and thrown out.

Thanks, you can try to hack it. As I know, most of them was in UART communication.

Shabraiz10 (author)2016-06-19

I will buy it off you

Seeed Studio (author)Shabraiz102016-06-20

Thanks, am glad that you like.

taifur (author)2016-06-19

Nice and cool.

Seeed Studio (author)taifur2016-06-20

Thanks.

san_t (author)2016-06-18

Well done, commander! :)

Seeed Studio (author)san_t2016-06-20

Thanks, I am glad that you like it :D

About This Instructable

28,361views

260favorites

License:

Bio: Howdy, we are application engineers in Seeedstudio. Sharing projects with maker community is awesome. Hope you like it XD
More by Seeed Studio:Diy Smart Home Assistant With Raspberry Pi and ReSpeaker Mic ArrayBuild Google Assistant on Raspberry Pi With ReSpeaker Mic ArrayDIY a Gesture Keyboard That Can Control the Media Player
Add instructable to: