Has anyone successfully used AS1115 driver with arduino?
I am trying to upgrade my SAA1064-based 7-seg LED clock with few more digits and have it run off 3.3 V, and AS 1115 seems like a perfect solution, but I can't get the display segments to show anything. It is just 7 7-seg common-cathode digits connected directly to the driver chip, which is run off Arduino Mega 2560 through I2C.
I am using github.com/sarahemm/arduino-as1115 library. The example counter code is showing output in the serial window, but the display remains off.
I2C scanner does show the device at address 0x00, but starts hanging at "Scanning..." if I add:
Just a 7-seg common-cathode display, connected directly to the AS1115. Yes, there is 13k Rset resistor, and 3k3 pull-up on both SCL and SDA.
First thing: I wrote quick library-less test code, and my display WORKS Here is my test code if anyone needs it:
#include <Wire.h>
byte digit, counter;
void setup() {
Wire.begin();
Serial.begin(9600);
// AS1115 is in shutdown on power-up. Wake up & reset feature register.
Serial.println("Initializing AS1115...");
I2CWrite(0x00, 0x0C, 0x01);
// Default global intensity is minimal. Set to 50 %.
Serial.println("Setting global intensity...");
I2CWrite(0x00, 0x0A, 0x80);
// Set scan limit to display all digits.
Serial.println("Setting scan limits...");
I2CWrite(0x00, 0x0B, 0x07);
// Set all digits to "no decode".
Serial.println("Setting decoding...");
I2CWrite(0x00, 0x09, 0x00);
Serial.println("Writing to display...");
for(digit=0; digit<=7; digit++) {
I2CWrite(0x00, digit+1, 0xFF); // turn all segments ON
}
Serial.println("Done.");
delay(3000);
// Set all digits to font decode.
Serial.println("Setting decoding...");
I2CWrite(0x00, 0x09, 0xFF);
}
void I2CWrite(byte deviceAddr, byte cmd, byte data) {
Wire.beginTransmission(deviceAddr);
Wire.write(cmd);
Wire.write(data);
Wire.endTransmission();
}
void loop() {
Serial.print("Displaying ");
for (counter=0; counter<=0x10; counter++) {
for (digit=0; digit<=7; digit++) {
I2CWrite(0x00, digit+1, counter);
Serial.print(counter, HEX);
}
Serial.println("");
delay(500);
}
}
Now, there seem to be an issue with the example that is coming with the AS1115 library. I can't see at the moment where is the problem coming from, but the library example at first does not work (it works, giving output in the Serial Monitor, but nothing on the display). However, if you load my library-less code above (and with that display works just fine), and THEN load the example that comes with the library, the example works. Funny, heh?
Does the example code still work if you power-off between running your code and the example code?
Sounds like the example code is missing a step when it initialises tthe '1115 that your code is doing.
For me it also demonstrates that sometimes libraries add very little value! With some carefully chosen constant names, would your code be any less readable or more complex than if it used that library? Sometimes all libraries do is perpetuate the myth that you have to have a library to use each bit of new hardware.
Zoran - did you figure this out? I'm designing around an AS1117 and am hoping to use the AS1115 library. Reviewing the datasheets it looks like it should work, but I don't want to be debugging an issue I think is related to using the AS1115 library with an AS1117 when in reality it's an issue even driving an AS1115 :o Thanks!
Sorry, I did not look up this thread for a while... Yes, I am successfully using the AS1115, but I do it with no library ; for my needs, there is no need, it just makes my setup routine a bit longer, as it has to do several steps. A well-written library would certainly make the code more readable, but as always, commenting inline greatly helps reading through cryptic init steps. I am using 3 displays, each with its own AS1115, and it works great.
Let me see if I can post here two examples, one using one AS1115 at default address, and the other, using 3 AS1115 on the same I2C bus.
AS1115 are a great option since they happily run on anything between 2.7 - 5.5 V, so you can use them directly on all Arduinos - Tiny, Mega, XMega, ARM..., as opposed to SAA1064, which do not run under 5 V.
Did you manage to find as1115 in dip package? Where from?
Does it really default to i2c address 0x00? I didn't think that was a valid address. Or is 0x00 a "broadcast" address, which would work ok with only one device on the bus?