KS0345 Electronic Scale Kit for Arduino

1.Description:

When it comes to programming, many think it difficult. However, KEYES group rolls out an electronic scale kit to cope with this problem.

This is a low-cost, easy-to-build and open source programming kit.

In fact, it integrates a large number sensors and modules. You can absorb the basic knowledge of programming like electronics, control logic, computer and science from practical installation.

In compliance with the tutorial, an electronic scale can be produced by boards, slot connection and wiring.

It also has a membrane keypad, a weighing sensor, a DS3231 module and an LCD 1602 display module Furthermore, the detailed projects will guide you to learn the working principle of sensors and modules.

If interested in STEM and code programming, you can customize your own scale by altering code and adding extra modules. That sounds entertaining, right? Let’s get started!

2.Features:

1.Multi-purpose function:key input and control,1602 display,weighing,counting calculating price,alarm clock,temperature and time display

2.Easy to build:Slot connection and without soldering circuit

3.Novel style:Adopt strong wood board, acrylic board, RGB and LCD 1602 modules.

4.High extension:preserve IIC, UART, SPI ports,and extend other sensors and modules.

5.Basic programming learning:use C language and code.

3.Parameters:

Input Voltage:7-12V

Working Voltage:5V

Working Current:100mA

Maximum consumption power:1.5W

4.Kit list:

##

Picture

Model

QTY

1

Keyestudio Main Board

1

2

4pcs Wooden Boards

1

3

2pcs Acrylic Boards

1

4

Keyestudio HX711 Weighing Module

1

5

Micro Weighing Sensor

1

6

矩阵按键

4*4 Membrane Keypad

1

7

液晶屏

Keyestudio I2C1602 LCD Module

1

8

时钟2

Keyestudio DS3231 Clock Module

1

9

功放模块

keyestudio Power Amplifier Module

1

10

Keyestudio Yellow LED Module

2

11

1(1)(1)

6-slot AA Battery Holder

1

12

3-pin Rocket Switch

1

13

50g Balance Wight

1

14

Dual-pass M3*8MM Copper Pillar

8

15

Dual-pass M3*40MM Copper Pillar

4

16

M3*6MM Round Head Screws

8

17

M3*8MM Round Head Screws

13

18

M3*10MM Round Head Screws

3

19

M3*6MM Flat Head Screws

11

20

M4*12MM Flat Head Screws

5

21

M3 Nickel Plated Nuts

11

22

3.0*40MM Screwdriver

1

23

AM/BM OD:5.0 L=50cm USB Cable

1

24

8MM Winding Pipe

1

25

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\3pin 黑红黄 200mm(1).png3pin 黑红黄 200mm(1)

3P F-F Dupont Line

3

26

C:\Users\Admin\Desktop\1.png1

4P-1P F-F Black/Red/Blue/Green Dupont Line

1

27

C:\Users\Admin\Desktop\2.png2

4P-1P F-F Black/Green/Blue /Red Dupont Line

1

28

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\4pin 黑红蓝绿 200mm(1).png4pin 黑红蓝绿 200mm(1)

4P Dupont Line

1

29

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\8pin 红黄绿棕蓝紫白黑 150mm(1).png8pin 红黄绿棕蓝紫白黑 150mm(1)

8P M-F Dupont Line

1

30

50*82*0.2MM Plastic Bag

6

31

63*106*0.2MM Plastic Bag

1

32

4CC 4*6CM Plastic Bag

8

33

4CC 10*15CM Plastic Bag

1

5.Getting Started with Arduino

Keyestudio Development Board

Ks0172A-图片1

This board has an ATMEGA16U2 chip which can be UART-to-USB conversion plug.

It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, 1 ICSP headers, and a reset button.

It controls the microcontroller. You can use it by connecting it to computer.

Microcontroller

ATMEGA328P-AU

Operating Voltage

5V

Input Voltage (recommended)

DC7-12V

Digital I/O Pins

14个 (D0-D13)

PWM Digital I/O Pins

6个 (D3,D5,D6,D9,D10,D11)

Analog Input Pins

