06-09-2015, 03:37 AM
|
#51 (permalink)
|
EcoModding Lurker
Join Date: Jun 2015
Location: Australia
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
|
Ok, sorry i didnt see the link before :O
in your video you had 2 segment led displays running, do you happen to have a schematic drawn up for that?
Or quite simply how did you connect the diver into the arduino? is is through the I2C connector shown on your previous schematic?
Mitch
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
06-09-2015, 06:20 AM
|
#52 (permalink)
|
EcoModding Apprentice
Join Date: Jan 2010
Location: Newark, DE
Posts: 143
Thanks: 0
Thanked 14 Times in 14 Posts
|
Quote:
Originally Posted by Theitguy
in your video you had 2 segment led displays running, do you happen to have a schematic drawn up for that?
Or quite simply how did you connect the diver into the arduino? is is through the I2C connector shown on your previous schematic?
|
Yes. The 4 wires are 5V, Gnd, SDA and SCL.
The SAA1064 is about as simple as it gets without turning into a huge chip package: Power and I2C inputs, 16 constant-current segment drive outputs. That lets you drive two 7+1 segment digits, a bar graph or whatever. It also has a pair of multiplex outputs that let the chip drive twice the LEDs by alternating which pair of digits are lit - two digits share a set of drive outputs, but the multiplex output controls which digit is lit at any given moment. Alternating digits fast enough makes the on/off cycles blend together until they're virtually invisible to the human eye. The switching is done continuously and transparently by the SAA1064 - you just set the mode and feed it data for the second set of digit(s).
Here's a how-to I just stumbled across: Tutorial: Arduino and the NXP SAA1064 4-digit LED display driver
I'm sure mine could be made much more compact by using the surface-mount version and etching an application-specific PCB.
|
|
|
06-10-2015, 02:25 AM
|
#53 (permalink)
|
EcoModding Lurker
Join Date: Jun 2015
Location: Australia
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
|
Awesome, yes! isnt the saa1064 a little gem! i was going about it with individual 4511 chips and your right! it was going to be a nightmare of ics....
im having a bit of trouble getting your sketch to draw onto the displays, i have wired them according to the instructions in the sketch and the chip to the tutorial as you mentioned, im wondering maybe the memory chip, in your original schematic the sda and scl pins were around the wrong way, i found that one and corrected to the pinout on the datasheet, but im still stuck!
i do have to ask though, why have you included the eeprom? i can figure what wour using it for,
|
|
|
06-10-2015, 04:33 AM
|
#54 (permalink)
|
EcoModding Apprentice
Join Date: Jan 2010
Location: Newark, DE
Posts: 143
Thanks: 0
Thanked 14 Times in 14 Posts
|
Quote:
Originally Posted by Theitguy
why have you included the eeprom? i can figure what wour using it for
|
It's not being used. My original plan was to use it for data storage - a log book of sorts, but never wrote code for it.
Quote:
Originally Posted by Theitguy
im having a bit of trouble getting your sketch to draw onto the displays
|
The I2C code may need updating. I started playing around with the code a bit yesterday (breaking it up into files) and one of the compile errors I had to iron out was the Wire.send (I think?) command being renamed to Wire.write.
Code:
void saa1064Update(byte addy, byte ctrl, byte data0, byte data1, byte data2, byte data3) //This function controls an SAA1064 I2C LED driver
{
Wire.beginTransmission(addy >> 1); //bit-shift the 8-bit address to 7-bit for wire.h
Wire.write(0x00); //byte-address pointer
Wire.write(ctrl); //control register byte
Wire.write(data0); //first display output byte (7 segs + decimal, 8 discreet LEDs or whatever)
Wire.write(data1); //second display output byte
Wire.write(data2); //third display output byte
Wire.write(data3); //fourth display output byte
Wire.endTransmission();
}
Quote:
Originally Posted by Theitguy
i have wired them according to the instructions in the sketch and the chip to the tutorial as you mentioned
|
Are none of the segments lighting, or are they garbled or what? The first LED display "page" is blank, you'll have to hit the 3rd button (iirc) to pick a page with data on it for it to display anything.
|
|
|
06-10-2015, 04:51 AM
|
#55 (permalink)
|
EcoModding Lurker
Join Date: Jun 2015
Location: Australia
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
|
its simply not displaying anything (I.E. the led display is left blank) im thinking that my button resistor values may be different to what you had. im using a freetronics LCD shield with resistor values as below. how do you have the buttons set up? where you have "analogin > 120" is this your voltage value??
Code:
int readAnalogButtonArray() //this function converts the value from the button voltage divider to a useful value
{
**int analogIn = analogRead(0);
**
**if(analogIn > 120)
**{
****if(analogIn > 380)
****{
******if(analogIn > 640)
******{
********if(analogIn > 900)
********{
**********return 4;
********}
********return 3;
******}
******return 2;
****}
****return 1;
**}
**return 0;
}
|
|
|
06-10-2015, 08:51 AM
|
#56 (permalink)
|
EcoModding Apprentice
Join Date: Jan 2010
Location: Newark, DE
Posts: 143
Thanks: 0
Thanked 14 Times in 14 Posts
|
Quote:
Originally Posted by Theitguy
where you have "analogin > 120" is this your voltage value??
|
The 10-bit representation of it, yes. When you run analogRead(pin#), it uses the ATMEGA's ADC to measure the voltage of that pin as a 10-bit (0-1023) value.
Here's the resistor layout I used: http://ecomodder.com/forum/showthrea...tml#post227420
You'll want to set the if{} values half way between the nominal analogRead values. In the case of the schematic you attached: 70, 240, 415, 620 and 880 would be good middle-values.
Last edited by bobski; 06-10-2015 at 09:04 AM..
|
|
|
06-10-2015, 09:05 AM
|
#57 (permalink)
|
EcoModding Lurker
Join Date: Jun 2015
Location: Australia
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
|
yea, i changed my buttons to the values they are supposed to be and still no luck, any other ideas?
|
|
|
06-10-2015, 09:10 AM
|
#58 (permalink)
|
EcoModding Lurker
Join Date: Jun 2015
Location: Australia
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
|
would it effect anything if i was using the chip in static mode rather then multiplexed? would i have to change anything in the code?
|
|
|
06-10-2015, 09:15 AM
|
#59 (permalink)
|
EcoModding Apprentice
Join Date: Jan 2010
Location: Newark, DE
Posts: 143
Thanks: 0
Thanked 14 Times in 14 Posts
|
Quote:
Originally Posted by Theitguy
would it effect anything if i was using the chip in static mode rather then multiplexed? would i have to change anything in the code?
|
Code:
const byte defaultSaa1064ControlByte = 0x37; //control byte: 9 mA drive current, no segment test, all digits active, multiplexed
You'll have to poke around in the datasheet to figure out what bits need to be what.
|
|
|
06-10-2015, 10:04 PM
|
#60 (permalink)
|
EcoModding Lurker
Join Date: Jun 2015
Location: Australia
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
|
what part of the code do you define what the pages for the display show? i aim to write something on the first page as a test so that i know if im addressing the chip correctly!?!
|
|
|
|