Linearity Graph
...
tlfong01 wrote: ↑Sat Nov 24, 2018 4:03 am1kg Load Cell Test Results
Load / Output
500ml water = -1.9V
500ml water + 110 ml milk = -2.2V
Sensitivity Calculation
Linearity Graph
1kg Load Cell Testing Results Update
Last time I had no confidence that the fake load cell worked, and also my hardware set up ok, so I was a bit casual and did not include the tray weight of about 160g. Now I have added the tray weight to the Excel worksheet, to make my sensitivity calculation more precise.
The sensitivity is about 0.43 mV/V
tlfong01 wrote: ↑Sat Nov 24, 2018 4:41 am1kg Load Cell Test Results
Load / Output 500ml water = -1.9V 500ml water + 110 ml milk = -2.2V
Sensitivity Calculation Linearity Graph
1kg Load Cell Testing Results Update
Last time I had no confidence that the fake load cell worked, and also my hardware set up ok, so I was a bit casual and did not include the tray weight of about 160g. Now I have added the tray weight to the Excel worksheet, to make my sensitivity calculation more precise.
The sensitivity is about 0.43 mV/V
5kg Load Cell Test Results
Now I am using Excel to calculate the sensitivity of the 5kg load cell.
The results is too good to be true: 1.03 mV/V!
tlfong01 wrote: ↑Sat Nov 24, 2018 8:16 amHX711 Signal Analysis
Output Format
The output 24 bits of data is in 2’s complement format. When input differential signal goes out of the 24 bit range, the output data will be saturated at 800000h (MIN) or 7FFFFFh (MAX), until the input signal comes back to the input range.
Serial Interface
25 pulses = A channel, gain 128
26 pulses = B channel, gain 32
27 pulses = A channel, gain 64
Clock high time = min 0.2 uS, max 50 uS
Clock low time = min 0.2 uS
0.2uS = 1,000,000 / 0.2 = 5 MHz,
50uS = 1,000,000 / 50 = 20 kHz)
Code: Select all
Wemos D1 Mini setting up snippets - tlfong01 2018nov24hkt2248
PORT OPEN 115200
Communication with MCU..Got answer! Communication with MCU established.
AutoDetect firmware...
Can't autodetect firmware, because proper answer not received (may be unknown firmware).
Please, reset module or continue.
!@#¥%……&*()
Flash sig not correct: 0 vs fafaaf50
NodeMCU custom build by frightanic.com
branch: master
commit: c708828bbe853764b9de58fb8113a70f5a24002d
SSL: false
modules: dht,ds18b20,file,gpio,hdc1080,http,i2c,mqtt,net,node,ow,pcm,pwm,rtctime,spi,tmr,uart,wifi
build created on 2018-10-25 07:35
powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9)
lua: cannot open init.lua
> file.format()
format done.
> Uploading to ESP file pf07.lua...Success
Uploading to ESP file pg07.lua...Success
> -- printFlashFiles V07 tlfong01 2018nov24hkt2238 --
>
> function printFlashFiles()
>> fileList = file.list()
>> for name, size in pairs(fileList)
>> do
>> print('name =', name, 'size =', size)
>> end
>> end
>
> printFlashFiles()
name = pf07.lua size = 224
name = pg07.lua size = 210
> title = 'pg07.lua - printGlobalVar v07 tlfong01 2018nov24hkt2235'
>
> function printGlobalVar()
>> for var, value in pairs(_G)
>> do
>> print ('variable =', var, 'value =', value)
>> end
>> end
>
> printGlobalVar()
variable = module value = function: 0x3fff0d50
variable = pairs value = function: 0x3fff11e0
variable = __index value = lightfunction: 0x402543c4
variable = package value = table: 0x3fff0b70
variable = _G value = table: 0x3fff05f8
variable = require value = function: 0x3fff0d90
variable = ipairs value = function: 0x3fff1008
variable = printFlashFiles value = function: 0x3fff06b0
variable = title value = pg07.lua - printGlobalVar v07 tlfong01 2018nov24hkt2235
variable = printGlobalVar value = function: 0x3fff09c0
variable = fileList value = table: 0x3fff0a50
variable = newproxy value = function: 0x3fff12a0
> -- printFlashFiles V07 tlfong01 2018nov24hkt2238 --
>
> function printFlashFiles()
>> fileList = file.list()
>> for name, size in pairs(fileList)
>> do
>> print('name =', name, 'size =', size)
>> end
>> end
>
> printFlashFiles()
name = pf07.lua size = 224
name = pg07.lua size = 210
>
Code: Select all
NodeMCU custom build by frightanic.com
branch: master
commit: c708828bbe853764b9de58fb8113a70f5a24002d
SSL: false
modules: dht,ds18b20,file,gpio,hdc1080,http,i2c,mqtt,net,node,ow,pcm,pwm,rtctime,spi,tmr,uart,wifi
build created on 2018-10-25 07:35
powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9)
Hello World
> title = 'hw08.lua - printHelloWorld v08 tlfong01 2018nov25hkt1457'
>
> function printHelloWorld()
>> print('Hello World')
>> end
>
> printHelloWorld()
Hello World
> -- printFlashFiles V07 tlfong01 2018nov24hkt2238 --
>
> function printFlashFiles()
>> fileList = file.list()
>> for name, size in pairs(fileList)
>> do
>> print('name =', name, 'size =', size)
>> end
>> end
>
> printFlashFiles()
name = init.lua size = 140
name = pg07.lua size = 210
name = pf07.lua size = 224
name = hw08.lua size = 140
> title = 'pg07.lua - printGlobalVar v07 tlfong01 2018nov24hkt2235'
>
> function printGlobalVar()
>> for var, value in pairs(_G)
>> do
>> print ('variable =', var, 'value =', value)
>> end
>> end
>
> printGlobalVar()
variable = module value = function: 0x3fff0d50
variable = pairs value = function: 0x3fff11e0
variable = __index value = lightfunction: 0x402543c4
variable = package value = table: 0x3fff0b70
variable = _G value = table: 0x3fff05f8
variable = require value = function: 0x3fff0d90
variable = ipairs value = function: 0x3fff1008
variable = printFlashFiles value = function: 0x3fff09f0
variable = title value = pg07.lua - printGlobalVar v07 tlfong01 2018nov24hkt2235
variable = printHelloWorld value = function: 0x3fff09a0
variable = fileList value = table: 0x3fff13d8
variable = newproxy value = function: 0x3fff12a0
variable = printGlobalVar value = function: 0x3fff06b0
>
Code: Select all
-- bl2608 - blink D4 LED 26 times tlfong01 2018nov25hkt1606
title = 'bl26'
printTitle(title)
High, Low = true, false
Output, Input = true, false
D0, D1, D2, D3, D4, D5, D6, D7, D8 = 0, 1, 2, 3, 4, 5, 6, 7, 8
TenthSecond, EighthSecond, FifthSecond, QuarterSecond = 100, 125, 200, 250
HalfSecond, OneSecond, TwoSeconds, FourSeconds = 500, 1000, 2000, 4000
EightSeconds, TenSeconds, TwelveSeconds, SixteenSeconds = 8000, 10000, 12000, 16000
OneTime, TwoTimes, ThreeTimes, FourTimes = 1, 2, 3, 4
FiveTimes, SixTimes, SevenTime, EightTimes = 5, 6, 7, 8
TenTimes, TwelveTimes, FourTeenTimes, SixteenTimes = 10, 12, 14, 16
TwentySixTimes = 26
function printTitle(title)
local threeStars = '***'; local twoNewLines = '\n\n'
print(twoNewLines, threeStars, title, threeStars)
end
function printTitleNum(title, num)
local twoNewLines = '\n\n'; local fiveSpaces = ' '
print(fiveSpaces, title, num)
end
function setPinMode(pinNum, pinMode)
if pinMode == Output
then
gpio.mode(pinNum, gpio.OUTPUT)
else
gpio.mode(pinNum, gpio.INPUT)
end
end
function setPinHigh(pinNum)
gpio.write(pinNum, gpio.HIGH)
end
function setPinLow(pinNum)
gpio.write(pinNum, gpio.LOW)
end
function setAllPinsOutput()
for i = 0, 8, 1
do
setPinMode(i, Output)
end
end
function setAllPinsLow()
for i = 0, 8, 1
do
setPinLow(i)
end
end
function setupPins()
setAllPinsOutput()
setAllPinsLow()
end
function togglePin(pinTable)
pinNum = pinTable.pinNum
highTime = pinTable.highTime
lowTime = pinTable.lowTime
toggleCount = pinTable.toggleCount
toggleDelayTime = pinTable.toggleDelayTime
taskCount = pinTable.taskCount
printTitleNum('pinNum =', pinNum)
printTitleNum('highTime =', highTime)
printTitleNum('lowTime =', lowTime)
printTitleNum('toggleCount =', toggleCount)
printTitleNum('toggleDelayTime =', toggleDelayTime)
printTitleNum('taskCount =', taskCount)
highTimer = tmr.create()
lowTimer = tmr.create()
taskTimer = tmr.create()
function highTimerCallback()
setPinLow(pinNum)
currentToggleCount = currentToggleCount - 1
if currentToggleCount > 0
then
lowTimer:start()
else
taskTimer:start()
end
end
function lowTimerCallback()
setPinHigh(pinNum)
highTimer:start()
end
function taskTimerCallback()
taskCount = taskCount - 1
printTitleNum('taskCount =', taskCount)
if taskCount >= 0
then
currentToggleCount = toggleCount
setPinHigh(pinNum)
highTimer:start()
else
printTitle('End of all toggle tasks.')
highTimer:stop()
lowTimer:stop()
taskTimer:stop()
end
end
highTimer:register(highTime, tmr.ALARM_SEMI, highTimerCallback)
lowTimer:register (lowTime, tmr.ALARM_SEMI, lowTimerCallback)
taskTimer:register(toggleDelayTime, tmr.ALARM_SEMI, taskTimerCallback)
taskTimer:start()
end
pinTable01 =
{
pinNum = D4,
highTime = TenthSecond,
lowTime = TenthSecond,
toggleCount = TwoTimes,
toggleDelayTime = OneSecond,
taskCount = TwentySixTimes
}
function main()
printTitle(title)
setupPins()
togglePin(pinTable01)
end
main()
*** Sample Output ***
...
> pinTable01 =
>> {
>> pinNum = D4,
>> highTime = TenthSecond,
>> lowTime = TenthSecond,
>> toggleCount = TwoTimes,
>> toggleDelayTime = OneSecond,
>> taskCount = TwentySixTimes
>> }
>
> function main()
>> printTitle(title)
>> setupPins()
>> togglePin(pinTable01)
>> end
>
> main()
*** bl26 ***
pinNum = 4
highTime = 100
lowTime = 100
toggleCount = 2
toggleDelayTime = 1000
taskCount = 26
> taskCount = 25
taskCount = 24
taskCount = 23
taskCount = 22
taskCount = 21
taskCount = 20
taskCount = 19
taskCount = 18
taskCount = 17
taskCount = 16
taskCount = 15
taskCount = 14
taskCount = 13
taskCount = 12
taskCount = 11
taskCount = 10
taskCount = 9
taskCount = 8
taskCount = 7
taskCount = 6
taskCount = 5
taskCount = 4
taskCount = 3
taskCount = 2
taskCount = 1
taskCount = 0
taskCount = -1
*** End of all toggle tasks. ***
tlfong01 wrote: ↑Sun Nov 25, 2018 8:24 amNotes on writing a NodeMCU Lua program to output 26 10kHz pulses from ESP8266
ESP8266 writing 26 pulses to HX711 Program Testing Notes
Now I have debugged a program to blink D4 LED 26 times. The blink time is 100mS or 10Hz. I am not sure if ESP8266 can blink 10 times faster, at 10kHz.
tlfong01 wrote: ↑Sun Nov 25, 2018 5:10 amHX711 based Digital Weight Scale
It is very likely that your scale uses HX711, sealed inside the black dot. A work around is forget the black dot, and connect your own HX7111 to the load cell. You can also replace the LCD and button by the AliExpress cheap thing below.
The good thing of this work around is that you can data and print anything you like, or add ESP8266 to wifi you reading, ...
tlfong01 wrote: ↑Tue Nov 27, 2018 4:33 amDigital Weight Scale Hacking Notes 1, 2
So this morning I started messing around with my toy. I found it very hacker friendly. Just loosen two screws inside the battery apartment, the weight tray with the load cell can easily be removed.
It took me only 30 seconds. I think the designer is himself a hacker, therefore has made the toy so hacker friendly, ...
tlfong01 wrote: ↑Tue Nov 27, 2018 4:40 amDigital Weight Scale Hacking Notes 1, 2
So this morning I started messing around with my toy. I found it very hacker friendly. Just loosen two screws inside the battery apartment, the weight tray with the load cell can easily be removed.
It took me only 30 seconds. I think the designer is himself a hacker, therefore has made the toy so hacker friendly, ...
Digital Weight Scale Hacking Notes 3, 4
It took me another 30 seconds to loosen two little screws at the top of the case inside, and removed the PCB and LCD. Then I cut the load cell's red, black, green, and white connecting wires and separated the load cell with tray from the PCB.
tlfong01 wrote: ↑Tue Nov 27, 2018 5:27 amDigital Weight Scale Hacking Notes 1, 2
Digital Weight Scale Hacking Notes 3, 4
Digital Weight Scale Hacking Notes 5, 6
The detached load cell has a red blk resistance of 660R. The two M3 screws is 10mm centre to centre.
Everything looks OK. Next step is to secure the load cell with plate to somewhere.
tlfong01 wrote: ↑Tue Nov 27, 2018 7:46 amDigital Weight Scale Hacking Notes 1, 2
Digital Weight Scale Hacking Notes 3, 4
Digital Weight Scale Hacking Notes 5, 6
Digital Weight Scale Hacking Notes 7, 8
Now that the load cell with tray is sitting tight, next step is to add a high class I2C LCD to the whole assembly.
tlfong01 wrote: ↑Sat Nov 24, 2018 5:30 am1kg Load Cell Test Results
Load / Output 500ml water = -1.9V 500ml water + 110 ml milk = -2.2V
The sensitivity is about 0.43 mV/V
5kg Load Cell Test Results
Now I am using Excel to calculate the sensitivity of the 5kg load cell.
The results is too good to be true: 1.03 mV/V!
Load Cell Calibration Standard Weights
I am using a 3.5L fish tank, and 1L/1.2L lunch boxs filled with tap water as standard weights to calibrate the 1kg and 5kg load cells. For the 5kg load cell, I have done two sets of tests, one set the fish tank and a lunch box, the second set with 4 lunch boxes.
tlfong01 wrote: ↑Wed Nov 28, 2018 5:20 am1kg Load Cell Test Results
Load / Output 500ml water = -1.9V 500ml water + 110 ml milk = -2.2V
The sensitivity is about 0.43 mV/V
5kg Load Cell Test Results
Now I am using Excel to calculate the sensitivity of the 5kg load cell.
The results is too good to be true: 1.03 mV/V!
Load Cell Calibration Standard Weights
I am using a 3.5L fish tank, and 1L/1.2L lunch boxs filled with tap water as standard weights to calibrate the 1kg and 5kg load cells. For the 5kg load cell, I have done two sets of tests, one set the fish tank and a lunch box, the second set with 4 lunch boxes.
500g Load Cell Calibration Data
Sensitivity Calculation
Bridge input = 3.27V
Full load 500g output = 4.2mV
Sensitivity = 4.2mV / 3.27V = 1.28mV/V
tlfong01 wrote: ↑Wed Nov 28, 2018 6:25 am1kg Load Cell Test Results
Load / Output 500ml water = -1.9V 500ml water + 110 ml milk = -2.2V
The sensitivity is about 0.43 mV/V
5kg Load Cell Test Results
Now I am using Excel to calculate the sensitivity of the 5kg load cell.
The results is too good to be true: 1.03 mV/V!
Load Cell Calibration Standard Weights
I am using a 3.5L fish tank, and 1L/1.2L lunch boxs filled with tap water as standard weights to calibrate the 1kg and 5kg load cells. For the 5kg load cell, I have done two sets of tests, one set the fish tank and a lunch box, the second set with 4 lunch boxes.
500g Load Cell Calibration Data
Sensitivity Calculation
Bridge input = 3.27V
Full load 500g output = 4.2mV
Sensitivity = 4.2mV / 3.27V = 1.28mV/V
tlfong01 wrote: ↑Tue Nov 27, 2018 9:15 amNodeMCU Lua HX711 Module
I spent 2 hobbyist months to learn the difficult, internet driven, NodeMCU Lua, just hoping to write a blink program to blink the built in LED connection to D4 pin.
I did finally complete an almost bug free program. And now I hope to modify the blink program to blink 26 times at 20kHz, as input signal to KX711, to request for reading the weight.
Disappointedly, I found my blink program can only blink slowly, not faster than 1 kHz. In others words, my time has wasted.
So I gave up and hope to use the NodeMCU HX711 module, if any. I found one, but disappointedly it only uses Channel A, not B. In other words, I cannot use Channel B for calibration and testing.