6 (A0-A5)

Flash Memory

32 KB (ATMEGA328P-PU) of which 0.5 KB used by bootloader

SRAM

2 KB (ATMEGA328P-PU)

EEPROM

1 KB (ATMEGA328P-PU)

Clock Speed

16 MHz

Element and Interfaces:

图片1(8)-2

ICSP (In-Circuit Serial Programming) Header ICSP is the AVR, an Arduino micro-program header consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often called the SPI (serial peripheral interface) and can be considered an “extension” of the output. In fact, slave the output devices under the SPI bus host. When connecting to PC, program the firmware to ATMEGA328P-AU.

Serial Communication Pin Connect to serial communication. 4Pins (GND, VCC (3.3V or 5V controlled by slide switch), RX, TX)

GND Ground pins

V Pins (VCC) Power the external sensors and modules. Select the voltage of 3.3V or 5V via a slide switch.

Digital I/O It has 14 digital input/output pins, labeled D0 to D13 (of which 6 can be used as PWM outputs). These pins can be configured as digital input pin to read the logic value (0 or 1). Or used as digital output pin to drive different modules like LED, relay, etc. The pin D3, D5, D6, D9, D10, and D11 can be used to generate PWM. For digital port, you can connect through female headers, or through pin headers (labeled S) of 2.54mm pitch.

AREF For Analog reference. Sometimes used to set an external reference voltage (0-5V) as the upper limit of analog input pins.

SDA IIC communication pin

SCL IIC communication pin

ICSP (In-Circuit Serial Programming) Header ICSP is an AVR, an Arduino micro-program header consisting of MOSI, MISO, SCK, RESET, VCC, and GND. Connected to ATMEGA 16U2-MU. When connecting to PC, program the firmware to ATMEGA 16U2-MU.

Microcontroller Each control board has its own microcontroller. You can regard it as the brain of your board. Microcontrollers are usually from ATMEL. Before you load a new program on the Arduino IDE, you must know what IC is on your board. This information can be checked at the top of IC. The microcontroller used in this board is ATMEGA328P-AU.

D13 LED There is a built-in LED driven by digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off.

TX LED Onboard you can find the label: TX (transmit) When the board communicates via serial port, send the message, TX led flashes.

RX LED Onboard you can find the label: RX(receive ) When the board communicates via serial port, receive the message, RX led flashes.

Power LED LED on means that your circuit board is correctly powered on. Otherwise LED is off.

USB Connection You can power the board via USB connection. Or can upload the program to the board via USB port. Connect the board to PC using a USB cable via USB port.

ATMEGA 16U2-MU USB to serial chip, can convert the USB signal into serial port signal.

Slide Switch You can slide the switch to control the voltage of pin V (VCC), 3.3V or 5V.

Voltage Regulator To control the voltage provided to the board, as well as to stabilize the DC voltage used by the processor and other components. Convert an external input DC7-12V voltage into DC 5V, then switch DC 5V to the processor and other components, output DC 5V, drive current is 2A.

DC Power Jack The board can be supplied with an external power DC7-12V from the DC power jack.

IOREF Used to configure the operating voltage of microcontrollers. Use it less.

RESET Header Connect an external button to reset the board. The function is the same as reset button.

Pin 3V3 Output Provides 3.3V voltage output

Pin 5V Output Provides 5V voltage output

Vin You can supply an external voltage input DC7-12V through this pin to the board.

Analog Pins The board has 6 analog inputs, labeled A0 through A5. Can also used as digital pins, A0=D14, A1=D15, A2=D16, A3=D17, A4=D18, A5=D19. For analog port, you can connect through female headers, or through pin headers (labeled S) of 2.54mm pitch.

IIC Communication Pin Connect to the IIC communication. 4Pins (GND, VCC (3.3V or 5V controlled by slide switch), SDA, SCL)

RESET Button You can reset your board to start the program from the initial status.

Getting Started with Arduino

1.Installing Arduino IDE

When we get control board, we need to download Arduino IDE and driver firstly.

