Show Posts
Pages: [1] 2 3 ... 7
1  Using Arduino / Project Guidance / Re: I2C Battery BMS Status Display on: February 06, 2014, 03:44:46 pm
I have to learn to tick the reply notifications.

Well, ok.
I took your code, changed the pins for the LCD display, which is wired up correctly and working.
I used pins A4 and A5 as I am using an Arduino Nano. I've read that those are the pins to use. I also connected ground on the arduino and the bms.
Please don't be too hard on me, it was only yesterday that I had my first successful output on a 20x4 character display.
I get loads of errors, mostly "error: expected constructor, destructor, or type conversion before '=' token"

Could somebody point me in the right direction. As a first step, it would be great if I could display the voltage of one cell and the total voltage.


Code:
// akku einlesen
#include <Wire.h>
#include <LiquidCrystal.h>
//LCD stuff
LiquidCrystal lcd(12, 11, 10, 9, 8, 7, 6);
int backLight = 13;    // pin 13 will control the backlight



//BMS stuff
  i2cadr = 0x30;   // OZ: adr. 30 statt 60h!!
  adr = 0x0;         // chip id an adr. 0h
 
  // strom lesen
   adr = 0x54;         // strom an adr. 54h
  // register adresse übermitteln
  Wire.beginTransmission(i2cadr);
  Wire.write(adr);
  stat1 = Wire.endTransmission(false); // 0:sucess
  // register daten lesen
  stat2 = Wire.requestFrom(i2cadr, 2); // anzahl der gelesenen bytes
  val1 = Wire.read();
  val2 = Wire.read();
  // bytes auswerten
  val2 =  (val2 & 0x7F); // VZ ausblenden, noch auswerten
  amp = 7.63 * (val2 * 256 + val1)/1000; // mV-Spannungsabfall

  // spannungen lesen
  adr = 0x32;         //  spannung zelle 1 an adr 32h
  zelle = 1+count % 13;   // für 8 Zellen (13 statt 8 eingegeben)
  adr = adr + 2*(zelle-1);
  // register adresse übermitteln
  Wire.beginTransmission(i2cadr);
  Wire.write(adr);
  stat1 = Wire.endTransmission(false); // 0:sucess
  // register daten lesen
  stat2 = Wire.requestFrom(i2cadr, 2); // anzahl der gelesenen bytes
  val1 = Wire.read();
  val2 = Wire.read();
  // bytes auswerten
  val1 =  val1/13; // 3 bits ausblenden 13 statt 8 eingegeben
  val2 =  (val2 & 0x7F); // VZ ausblenden
 
  switch (zelle) {
    case 1:
      volt1 = 1.22 * (val2 * 32 + val1);
      break;
   case 2:
      volt2 = 1.22 * (val2 * 32 + val1);
      break;
   case 3:
      volt3 = 1.22 * (val2 * 32 + val1);
      break;
   case 4:
      volt4 = 1.22 * (val2 * 32 + val1);
      break;
   case 5:
      volt5 = 1.22 * (val2 * 32 + val1);
      break;
   case 6:
      volt6 = 1.22 * (val2 * 32 + val1);
      break;
   case 7:
      volt7 = 1.22 * (val2 * 32 + val1);
      break;
   case 8:
      volt8 = 1.22 * (val2 * 32 + val1);
      break;
  }

  // Gesamt-, MIN und MAX
  volt = (volt1+volt2+volt3+volt4+volt5+volt6+volt7+volt8)/1000;
  voltMIN = min(volt1,min(volt2,min(volt3,min(volt4,min(volt5,min(volt6,min(volt7,volt8)))))));
  voltMAX = max(volt1,max(volt2,max(volt3,max(volt4,max(volt5,max(volt6,max(volt7,volt8)))))));
 



void setup()
{
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH);
  lcd.begin(20,4);   
  lcd.clear();       
 
lcd.setCursor(0,0);
  lcd.print(volt1);

  }
 


2  Using Arduino / Displays / Re: Which resistors for contrast and backlight for 20x4 LCD display on: February 05, 2014, 08:30:36 pm
Thanks a lot again.

I think, I did very well for a beginner.
It looks very good now, I think



Code:
#include <LiquidCrystal.h>

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13;    // pin 13 will control the backlight

byte average[8] = {
  B01111,
  B10011,
  B10111,
  B10101,
  B11101,
  B11001,
  B11110,
};

byte degree[8] = {
  B01000,
  B10100,
  B01000,
  B00000,
  B00000,
  B00000,
  B00000,
};


