Hello,
I'm pretty new to Arduino and have pretty much beginner skills in programming.
I found this Project that enables one to access the Data bus that most laptop
Batteries use to communicate their status to the Laptop:
The goal is to be able to access this Databus in order to be able to
readout the Battery Status and to be able to charge it in a safe manner.
Furthermore, the goal is to reuse good used batteries from broken Devices.
My Issue is that this was written for the Arduino YUN, not the Uno R3.
There are some Instructions on the Page on how to adapt the code:
If you are using PackProbe with a different board, you’ll have to make multiple edits to the PackProbe sketch:
Change the sketch to replace “#include <Console.h>” with “#include <Serial.h>”, or whatever serial port is most appropriate for your Arduino hardware.
Comment out the “Bridge.begin()” and “Console.begin()” statements.
Uncomment the statements that initialize the serial connection, and edit them to refer to whichever serial port you chose above.
Replace all references to “Console.” (ie Console.print, Console.write) with the appropriate reference to the serial port you chose above (ie Serial.print, Serial.write)
So I made the changes suggested, and if using Serial.h, I get following error message:
PackProbe_UNO_Edit:85:10: fatal error: Serial.h: No such file or directory
#include <Serial.h>
^~~~~~~~~~
compilation terminated.
exit status 1
Serial.h: No such file or directory
If I use SoftwareSerial.h I get other Errors:
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino: In function 'void setup()':
PackProbe_UNO_Edit:136:18: error: 'i2c_init' was not declared in this scope
Serial.println(i2c_init());
^~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:136:18: note: suggested alternative: 'isDigit'
Serial.println(i2c_init());
^~~~~~~~
isDigit
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino: In function 'int fetchWord(byte)':
PackProbe_UNO_Edit:154:32: error: 'I2C_WRITE' was not declared in this scope
i2c_start(deviceAddress<<1 | I2C_WRITE);
^~~~~~~~~
PackProbe_UNO_Edit:154:3: error: 'i2c_start' was not declared in this scope
i2c_start(deviceAddress<<1 | I2C_WRITE);
^~~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:154:3: note: suggested alternative: 'va_start'
i2c_start(deviceAddress<<1 | I2C_WRITE);
^~~~~~~~~
va_start
PackProbe_UNO_Edit:155:3: error: 'i2c_write' was not declared in this scope
i2c_write(func);
^~~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:155:3: note: suggested alternative: 'fwrite'
i2c_write(func);
^~~~~~~~~
fwrite
PackProbe_UNO_Edit:156:36: error: 'I2C_READ' was not declared in this scope
i2c_rep_start(deviceAddress<<1 | I2C_READ);
^~~~~~~~
PackProbe_UNO_Edit:156:3: error: 'i2c_rep_start' was not declared in this scope
i2c_rep_start(deviceAddress<<1 | I2C_READ);
^~~~~~~~~~~~~
PackProbe_UNO_Edit:157:13: error: 'i2c_read' was not declared in this scope
byte b1 = i2c_read(false);
^~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:157:13: note: suggested alternative: 'fread'
byte b1 = i2c_read(false);
^~~~~~~~
fread
PackProbe_UNO_Edit:159:3: error: 'i2c_stop' was not declared in this scope
i2c_stop();
^~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino: In function 'uint8_t i2c_smbus_read_block(uint8_t, uint8_t*, uint8_t)':
PackProbe_UNO_Edit:166:34: error: 'I2C_WRITE' was not declared in this scope
i2c_start((deviceAddress<<1) + I2C_WRITE);
^~~~~~~~~
PackProbe_UNO_Edit:166:3: error: 'i2c_start' was not declared in this scope
i2c_start((deviceAddress<<1) + I2C_WRITE);
^~~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:166:3: note: suggested alternative: 'va_start'
i2c_start((deviceAddress<<1) + I2C_WRITE);
^~~~~~~~~
va_start
PackProbe_UNO_Edit:167:3: error: 'i2c_write' was not declared in this scope
i2c_write(command);
^~~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:167:3: note: suggested alternative: 'fwrite'
i2c_write(command);
^~~~~~~~~
fwrite
PackProbe_UNO_Edit:168:38: error: 'I2C_READ' was not declared in this scope
i2c_rep_start((deviceAddress<<1) + I2C_READ);
^~~~~~~~
PackProbe_UNO_Edit:168:3: error: 'i2c_rep_start' was not declared in this scope
i2c_rep_start((deviceAddress<<1) + I2C_READ);
^~~~~~~~~~~~~
PackProbe_UNO_Edit:169:15: error: 'i2c_read' was not declared in this scope
num_bytes = i2c_read(false); // num of bytes; 1 byte will be index 0
^~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:169:15: note: suggested alternative: 'fread'
num_bytes = i2c_read(false); // num of bytes; 1 byte will be index 0
^~~~~~~~
fread
PackProbe_UNO_Edit:176:3: error: 'i2c_stop' was not declared in this scope
i2c_stop();
^~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino: In function 'void scan()':
PackProbe_UNO_Edit:187:33: error: 'I2C_WRITE' was not declared in this scope
bool ack = i2c_start(i<<1 | I2C_WRITE);
^~~~~~~~~
PackProbe_UNO_Edit:187:16: error: 'i2c_start' was not declared in this scope
bool ack = i2c_start(i<<1 | I2C_WRITE);
^~~~~~~~~
/home/ruessel/Arduino/PackProbe_UNO_Edit/PackProbe_UNO_Edit/PackProbe_UNO_Edit.ino:187:16: note: suggested alternative: 'va_start'
bool ack = i2c_start(i<<1 | I2C_WRITE);
^~~~~~~~~
va_start
PackProbe_UNO_Edit:196:5: error: 'i2c_stop' was not declared in this scope
i2c_stop();
^~~~~~~~
exit status 1
'i2c_init' was not declared in this scope
I'm kinda lost in this... Any Advice if this is even possible with a Uno-R3?
I Installed many different I2C Libraries, but I was not able to get this to
work.
Any Advice would be appreciated!
Best Regards, Technikerl