You could download Arduino IDE from the official website: https://www.arduino.cc/, click the SOFTWARE on the browse bar, click“DOWNLOADS” to enter download page, as shown below:

You can download either Windows win7 and newer or Windows ZIP file.

The first one doesn’t require.

There are two versions of IDE for WINDOWS system, you can choose from the Installer (.exe) and the Zip packages. We suggest you use the first one that installs directly everything you need to use the Arduino Software (IDE), including the drivers.

With the Zip package you need to install the drivers manually. The Zip file is also useful if you want to create a portable installation.

You just need to click JUST DOWNLOAD.

2.Installing Driver

Windows 10:

The driver will be automatically installed if you plug control board to your computer. Then the COM port is show below:

Img

You need to install it manually if your computer is other Windows system. We will take win7 system as example.

Right-click and click Open file location to find out the drivers folder.

Copy driver folder to D drive.

Right click Computer—– Properties—– Device Manager. You will view Unknown Device

Click Unknown devices to select Update Device Management

Click“Browse…..manually”

Find the“drivers”file,and tap“Next”.

A}ZM5FU2XKL(5GSSBWT0KGX

Click“install this driver software anyway”

Then click“Close”and check the serial port.

Return to Device Manager page if the driver is installed. Then check correct port

(3) Arduino IDE Setting

Clickicon,and open Arduino IDE.

To avoid the errors when uploading the program to the board, you need to select the correct Arduino board that matches the board connected to your computer.

Then come back to the Arduino software, you should click Tools→Board, select the board. (as shown below)

Then select the correct COM port (you can see the corresponding COM port after the driver is successfully installed).

Before uploading the program to the board, let’s demonstrate the function of each symbol in the Arduino IDE toolbar.

A- Used to verify whether there is any compiling mistakes or not.

B- Used to upload the sketch to your Arduino board.

C- Used to create shortcut window of a new sketch.

D- Used to directly open an example sketch.

E- Used to save the sketch.

F- Used to send the serial data received from board to the serial monitor.

(4) Start your first program

We’ve known how to download and install the driver of development board , next, we will burn a code to show“Hello World!”in the monitor.

void setup() {

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

}

void loop() {

// print out "Hello world!"

Serial.println("Hello world!");

delay(1000);// delay 1 second

}

Then let’s make monitor show Hello World!

Open Arduino IDE, and select Arduino UNO

Set COM port, as shown below:

Clickto start compiling the program, and check errors.

Clickto upload the program, upload successfully.

Upload the program successfully, open serial monitor and set baud rate to 9600. Monitor will print“Hello World!”each 1s.

Congratulation, you finish the first program.

6.Projects

The whole project begins with basic program. Starting from simple to complex, the lessons will guide you to assemble smart motorhome and absorb the knowledge of electronic and machinery step by step.

Note: (G), marked on each sensor and module, is negative pole and connected to“G”,“-”or“GND”on the sensor shield or control board ; (V) is positive pole and interfaced with“V”,“VCC”,“+”or“5V”on the sensor shield or control board.

Project 2: Adjust LED Brightness

1.Description:

In previous lesson, we control LED on and off and make it blink.

In this project, we will control LED brightness through PWM to simulate breathing effect. Similarly, you can change the step length and delay time in the code so as to demonstrate different breathing effect.

PWM is a means of controlling the analog output via digital means. Digital control is used to generate square waves with different duty cycles (a signal that constantly switches between high and low levels) to control the analog output. In general, the input voltage of port are 0V and 5V. What if the 3V is required? Or what if switch among 1V, 3V and 3.5V? We can’t change resistor constantly. For this situation, we need to control by PWM.

0_LPC1768_PWM

For the Arduino digital port voltage output, there are only LOW and HIGH, which correspond to the voltage output of 0V and 5V. You can define LOW as 0 and HIGH as 1, and let the Arduino output five hundred 0 or 1 signals within 1 second.

If output five hundred 1, that is 5V; if all of which is 1, that is 0V. If output 010101010101 in this way then the output port is 2.5V, which is like showing movie. The movie we watch are not completely continuous. It actually outputs 25 pictures per second. In this case, the human can’t tell it, neither does PWM. If want different voltage, need to control the ratio of 0 and 1. The more 0,1 signals output per unit time, the more accurately control.

2.Required Components:

Keyestudio Main Board*1

Keyestudio Yellow LED Module*1

20cm 3pin F-F 26AWG Dupont Line*1

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\3pin 黑红黄 150mm(1).png3pin 黑红黄 150mm(1)

USB Cable*1

Img

3.Wiring Diagram:

The wiring diagram is as same as the project 1

LED

4.Test Code:

5.Test Result:

Upload test code successfully, LED gradually becomes brighter then darker, like human breath.

6.Code Explanation:

When we need to repeat some statements, we could use FOR statement.

FOR statement format is shown below:

图1(1)

FOR cyclic sequence:

Round 1:1 → 2 → 3 → 4

Round 2:2 → 3 → 4

Until number 2 is not established, “for”loop is over. After knowing this order, go back to code:

for (int value = 0; value < 255; value=value+1){

…}

for (int value = 255; value >0; value=value-1){

…}

The two“for”statements make value increase from 0 to 255, then reduce from 255 to 0, then increase to 255,….infinitely loop.

There is a new function in the following —– analogWrite()

We know that digital port only has two state of 0 and 1. So how to send an analog value to a digital value? Here,this function is needed. Let’s observe the Arduino board and find 6 pins marked“~”which can output PWM signals.

Function format as follows:

analogWrite(pin,value)

analogWrite() is used to write an analog value from 0~255 for PWM port, so the value is in the range of 0~255. Attention that you only write the digital pins with PWM function, such as pin 3, 5, 6, 9, 10, 11.

PWM is a technology to obtain analog quantity through digital method. Digital control forms a square wave, and the square wave signal only has two states of turning on and off (that is, high or low levels). By controlling the ratio of the duration of turning on and off, a voltage varying from 0 to 5V can be simulated. The time turning on(academically referred to as high level) is called pulse width, so PWM is also called pulse width modulation.

Through the following five square waves, let’s acknowledge more about PWM.

C:\Users\zuokejian\AppData\Local\Temp\ksohtml13604\wps19.png

In the above figure, the green line represents a period, and value of analogWrite() corresponds to a percentage which is called Duty Cycle as well.

Duty cycle implies that high-level duration is divided by low-level duration in a cycle. From top to bottom, the duty cycle of first square wave is 0% and its corresponding value is 0. The LED brightness is lowest, that is, turn off. The more time high level lasts, the brighter the LED. Therefore, the last duty cycle is 100%, which correspond to 255, LED is brightest. 25% means darker.

PWM mostly is used for adjusting the LED brightness or rotation speed of motor.

It plays vital role in controlling smart robot car. I believe that you can’t wait to enter next project.

7.Extension Practice:

Let’s observe the status of LED if we change the delay value

Upload code to development board, the LED’s blink frequency is slower, isn’t it?

Project 3: 1602 LCD Display Module

1.Description:

KS0061 (2)

With I2C communication module, this is a display module that can show 2 lines with 16 characters per line.

It shows blue background and white word and connects to I2C interface of MCU, which highly save the MCU resources.

On the back of LCD display, there is a blue potentiometer for adjusting the backlight. The communication address defaults to 0x27.

The original 1602 LCD can start and run with 7 IO ports, but ours is built with ARDUINOIIC/I2C interface, saving 5 IO ports. Alternatively, the module comes with 4 positioning holes with a diameter of 3mm, which is convenient for you to fix on other devices.

2.Specification:

  • I2C address: 0x27

  • Backlight (blue, white)

  • Power supply voltage: 5V

  • Adjustable contrast

  • GND: A pin that connects to ground

  • VCC: A pin that connects to a +5V power supply

  • SDA: A pin that connects to analog port 20 for IIC communication

  • SCL: A pin that connects to analog port 21 for IIC communication

3.Component:

Keyestudio Main Board*1

Keyestudio I2C1602 Display Module*1

USB Cable *1

KS0061 (1)

Img

20cm 26AWG 4P-1P F-F Black/Red/Blue/Green Dupont Line

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\4pin 黑红蓝绿 200mm(1).png4pin 黑红蓝绿 200mm(1)

4.Wiring Diagram:

Note: the pin GND, VCC, SDA and SCL of 1602LCD module are connected to GND(-), 5V(+), SDA and SCL of IIC communication.

1602

5.Test Code:

6.Test Result:

Upload code, wire up according to connection diagram and power on. 1602 LCD will display“Hello World!”at the first row and show“Hello Keyes!”at the second row.

Note: wire up connection diagram, upload code and power on. You can adjust the potentiometer on the back of 1602LCD display module to display the character strings

Project 4 Power Amplifier Module

1.Description:

KS0374 功放模块 (8)

We can use Arduino to make many interactive works of which the most commonly used is acoustic-optic display.

The circuit in this experiment can produce sound. Normally, the experiment is done with a buzzer or a speaker while buzzer is simpler and easier to use. In this project, this power amplifier module is equivalent to passive buzzer. It can emit“do re mi fa so la si do”sound via code.

2.Parameters:

Control Port: Digital port

Working Voltage: DC 5V

3.Required Components

Keyestudio Main Board*1

Keyestudio Power Amplifier Module*1

20cm 3pin F-F 26AWG Dupont Line*1

KS0374 功放模块 (8)

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\3pin 黑红黄 150mm(1).png3pin 黑红黄 150mm(1)

USB Cable*1

Img

4.Wiring Diagram:

Note: The G, V and S of power amplifier module are separated to G, V and A0 of expansion board.

buzzer

5.Test Code:

6.Test Result:

Upload code to Keyestudio development board, power amplifier module will emit“do re mi fa so la si do”.

Extension Practice:play music

Project 5: 4*4 Membrane Keypad

1.Description:

To save I/O ports of MCU, we make a Membrane Keypad. In this project, we will make an experiment; serial monitor will display the corresponding character when the membrane keypad is pressed.

2.Schematic Diagram:

3.Specification:

  • Working Voltage: 3.3V~5V

  • Port:digital port

4.Component:

Keyestudio Main Board*1

Keyestudio 4*4 Membrane Keypad*1

15cm 8pin M-F 26AWG Dupont Line *1

MD0090 (15)

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\8pin 红黄绿棕蓝紫白黑 150mm(1).png8pin 红黄绿棕蓝紫白黑 150mm(1)

USB Cable*1

Img

5.Wiring Diagram:

keypad

6.Test Code:

7.Test Result:

Download code, open serial monitor and set baud rate to 9600. The serial monitor will show the corresponding key value when the key of membrane keypad is pressed, as shown below;

Project 6: DS3231 Clock Module:

1. Description:

Clock module can be displayed time and a timer. In this project, we will show time and temperature with DS3231 module.

The clock operation can adopt 24 or 12 hour format through AM/PM indication.

High accuracy and inner temperature compensation of built-in crystal oscillator makes less error. Also, it has automatic compensation for leap-years and for months with fewer than 31 days.

The clock operation can adopt 24 or 12 hour format through AM/PM indication.

DS3231 is used for major power and back-up power. It provides two programmable calendar alarm and 1-channel programmable wave output.

The precise, compensated voltage reference and comparator, supervise the VCC status, detect circuit error, provide reset outputs and switch to back-up power when necessary.

2.Specification:

1)Temperature range: -40 to +85; Timing accuracy : ± 5ppm (±0.432 seconds / day)

