• EUR€
  • £GBP
  • $USD

Make an IoT Anti-addiction Box with OBLOQ

DFRobot Sep 10 2019 823

To begin with,

Last days, I have finally picked up Random as my English name, to satisfy the requirement from works and improve the style of myself. Random, which means threw one coin upward and guess is the upward or the backward when falls into my hand. 

I am always curious about the rulers of this world even though I am not a student any more. I like to reading science books and think. The friends of mine call me as Folk Scientist. Why I picked up Random as my name? In my shallow opinion, random maybe the single deepest secret in the world. I used to be a supporter of the Extreme Determinism, this theory which means—why I write these words at here? For example, in Sahara Desert, A sneezed. While, this sneeze caused B fell when passing the crossroad in Australia. At this time, the fall leads to a fixed star turns into a red giant in Andromeda Nebula, and so on. We called it as the butterfly-effect, which can be judged and predicted without ending. 

I remember the first day I got to know the Physics. I confirmed that all the things in this world have their own rules from that day. In historical, the Extreme Determinism reaches the peak point when the classic physical edifice existed, at that time, people think they can know the past and even the future such as predict the weather once they master enough data. But afterwards, people overthrow this theory with new physical knowledge. While, I still believe the Determinism theory, and firmly believe Random in new physical zone just a recognition blind zone of human beings. So, I insist that there is no real random in our world. The real random, maybe the most fantastic phenomenon. If it exists, the world will not be tedious. Therefore, we cannot count our futures and the world destiny just by rules, which always be called as Destiny.  

One day riding home, I was lost in thought again, an idea jumped out: if the world finally confirmed as everything has its own rule, does it mean no random? NO, it seems like it can also create random, amazing! It happens that the rule of everything has its own rule can create random. 

In a completely commanded closed system, every tiny action of everything will lead to a big influence to the environment. Just like you can never figure out the current state of the microparticle in front of you, because once you consider, it will be influenced. Here we cannot help thinking the uncertainty principle found by Heisenberg. Well, maybe this phenomenon is a fake random. I do not whether it is the coincidence, in the leading physics, people found random atmosphere in the micro level, while in the macro level, we get rules like the Newton’s laws of motion. From here I guess we get las in a general macro, but get random in specific micro. I am limited in knowledge, this thought, I do not know how to conclusion. Is that with the micro science exploration, will human beings will become more and more innocent? Or you want to take a small balloon, but when you stretching the hand, the air flow caused will push it to the farmer space? I also guessed that whether our research area has already touched the edge of the closed system? Just like a physicist, he just thinks the test for a while, but lead to a big change in the test result.

I used to think a situation to configure the past and the future of a system. Imaging there is a fishbowl in front of you, and it has fishes, water, water plants and little stones. This is a small ecosystem. The outside world is independent from the fishbowl, or we should describe it as beyond it. Because it is closed and completely regularly. So, even though you can see all data in the fishbowl world, but your watching will not affect the rule of it. The fish technologist in the fishbowl cannot detect your existence with any physical ways. In reality, the action “to watch the fishbowl world” has already take lights, it definitely will influence this small ecosystem. But we are hackers, do not worry about it. Then, for some time, from the data of your observation, you can figure out the past and the future of every stone and cell.

Alright, back to the topic, during the summer vacation, children can finally leave the school and back home to play parents! But majority of parents are still busy in working, in this long vacation, some kinds will play smartphones and computer a whole day at home. To rescue these wild kids, I will share you the way to make an IOT Anti-addiction Box with OBLOQ. 



The tutorial as below offers more details than the video.

Well, a friend of mine complained that all my works require high standard hand working skill. So, as a poor hand worker, he had to be moaned his inadequacy. Considering this request, this time I have decreased the hand working requirement to the lowest. All we need is just to pull the hot melt adhesive and twist about 20 screws.

Come to check this work!


Design Idea

In this project, I choose the electric solenoid lock as the box switch. If there is no press in keys for 3 minutes, the box will enter the sleep mode. Press the key 1 will wake up the box and send IOT order to open the box via the module OBLOQ. Once the IOT platform receives, it will decide to send or not send the order to open the box. When the box is awake, it will send the status data(Open/ Closed), the object thickness (with a ultrasonic distance detector) and the object weight (with a digital weight sensor). These key parameters can prevent some smart children cheating works. The reason why we set password is that it can be directly opened when adults at home. The 3 colors RGB LED (Blue, Green, Red) module is in the front of the box. When Blue is ON, suggesting the device is awake; When Green is ON, which suggests the box will be unlocked immediately; When Red is ON, which means the password is wrong. Well, the LED is OFF, means the box enters the sleep mode.


Materials in Need

DFR0216 DFRduino UNO R3 - Arduino Compatible x1

DFR0265 Gravity IO Expansion Shield for Arduino V7.1 x1

TEL0118 Gravity: UART OBLOQ – IoT Module (Microsoft Azure) x1

DFR0017 Gravity: Digital 5A Relay Module x1

FIT0129 Sealed Membrane 4*4 button pad with sticker x1

SEN0307 Gravity: URM09 Analog Ultrasonic Sensor x1