void setup()
{
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH);
  lcd.createChar(0,average);
  lcd.createChar(1,degree);
  lcd.begin(20,4);   
  lcd.clear();       
 
  // row 0
  lcd.setCursor(0,0);
  lcd.print("03:54");
  lcd.setCursor(7,0);
  lcd.print("23.2kmh");
  lcd.setCursor(15,0);         
  lcd.print("23.4");
  lcd.setCursor(19,0);
  lcd.write(byte(1));
 
  // row 1
  lcd.setCursor(0,1);
  lcd.print("25.1V");
  lcd.setCursor(7,1);
  lcd.print("250W");
  lcd.setCursor(15,1);         
  lcd.print("23.1A");
 
  // row 2
  lcd.setCursor(0,2);
  lcd.print("12.3km");
  lcd.setCursor(7,2);
  lcd.print("123Wh");
  lcd.setCursor(14,2);         
  lcd.print("17.3Ah");
 
  // row 3
  lcd.setCursor(1,3);
  lcd.print("6.2Wh/km");
  lcd.setCursor(12,3);
  lcd.print("23.1kmh");
  lcd.setCursor(19,3);
  lcd.write(byte(0));
}

void loop()
{
}
3  Using Arduino / Displays / Re: Which resistors for contrast and backlight for 20x4 LCD display on: February 05, 2014, 07:46:49 pm
This is more or less, what I want the final display to look like


I am wondering if there's a wayto get the "°" degree character and maybe a "0" with a line through it for an "average character"
I wouldlike that a lot.
4  Using Arduino / Displays / Re: Which resistors for contrast and backlight for 20x4 LCD display on: February 05, 2014, 07:11:28 pm
Hey ! Hey!!

That worked flawlessly as you can see



Just for my education.
Could I not also have connected the contrast pin to an analogue pin on the arduino and set it to an output value of around 80?
5  Using Arduino / Displays / Re: Which resistors for contrast and backlight for 20x4 LCD display on: February 05, 2014, 06:14:34 pm
Thanks for the replies.

Maybe I should have made it clearer that from an angle I can see everything perfectly. So the code is working. I therefore assume that it is a problem with the resistors.
I have ordered quite a few different potentiometers and will try them, when they get here on Friday (hopefully)
I do have all sorts of resistors here, but it's very tedious soldering in the different values of resistors all the time.

I will look for the 100 Ohm resistor.
6  Using Arduino / Project Guidance / Re: I2C Battery BMS Status Display on: February 05, 2014, 04:10:22 pm
Thanks a lot.

Which pins did you use to connect the three pins of the BMS?
Don't you have to set those pins beforehand?
7  Using Arduino / Displays / Which resistors for contrast and backlight for 20x4 LCD display on: February 05, 2014, 04:08:05 pm
Hello,

the title says it all, I believe.
Can you tell me, which resistors to use on those displays. I haven't been able to display anything proberly.
Or which potentiometers should I get.

Thanks
8  Using Arduino / Project Guidance / Re: I2C Battery BMS Status Display on: February 03, 2014, 04:05:02 pm
Have you gotten any further?
I'm trying to do the same thing.
9  Using Arduino / Project Guidance / Re: Solution for SED1335 based 320x240 graphic LCDs on: September 16, 2013, 04:30:26 am
Have you found a solution for this?
I've also found a SED1335 based display, that I would like to use, if possible
10  Using Arduino / Displays / Re: Outdoor display 3-5" OLED or something else? on: September 15, 2013, 12:58:08 pm
Thanks for that link.
I'll make sure to buy from there. Maybe we can order together next time. I'm from Germany, too.

Do I need any additional controller for that display?
Is there some sort of a mounting frame for that particular one?

11  Using Arduino / Displays / Re: Outdoor display 3-5" OLED or something else? on: September 15, 2013, 04:44:53 am
I had already asked for a price on the DOG display. They're over 150€ a piece :-(
12  Using Arduino / Displays / Re: Outdoor display 3-5" OLED or something else? on: September 14, 2013, 07:29:27 pm
Thanks for the suggestion, but that would be way too much work to duplicate a few times. It should be viable to have 5 or 10 of those in the long run.
13  Using Arduino / Displays / Re: Outdoor display 3-5" OLED or something else? on: September 14, 2013, 06:21:10 pm
I have a 5110 display here, and if it were 6 times bigger, I'd go with it.
But on the handlebar while riding it needs to be bigger to display all the info in a readable size.
If the displays aren't too expensive I wouldn't mind trying a couple of different ones. I bought the blue 20x4 displays aswell and I have a 16x2 I think in green, too.
So, for the prototype I don't mind trying a few different things in hopes I can duplicate them for other bikes later and other people won't have to go through trying everything, too
14  Using Arduino / Displays / Re: Outdoor display 3-5" OLED or something else? on: September 14, 2013, 05:39:46 pm
Well, I do have a ebike battery that I recharge every day, so the power consumption of the OLED is a non issue.
15  Using Arduino / Displays / Re: Outdoor display 3-5" OLED or something else? on: September 14, 2013, 04:13:41 pm
Well, I would like the resolution as good as possible, but 4 lines for text would be enough.

This is the information I would like to display:

24,5 km/h
100 rpm 
48.1V
20:30
2.15 Ah 
20.3A   
23.30km
67:23
32.1Wh   
250 W
5.2Wh/km
43.2°C
17.3°C

The speed and power may be a little larger in the middle than the other values, but the rest can be in 3 rows around the speed value.
So, I'm guessing 240x128 would be enough
Pages: [1] 2 3 ... 7