ADC error

Hi all,

I am thinking about connecting a weight scale to Internet.

Today I was trying to use the ADC on PIN8 and PIN9.
It looks like there is a pretty consistent difference between PIN and PIN9.
I connect them to a point having Voltage 1.07V, and observed a 6% different.
Not sure if it is expected or not.

My code is like following, and the output value on server side is always around 1.06.


local interval_ms = 1000;

// read called every interval_ms
function read()
    // read pin 9 value
    local l_pin9 =;
    // read pin 8 value
    local l_pin8 =;*1.0/l_pin9);
    // Schedule the next read
    imp.wakeup(interval_ms/1000.0, read);

// Register with the server
imp.configure(“read ADC”, [], []);
 // Configure pin 9 as an ADC Pin

// Configure pin 8 as an ADC Pin

// Start blinking
// End of code.