2)Provide battery backup for continuous timing

3)Low power consumption

4)Device package and function compatible with DS3231

5)Complete clock calendar function contains seconds and minutes, hour, week, date, month, and year timing and provides leap year compensation until 2100.

6)Two calendar clock

7)Output: 1Hz and 32.768kHz

8)Reset output and Input Debounce of Pushbutton

9)High speed (400kHz), I2C serial bus

10)Supply voltage: +3.3V to +5.5V

11)Digital temperature sensor with a precision of±3℃

12)Working temperature: -40 ~ C to +85 ~ C

13)16 pins Small Outline Package (300mil)

4.Wiring Diagram:

ds3231

5.Test Code:

6.Test Result:

Add the library of DS3221 clock module, and upload code. Then open serial monitor, set baud rate to 57600. We will view date, time, temperature and alarm.

7.Extension Practice:refresh data and temperature on LCD

ds3231+1602

Project 7 Install Electronic Scale

1. Precaution:

1.The front side of each board has a number, the back side is marked ”Back side”. 2.You don’t need to screw the nuts of proof window too tight. 3.Assemble the slot and top board gently in case they are broken. 4.Install battery cell in the clock module. 5. Peel the thin film off the acrylic boards. In the subsequent projects, the wiring-up of sensors is the same as the previous wiring.

