I’m creating a project that requires an omp to power a 7 segment display. I have bought this and with the help of this code I have got this far:
`function writeToDisplay(){
// Clear the display
hardware.i2c12.write(0x71,“v”);
server.log("LED i2c write during clear was: ");
local digit1 = 1;
local digit2 = 2;
local digit3 = 3;
local digit4 = 4;
local data = format("%c%c%c%c", digit1, digit2, digit3, digit4);
hardware.i2c12.write(0x71, data);
server.log(hardware.i2c12.write(0x71, data));
So first thing is that the i2c address needs to be correct, and shifted up one place. Replace 0x70 with 0x70<<1, if none of the address lines are strapped high (ie no connection between the pairs of pads labelled A0, A1, A2.
The second thing is this display is a 5v device. It pulls the i2c lines up to 5v which (as it’s through a resistor) isn’t too awful. Are you powering it at 5v or 3.3v?
@Hugo ok so looking at this the default i2c address is 0x70. I have tried all the other possibilities and still no sign of life!
Code now looks like this:
`local sevenSegAddr = 0x70;
function writeToDisplay(){
// Clear the display
hardware.i2c89.write(sevenSegAddr,“v”);
local digit1 = 1;
local digit2 = 2;
local digit3 = 3;
local digit4 = 4;
local data = format("%c%c%c%c", digit1, digit2, digit3, digit4);
hardware.i2c89.write(sevenSegAddr, data);
@Hugo Yes I have. Still not working when powered by 3v or 5v.
`local sevenSegAddr = 0x70<<1;
local sevenSegPort = hardware.i2c89;
function writeToDisplay(){
sevenSegPort.write(sevenSegAddr, "v");
local digit1 = 1;
local digit2 = 2;
local digit3 = 3;
local digit4 = 4;
local data = format("%1d%1d%1d%1d", digit1, digit2, digit3, digit4);
sevenSegPort.write(sevenSegAddr, data);
server.log(data);
@hugo My current thinking is that the 3v i2c communication from the Imp is not enough to power the display (even with a 5v supply). But the example linked in the first post disproves that.
Yes, this is possible. I don’t know what the logic thresholds are on the display, but 3.3v may not be enough to register a logic 1.
Usually a threshold is at 0.7xVDD, or 3.5v for a 5v device and 3.3v will generally work, but it’s NOT in the guaranteed range and hence performance will vary device to device.
However, looking at your code this is not what is required to talk to that display at all. You need to initialize it, etc.
I just realized that we use a similar display in our meeting minder hackathon project. You probably want to copy the sevenseg class from here:
I’m late to this discussion because I just saw this. Your Electric Imp is fine.
I also had a lot of problems driving the HOLTEK HT16K33 chip used on the Adafruit 7-segment displays using the Imp. What I found is that Adafruit has installed 10K-ohm pull-ups on the I2C bus which are too weak when using a single backpack. Try installing your own additional 10K pull-ups to +3.3V on the SCL and SDA lines which (in parallel) effectively makes them 5K pull-ups, and everything starts working properly.