SEN0160 Gravity: Digital Weight Sensor x1

FIT0620 Electric Solenoid Lock x1

DFR0605 Gravity: Digital RGB LED Module x1

FIT0365 Jumper Wires 7.8" F/M (High Quality 30 Pack) x1

DC 5.5*2.1mm 1 F 2 M Power Supply Wire

9~12 V Power Supply

M3 x20  

Nuts x2

Hinge (2.62inch) x1(the image shows the other spare one)


All Materials in Need

Below are 2 Gravity ultrasonic modules developed by DFRobot, the left is the analog one, the right is the IIC module. Th IIC Gravity ultrasonic module not just can detect distance but also temperature. 


The relay and the electric solenoid lock should be used together. Because the lock is powered by the external supply 9-12V to Open / Cloze and Uno controls the relay to control the circuit of lock.

NOTE: The electric solenoid lock cannot be powered for long time. You’d better cut power when the action is finished. Otherwise, the longtime power ON will lead to heating and damage.


There is a metal poke rod on the upper right corner. Poke it manually, the lock will be unlocked and its lock latch will spring out. The are 3 mounting holes in the main body, you can fix it to other objects. The holes are compatible with M3 screws. The lock accessories have 1 DC power wire and 1 DuPont transfer wire. Connect the transfer wire to I0 of UNO, then you can pass the states data to UNO. 


This is a 4x4 membrane keyboard. There is adhesive in the back, which can be pasted to anywhere. The maximum thickness is 1.23mm, and it has 8 pins which all are marked with numbers, the leftmost is 8 and the rightmost is 1. Pins 8-5 control rows, 1,2,3,4 in order; while pins 4-1 control columns, 1,2,3,4 in order. Select the resister in the multimeter, connect 2 ends to pin8 and pin4, press the key2, the resistor value will reduce to 3K Ohm around; connect 2 ends to pin8 and pin3 and press the key2, the result is similar. When Uno scanning the pin level, it suggests the key in correspond is pressed. The hardware eliminate jitter is designed in the inner part, so you can read the pin level directly. 


The digital weight sensor contains 1 PCB and 1 aluminum block. In the block, there are 2 M5 screw holes in the left to fix position and 2 M4 screw holes in the right to fix the pallet. In the middle position is a sensor, once the block bears load, the sensor can figure out the weight by the tension. It can handle weight within 1kg, the precision is 0.1g. 


This digital RGB LED module is compatible with WS2812 control. The right side is the input, the left is the output. With pins and Dupont header connect, it can be easily connected one by one to realize decoration lights effect.


1. Design the box outlook 


2. FDM 3D Printing


3.Install the keyboard:

Tear down the adhesive paper in the back and paste the keyboard to the font of the box


4.Install RGB LED module:

In the inner of the box, the front side has a position to install LED module (Left), you just need to fix LED at here with a self-tapping screw.


The button, please place as below and use M5x10 self-tapping screws to fix modules into the board one by one, OBLOQ module, gravity weight sensor, relay and UNO, expansion shield.


There are 2 M5 screw holes in the left of the aluminum block, using M5x20 screws (with nut) to fix it into the button board.


Place nuts to the 2 hexagonal holes in the button and seis up.


Taking the screw to go through the aluminum block in the inner part and twist it tightly into the nut to fix the aluminum block.


Then install the electric solenoid lock, put 2 M3x18 screws and nuts to the hexagonal holes in the button and seis up.


Pull the lock down in the inner and fasten it to the position to install and fix with 2 M3x18 screws. 


5.Install the DC power supply wire:

This wire header is installed to the round hole in the back. The type I chose has a circle step, so it can be directly fixed by pressing it form the inner to the outside. Well, it will be fastened better if added with some hotmelt adhesive. The header is to connect the external supply. 2 males are to supply power to the lock and UNO, 1 is to the power supply wire of the lock, the other is to DC supply interface of UNO. 


Taking 8 Dupont wires, the male header to 8 wires of the keyboard and stretch to IO interfaces of UNO.


6.Install the box hinge


7.Install the ultrasonic module and locking tap with self-tapping screws.

Check the diagram as below and connect all parts accordingly 


Put all wires to 2 slots, if wires are too many to put, you can try putting the thick ones, and pressing others with them.


Modify the WIFI name (WIFISSID), Wi-Fi password(WIFIPWD), IOT platform(SERVER), IOT ID(IOTID), IOT password(IOTPWD), device number(TOPIC) and the password to open the box (number within” ” in the adminPassword ) according to your own, I set the password to 0123456789A and confirm it via pressing the key #, and uploading the code:


Taking 2 M4x35 screws to go through the pallet and fix them to 2 M4 screw holes in the aluminum block to handle the pallet.


The work is done, plugin the external power supply and the box begins to work.


Function Shows

Smartphone Remote Control Box Open

The phone receives the request from the box, the input 0123456789A in the IOT platform and click send, box is open. Now, kids can play iPad and phone.


Computer Remote Control Box Open

The principle is same as the smartphone:


IOT platform real time monitor data 


Active by password

Sleep mode 


Working when awake


Input wrong password


Input right password and open the box


That’s all, thanks for your reading and welcome share this post.