2. Installation Steps:

Part 1:

Required parts: Img

Step 1: Img Img Img Step 2: Img Img

Step 3: Img Img Img Img

Step 4: Img Img

Part 2:

Required parts: Img

Step 1: Img Img

Step 2: Img Img Img Img

Part 3:

Required parts: Img Step 1: Img Img

Step 2: Img Img

Step 3: Img Img

Step 4: Img Img

Part 4:

Required parts: Img Step 1: Img Step 2: Img Img

Step 3: Img Img

Step 4: Img Img

Step 5: Img Img

Part 5:

Gently insert the slot

Required parts: Img Step 1: Img Img Step 2: Img Img

Step 3: Img Img

Step 4: Img Img

Step 5: Img Img

Part 6:

Wiring Diagram: Img

LED Module: Img Img

Weighing Module: Img Img Img Img

Clock Module: Img Img Img

Power Amplifier Module: Img Img Img

1602 LCD Display Module: Img Img Img

4*4 Membrane Keypad: Img Img

Battery Holder: Img

Part 7:

Required Parts: Img

Step 1: Img Img

Step 2: Img Img

Step 3: Img Img Step 4: Img Img

Part 5: Img Img Img

Project 8 HX711 Weighing Module & YZC-131 Weighing Sensor

1.Description:

In terms of principles, the electronic scale calculates how much magnitude of the force is when metal is under stress, and foil gauge is commonly used to measured shape changes of metal.

HX711 is a 24-bit A/D converter chip designed for high precision weighing sensor.

Compared with other type chips, it integrates stabilized voltage supply, clock oscillator as well as the peripheral circuit, and features high integration, quick response and anti-interference.

It reduces the overall cost of electronic scale but improve the performance and reliability.

As simple as the MCU chip, its control signals are controlled by pins and it seldom programs the inner register of chip. Also,connected to the programmable amplifier,the input selective switch is either channel A or channel B.

The programmable gain of channel A is 128 or 64 and its corresponding differential input signals are ±20mV or ±40mV.

However, used to system parameter detection, programmable gain of channel B is 32.

The stabilized voltage supply provided by chip can supply power for external sensor and A/D converter inside chip, thus, there is no need the analog power on the board.

In addition, the clock oscillator doesn’t need any external parts.

2.Specification:

(1)5kg sensor full-scale output voltage= VDC*sensitivity 1.0mv/v,for example:power supply 5v multiplies sensitivity 1.0mv/v to get full- scale 5mv. That means 5Kg gravity produces 5mV.

(2)711 module takes samples for produced 5mV

The pin A of 711 module has 128 times amplification coefficient which can make 5mV amplify 128 times and output the conversion value of 24bit AD. In addition. MCU can read the data of 24bit through sequential appointed.

(3)Working Voltage: DC 5V, high precision, low cost.

3.Component:

Keyestudio Main Board*1

YZC-131 Micro Weighing Sensor

Keyestudio HX711 Weighing Module *1

USB Cable*1

20cm 26AWG 4pin-1pin Black/Green/Blue/Red F-F Dupont Line

4*4 Membrane Keypad*1

Img

C:\Users\Admin\Desktop\2.png2

矩阵按键

M2 Balance Wight 50g

