Open Source Smart Desktop Alert Base

From Microduino Wiki
Jump to: navigation, search

Outline

  • Project: Microduino smart electric scale
  • Object: Smart reminder of drinking water, and interesting desktop scale.
  • Difficulty: Medium
  • Time-consuming: 2 hours
  • Maker:
  • Introduction:

In this tutorial, we will use Microduino module product to build a smart desktop scale quickly. It can weigh out the weight of small objects whose weight are around 2kg, and display the weight on the OLED screen, and also can return the data to the phone. Using the function of water reminder, if long time without drinking water, it will make a prompt.

Bill of Material

  • Microduino Equipment
Module Number Function
Microduino-Core 1 Core board
Microduino-USBTTL 1 Program download
Microduino-BT 1 Bluetooth communication
Microduino-OLED 1 Screen
Microduino-Weight 1 Weighing sensor
Microduino-Duo-h2 1 To reduce height
  • Other Equipment
Module Number Function
Micro-USB cable 1 Program download, and the power supply
Metal screw 4 Module fixation
Nylon base 3 Triangle support
The shell suite 1

Principle of the Experiment

Mircoduino-Weight module and the pressure sensor at the base form a wheatstone bridge, which can measure the weight on the base, then the Core collects the weight data and real-time displays on the OLED screen to make the user be able to observe the change of the data on the scale. Then after the data that the desktop scale measures being stable, the core CPU will take the data of the weight at this time as the final weight that have measured.

Weightyuanli.jpg

The control principle of the whole system is connecting with the above two parts. When Microduino-Core detects that someone is near to it through PIR sensor, it'll control the Lantern module to change color, and the Audio module will broadcast "Welcome to come" to achieve the effect of welcome.

  • Main Sensors

Microduino-Weight Resistance strain sensors is based on this principle: Elastomer(elastic element, and sensitive grider)produces elastic deformation under the action of the external force, and make the resistance strain gauge(transition element)which is stick on its surface deform along with it. After the deformation of the resistance strain gauge, its resistance will change(increase or decrease). And through the corresponding measurement, the circuit converts the resistance into the electrical signal which can be identified by chip. In order to measure the change of the resistance of the weighing sensor's strain gage, the strain gauge is usually adopted to form abridge circuit(wheatstone bridge) to measure. When the measured gravity is on the strain gauge, the wheatstone bridge adhesive on the elastomer will produce unbalanced output, which is proportional to the gravity being measured.

Weightcir.jpg

Document

The code of desktop scale: 【 The code of desktop scale

Commissioning Process

  • Program Download

Overlay Microduino-Core and Microduino-USBTTL(no order up and down), and connect to the computer with USB cable.

Download1.jpg

Open Arduino IDE programming software, and click [File]->[Open].

Dl1.jpg

Browse to the project program address, and click "watercontrol.ino" to open the program.

Weightide1.png

Click [Tool], choose the board card(Microduino-Core) in the board card options, choose processor(Atmega328p@16M,5V)in the processor options, choose the right port number in the port options, then program directly.

Weight2.jpg
  • Set up

Fix the Microduino-Duo-H baseboard on the transparent acrylic board on one side, and connect Microduino-OLED to the OLED interface of Microduino-Duo-H. Note: The wire of OLED should pass through the hole in the middle of the electric bridge. Fix the Duo-H baseboard.

Weightbuild1.png

OLED passes the hole in the middle of the electric bridge.

Weightbuild2.png

Then connect the pressure sensor to Microduino-Weight module.

Weightbuild3.png

Overlay the equipment that will be used on the sides of Microduino-Duo-H, two pieces on one side.

  • Microduino-Core
  • Microduino-USBTTL
  • Microduino-Weight
  • Microduino-BT
Weightbuild4.png

Use two long screws to fix the acrylic transparent plate which has been fixed with baseboard and the weighing electric bridge together, and focus on that there is a small rectangular gasket in the middle.

Weightbuild5.png

Fix the other transparent acrylic board with two long screws and the gasket. Note:Align the gasket screw hole with the screw hole on the bridge, and then fix them.

Weightbuild6.png

At this time supply power to the electronic scale, and wait for 1-2 second, then you can place items to weigh the weigh. Because it is the desktop scale, the weight is limited at about 2kg.

Weightbuild7.png

Single Microduino module

Weightbuild8.png

tips:According to the weight, the little man on the left will be pressed down.

Weightbuild9.png

Program Instruction

  • The Sensor Driving Part
unsigned long HX711_Read(void)	//Gain 128.
{
	unsigned long count; 
	unsigned char i;

	digitalWrite(HX711_DT, HIGH);
	delayMicroseconds(1);

	digitalWrite(HX711_SCK, LOW);
	delayMicroseconds(1);

  	count=0; 
  	while(digitalRead(HX711_DT)); 
  	for(i=0;i<24;i++)
	{ 
	  	digitalWrite(HX711_SCK, HIGH); 
		delayMicroseconds(1);
	  	count=count<<1; 
		digitalWrite(HX711_SCK, LOW); 
		delayMicroseconds(1);
	  	if(digitalRead(HX711_DT))
		  count++; 
	} 
 	digitalWrite(HX711_SCK, HIGH); 
	count ^= 0x800000;
	delayMicroseconds(1);
	digitalWrite(HX711_SCK, LOW); 
	delayMicroseconds(1);
	
	return(count);
}

Weight-gaining function.

float Get_Weight()
{
    Weight_Shiwu = (HX711_Read() - Weight_Maopi)+800;				//To get the AD sampling values of material objects.
    Serial.println(Weight_Shiwu);
    if(Weight_Shiwu < 0)
    {
      return 0;
    }
    else
    {
      return Weight_Shiwu/GapValue;
    } 	
}

video