Keyestudio I2C1602 LCD Display

15cm 8P M-F 26AWG Dupont Line

液晶屏

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\8pin 红黄绿棕蓝紫白黑 150mm(1).png8pin 红黄绿棕蓝紫白黑 150mm(1)

15cm 8P M-F 26AWG Dupont Line

C:\Users\Admin\Desktop\KS0078 旅行房车机器人安装步骤\模块\4pin 黑红蓝绿 200mm(1).png4pin 黑红蓝绿 200mm(1)

4.Wiring Diagram:

Note:

  1. VCC is random value in 2.6-5.5. We need to use 5V power supply and GND is grounded because Arduino is used in the project.

  2. SCK and DT are respectively connected to Pin 12 and Pin 13 of Arduino. You can change them in the code.

  3. E+, E-, A+ and A- of HX711 weighing module are interfaced with E+, E- , A+ and A- of bridge sensor.

  4. B+ and B- are connected to B of sensor.

  5. You can test power voltage through voltage-dividing circuit.

HX711

5.Test Code:

6.Test Result:

Upload code. The 1602 display module will show weight. You can put a 50g balance weight on the scale and press * key to calibrate. After calibration, press # to subtract tare.

Project 9 Multi-purpose Electronic Scale

1.Description:

In the previous projects, we’ve learned numerous sensors and modules.

In the final lesson, we will sum up the comprehensive features of electronic scale.

2.Flow Chart: Img

3.Wiring Diagram:

SCALE

4.Test Code:

5.Test Result:

(1)Set Calendar

Plug in power, turn on switch, the screen shows time as follows:

  • 4*4 membrane keypad controls the calendar setting

  • Press key A to select year, month, day, week, hour, minute and second.

  • Key B and C are used to adjust numbers, click # to confirm and click D to check and set alarm D.

  • A: move cursor to set time and date

  • B: plus 1

  • C: deduct 1

  • D: switch to alarm page

  • # : exit and confirm time setting

(2)Set Alarm Clock

  • On alarm clock page, there are Alarm 1(on) and Alarm 2(off) .

  • Press A and move cursor to set alarm 1 or alarm 2. Then press B to set time page of alarm clock, press C to turn on/off alarm clock.

  • Press A to move cursor when entering the alarm setting page, then select hour, minute and second(note: you only set hour and minute for alarm 2), next, press B to add 1 and press C to subtract 1.

  • Click # to return and press D to enter electronic scale page.

  • You can turn off alarm when alarm is activated.

(3)Calculating Price

Press D to show calculating price, as shown below: ,P is unit price,M is total price.

The price value can be accurate to 0.1 yuan. The total price will be calculated automatically shown after the unit price is set.

A: move cursor to set unit price by clicking 0-9

B: clear up unit price value P

C: switch to counting mode

D: switch to calendar page

# : subtract tare and clear up

* :calibration

(4)Counting

Press C key to enter the counting page, as shown below:

First row:Weight value Second row: D means mass N=Quantity

Key 0-9: set the mass value of D, which is accurate to 0.1g

A: move cursor to set the mass of D

B: clear up mass value of D

C: switch to counting function

D: switch to calendar page

#:clear up , subtract tare

* :calibration

(5)Calibration Method

On counting and price-calculating page, the screen will prompt to put on a 50g balance weight when key * is pressed. Next, don’t take off balance weight until the calibration is successful(weighing page will appear if calibration is successful). Then screen will show -0.050kg if we take off balance weight.

The screen will show 0.000kg if you press # key, which means tare subtraction is successful. (the error can be within 1g)

7.Trouble Shooting

Electronic scale doesn’t respond

A: 1.Ensure the battery capacity fully charged 2.Check if the wiring-up is correct

USB port can’t recognized by computer

A: 1.Confirm that you’ve installed the driver of CP2102 2.Check if USB cable is good

LCD1602 display shows error A: if LCD 1602 display module is connected well.

LCD1602 display module doesn’t respond A:Check the wiring-up of weighing sensor and weighing module

8. Resource

https://fs.keyestudio.com/KS0345