Sunday, February 19, 2012

Shortcut protection for power supply



This i the automatic shortcut protection circuit in my dual  rail power supply with 2 x lm338



Schemtaic for the shortcut protection circuit,. This is scheematic for the single rail powersupply, you can just add more  optocouplers in series for dual rail, or even more rails.

Wednesday, February 15, 2012

Saturday, February 11, 2012

Arduino as voltmeter

I made a solardatalogger for few years ago (will publish code latter to this solardatalogger).

In my solardatalogger i used arduino with a ethershield to mesure battery bank voltage with analog input.

The analog input at the arduino board are not protected, and will burn if 20 volt is connected. So i made a overvoltage protecting circuit with a few 1% resistors and a 5 volt zener.

The codesnip below is used to integrate in you own arduino sketch, enjoy ;)
Arduino as Voltmeter


The routine showed in the codesnip collect data from analog pin 5, at 5 volts contains whole 1023, the divide by 2 and converted into 4 digits. The 4 digits plus a decimal point is stored in a string of char with excitement: 05.00 ready to send serial with usb or via ethernet.

A better way to scale the analog input is with the MAP command:

map(value, fromLow, fromHigh, toLow, toHigh)

This command is very flexible. value is converted from 0 to 1023 to 0 to 20000

Then we have a good solid scale, and need only to divide by 1000 to place the decimal point.

In my own solardatalogger project data is sent to a mysql database and it is easy to handle calculations in php instead of the Arduino.


In my EVduino-MS project the voltage value will be converted into  graphic bars on the LCD touch display

Friday, February 10, 2012

Automatic switch between offgrid and ingrid

Just installed the automatic swich box for my television corner.

The schematic is already published in a earlier post.

It works well, test if batteri voltage is high enough to drive television watching, light and dvbt antenna. If voltage is ok, then turns on the 12 - 230 volt inverter.

If voltage get below a preadjusted level, it turns to gridtie electricity, and turn off inverter.


The inverter placed in the cellar. Connected to the offgrid 12 volt interconnection board.


The controller circuit, yes i know, it don't look beautiful, but it works as expected ;)


Adjustment off the minimum offgrid voltage accepted, before automatic switching to grid-tie.


Gridtie connection

Monday, February 6, 2012

Dallas ds18b20 temperature sensor and arduino

Code piece for arduino integrated with dallas ds18b20 temperature sensor

** Remark that the code piece must be integrated into your own application to work properly, it is a draft !
Dallas Ds18b20

How To connect the dallas ds18b20 to arduino digital pin (this is not one wire connecting)



This picture show a DFRduino (Arduino Mega 1280 compatibel) with 2,8" LCD touch display. This unit is intend to be used in the project: EVduino-MS. EVduino-MS is a Electric Vehicle Monitoring and datalogger System will be used in my kewet 2 EV.

Dallas ds18b20 Links and ressources:
caminoi
avrfreaks
c code package ds18b20

Arduino Test software 9 february 2012,  Demo video
In this test version, dallas ds18b20 works well


Grab the demo Code pieces / schetch below demo movie









// EVduino-MS-08b first playground version
//
// Project start date: 22 January 2012
// Version of the EVduino-MS: 0,8beta
// Author: Michael Pedersen
// Project Home: http://mynerdstuff.blogspot.com/2012/01/arduino-based-electric-vehicle.html
//
// This 0,8 beta Version is intend to bed used in a KEWET 2 electric vehicle with 4 lead Acid batteries
// Link to 0.8beta home: http://mynerdstuff.blogspot.com/2012/02/evduino-ms-08beta-code.html

#include <f12x12.h>
#include <TFT_Font.h>
#include <TFT_Graphics.h>
#include <Touchpanel.h>
#include <util/delay.h>
#include <stdlib.h>
#include "f15x22.h"
#include <string.h>


//Dallas ds18b20temperature sensor define
#define TEMP_PIN  11 //pwm11 , pwm 13 did not work in my DFRduino, don't know why, might work on other megaduino boards
#define RED_LED_PIN  12 //pwm12
void getCurrentTemp(char *temp);
void enginetemperature();

#define TP_STABLE_COUNT 1
Graphics tft;

TFT_Font font;
touchpanel tp;

void colormap();
void fontmap();
void bitmap();
uint8_t mount_sd();
uint8_t open_root_dir();
uint8_t show_bitmap();
void calibrate();
void tp_calibrate();
//void batteriesvoltage(float *voltage);

typedef struct menu_item{
  uint16_t sx;
  uint16_t sy;
  uint16_t ex;
  uint16_t ey;
  char *str;
  void (*func)(void);
}
MENUITEM;

//This is the main menu placement
#define MENU_START_X 40
#define MENU_START_Y 60
#define MENU_WIDTH 120
#define MENU_HEIGHT 40
#define MENU_GAP 20

// This is the main menu buttons, black with white text. Turns green when pressed
#define MENU_FONT_COLOR WHITE
#define MENU_NORMAL_COLOR BLACK
#define MENU_HIGHLIGHT_COLOR GREEN

MENUITEM menu[4];
int current_menu_no = -1;
float volt1;

void setup()
{

  //initialize DS18B20 datapin
  digitalWrite(TEMP_PIN, LOW);
  pinMode(TEMP_PIN, INPUT);

  pinMode(RED_LED_PIN, OUTPUT);
  digitalWrite(RED_LED_PIN, HIGH);

  //digitalWrite(11, LOW);
  //pinMode(11, INPUT);


  volt1 = 12,34;
  tft.initialize(LCD_HORIZONTAL);
  tft.ClearScreen(WHITE);
  font.set_Font(f12x12);
  tp.init();
  tp.get_matrix();

  //setup menu
  menu[0].sx = MENU_START_X;
  menu[0].sy = MENU_START_Y;
  menu[0].ex = MENU_START_X + MENU_WIDTH;
  menu[0].ey = MENU_START_Y + MENU_HEIGHT;
  menu[0].str = PSTR("Engine Current");
  menu[0].func = enginecurrent;

  menu[1].sx = MENU_START_X;
  menu[1].sy = MENU_START_Y + MENU_HEIGHT + MENU_GAP;
  menu[1].ex = MENU_START_X + MENU_WIDTH;
  menu[1].ey = MENU_START_Y + 2*MENU_HEIGHT + MENU_GAP;
  menu[1].str = PSTR("Batteries");
  menu[1].func = batteriesvoltage;

  menu[2].sx = MENU_START_X + MENU_WIDTH +MENU_GAP;
  menu[2].sy = MENU_START_Y;
  menu[2].ex = MENU_START_X + 2*MENU_WIDTH+MENU_GAP;
  menu[2].ey = MENU_START_Y + MENU_HEIGHT;
  menu[2].str = PSTR("Engine Temp");
  menu[2].func = enginetemperature;

  menu[3].sx = MENU_START_X + MENU_WIDTH +MENU_GAP;
  menu[3].sy = MENU_START_Y + MENU_HEIGHT + MENU_GAP;
  menu[3].ex = MENU_START_X + 2*MENU_WIDTH+MENU_GAP;
  menu[3].ey = MENU_START_Y + 2*MENU_HEIGHT + MENU_GAP;
  menu[3].str = PSTR("TP CALIBRATION");
  menu[3].func = calibrate;


}

void text_box_P(uint16_t x1,uint16_t y1, uint16_t x2, uint16_t y2, uint16_t radius, char* str_P)
{
  tft.DrawRoundRect(x1,y1,x2,y2, radius, font.BK_color, 1);
  font.set_Cursor( (x1+x2-font.str_Width_P(str_P))>>1, (y1+y2-font.Font_Height)>>1 );
  font.putstr_P(str_P);
}

void init_menu()
{
  int i;
  font.set_Color(MENU_FONT_COLOR, MENU_NORMAL_COLOR,1);
  for(i=0; i<4; i++)
    text_box_P( menu[i].sx, menu[i].sy, menu[i].ex, menu[i].ey, 8, menu[i].str);

  current_menu_no = -1 ;
}




void text_box(uint16_t x1,uint16_t y1, uint16_t x2, uint16_t y2, uint16_t radius, char* str)
{
  tft.DrawRoundRect(x1,y1,x2,y2, radius, font.BK_color, 1);
  font.set_Cursor( (x1+x2-font.str_Width(str))>>1, (y1+y2-font.Font_Height)>>1 );
  font.putstr(str);
}


uint8_t get_stable_tp(POINT* tp)
{
  static POINT previous_tp;
  static uint8_t count=0;


  if(tp->x == 0 || tp->y == 0)
    return 0;

  if(tp->x == previous_tp.x && tp->y == previous_tp.y)
    count++;
  else{
    count = 0;
    previous_tp.x = tp->x;
    previous_tp.y = tp->y;
  }

  if(count>= TP_STABLE_COUNT){
    count = 0;
    return 1;
  }

  return 0;
}


char tp_inside_menu(POINT *tp)
{
  int i;
  for(i=0; i<4; i++){
    if( tp->x>= menu[i].sx && tp->y>= menu[i].sy &&
      tp->x <= menu[i].ex && tp->y <= menu[i].ey )

      return i;
  }
  return -1; // not inside any menu item

}


void loop()
{
  POINT *tp_dat;

  init_menu();
  while(1)
  {
    char cord[5];
    tp_dat = tp.read_lcd_point();

    if(get_stable_tp(tp_dat) )  // got a stable tp point
    {
      current_menu_no = tp_inside_menu(tp_dat);

      if(current_menu_no >=0 && current_menu_no<=4){
        font.set_Color(MENU_FONT_COLOR, MENU_HIGHLIGHT_COLOR,1); // draw current menu in highlight color
        text_box_P( menu[current_menu_no].sx, menu[current_menu_no].sy, menu[current_menu_no].ex, menu[current_menu_no].ey, 8, menu[current_menu_no].str);
        _delay_ms(50);
        (*(menu[current_menu_no].func))();

        init_menu();
      }
    }

    _delay_ms(5);
  }
}

void wait_for_OK()
{
  POINT *tp_dat;

  font.set_Color(MENU_FONT_COLOR, MENU_NORMAL_COLOR,1);

  text_box_P( 120, 20, 200, 50, 5, PSTR("OK"));

  while(1)
  {
    tp_dat = tp.read_lcd_point();

    if(get_stable_tp(tp_dat) )
    {
      if(tp_dat->x>=120 && tp_dat->y >=20&& tp_dat->x <=200 && tp_dat->y<=50)
      {
        tft.ClearScreen(WHITE);
        return;
      }
    }
    _delay_ms(5);
  }
}

uint8_t wait_for_input()
{
  POINT *tp_dat;

  font.set_Color(MENU_FONT_COLOR, MENU_NORMAL_COLOR,1);

  text_box_P( 120, 20, 180, 50, 5, PSTR("OK"));
  text_box_P( 200, 20, 280, 50, 5, PSTR("NEXT"));

  while(1)
  {
    tp_dat = tp.read_lcd_point();

    if(get_stable_tp(tp_dat) )
    {
      if(tp_dat->x>=120 && tp_dat->y >=20&& tp_dat->x <=180 && tp_dat->y<=50) return 1;
      else if (tp_dat->x>=200 && tp_dat->y >=20&& tp_dat->x <=280 && tp_dat->y<=50) return 0;
    }
    _delay_ms(5);
  }
}


void colormap()
{
  uint8_t i,j,k;
  // draw a clolormap
  uint16_t color;
  tft.ClearScreen(WHITE);

  // draw 512 (10x15) boxes with incremantal color
  for(i=0; i<8; i++){
    for(j=0; j<8; j++){
      for(k=0;k<8;k++){
        color = _RGB565(i<<5, j<<5, k<<5);
        tft.DrawRoundRect(i*40+(j/2)*10, k*15+ (j&0x1)*120,i*40+(j/2)*10 +9, k*15+ (j&0x1)*120 +14, 0, color,1);
      }
    }
  }
  wait_for_OK();
}


void fontmap()
{
  char i;
  uint8_t row=0;

  // draw font
  tft.ClearScreen(WHITE);

  tft.DrawRoundRect( 40, 70, 280, 230,  10, MENU_HIGHLIGHT_COLOR,1);

  font.set_Font(f15x22);
  font.set_Color(MENU_FONT_COLOR, MENU_NORMAL_COLOR,1);

  font.set_Cursor( 50, 80);

  for(i=font.Font_FirstChar; i<= font.Font_LastChar; i++)
  {
    if(font.CharWidth(i) !=0)
    {
      if( (font.CursorX + font.CharWidth(i)) > 270)
      {
        row++;
        font.set_Cursor(50, 80+ (row* font.Font_Height + 2));
      }

      font.putChar(i);
    }
  }
  font.set_Font(f12x12);
  wait_for_OK();
}


void bitmap()
{
  uint8_t res;
  char temp[10];
  tft.ClearScreen(WHITE);
#if defined(__AVR_ATmega328P__)||defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  res = mount_sd();
  if(res) {
    text_box_P( 80, 50, 250, 200, 15, PSTR("Cannot mount SDcard"));
 
 
    wait_for_OK();
  }
  else
  {
    if(open_root_dir()) return;
    while(1){
   
      res= show_bitmap();
      if(!res){
        if(wait_for_input()==1) {
          tft.ClearScreen(WHITE);
          break;  // ok button is pressed, break the loop
        }
      }
      else if(res==0x10)  // reopen root dir
      {
        if(open_root_dir()) return;
      }
    }
  }


#else
  text_box_P(80, 60, 250, 200, 15, PSTR("N/A in ATMEGA168"));
  wait_for_OK();
#endif

}

void enginetemperature()
{
  digitalWrite(RED_LED_PIN, LOW);

  //exampel place qwerty in the drawn RoundRect
  String sensorTypeTxt;
  String test;
  char i = 42;
  char sensorData[20] = "12,34 Volt";    

 // dallas ds18b20 variables test
  uint16_t plen, dat_p;
        char temp_string[10] = "1234";
     
       getCurrentTemp(sensorData); //go get dallas ds18b20 temperature
     
     

  sensorTypeTxt = "Engine Temp. is: ";
//sensorTypeTxt.concat(millis());
  sensorTypeTxt.concat(sensorData);
  uint8_t row=0;

  // draw font
  tft.ClearScreen(WHITE);

  tft.DrawRoundRect( 40, 70, 280, 130,  10, MENU_HIGHLIGHT_COLOR,1);

  font.set_Font(f15x22);
  font.set_Color(MENU_FONT_COLOR, MENU_NORMAL_COLOR,1);

  font.set_Cursor( 50, 80); //Place cursor at low/left of LCD

  for(i=0; i<43;i++) //loop until al chrs in sensorData is placed on the LCD display
  {
    font.putChar(sensorTypeTxt[i]); //place the sensorData variable, sensorData come from a sensor as voltage sensor, current sensor, temperature sensor

    if(font.CharWidth(i) !=0)
    {
      if( (font.CursorX + font.CharWidth(i)) > 270)
      {
        row++;
        font.set_Cursor(50, 80+ (row* font.Font_Height + 2));
      }    
    }
  }

  font.set_Font(f12x12); // set font to menu size
  wait_for_OK();
}


void enginecurrent()
{
  text_box_P( 80, 50, 250, 200, 15, PSTR("300A messhunt data:"));
   digitalWrite(RED_LED_PIN, LOW);
  wait_for_OK();
}


void batteriesvoltage()
{
  digitalWrite(RED_LED_PIN, HIGH);

  //exampel place qwerty in the drawn RoundRect
  String sensorTypeTxt;
  String test;
  char i = 42;
  char sensorData[20] = "12,34 Volt";    

 // dallas ds18b20 variables test
  uint16_t plen, dat_p;
        char temp_string[10] = "1234";
     
       getCurrentTemp(sensorData); //go get dallas ds18b20 temperature
     
     

  sensorTypeTxt = "Battery one: ";
//sensorTypeTxt.concat(millis());
  sensorTypeTxt.concat(sensorData);
  uint8_t row=0;

  // draw font
  tft.ClearScreen(WHITE);

  tft.DrawRoundRect( 40, 70, 280, 130,  10, MENU_HIGHLIGHT_COLOR,1);

  font.set_Font(f15x22);
  font.set_Color(MENU_FONT_COLOR, MENU_NORMAL_COLOR,1);

  font.set_Cursor( 50, 80); //Place cursor at low/left of LCD

  for(i=0; i<43;i++) //loop until al chrs in sensorData is placed on the LCD display
  {
    font.putChar(sensorTypeTxt[i]); //place the sensorData variable, sensorData come from a sensor as voltage sensor, current sensor, temperature sensor

    if(font.CharWidth(i) !=0)
    {
      if( (font.CursorX + font.CharWidth(i)) > 270)
      {
        row++;
        font.set_Cursor(50, 80+ (row* font.Font_Height + 2));
      }    
    }
  }

  font.set_Font(f12x12); // set font to menu size
  wait_for_OK();

}


void calibrate()
{
  tft.ClearScreen(BLACK);
  tp_calibrate();
  wait_for_OK();
}

//*********************************
// onewire and dallas ds18b20 code
//*********************************

void OneWireReset(int Pin) // reset.  Should improve to act as a presence pulse
{
     digitalWrite(Pin, LOW);
     pinMode(Pin, OUTPUT); // bring low for 500 us
     delayMicroseconds(500);
     pinMode(Pin, INPUT);
     delayMicroseconds(500);
}

void OneWireOutByte(int Pin, byte d) // output byte d (least sig bit first).
{
   byte n;

   for(n=8; n!=0; n--)
   {
      if ((d & 0x01) == 1)  // test least sig bit
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(5);
         pinMode(Pin, INPUT);
         delayMicroseconds(60);
      }
      else
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(60);
         pinMode(Pin, INPUT);
      }

      d=d>>1; // now the next bit is in the least sig bit position.
   }
 
}

byte OneWireInByte(int Pin) // read byte, least sig byte first
{
    byte d, n, b;

    for (n=0; n<8; n++)
    {
        digitalWrite(Pin, LOW);
        pinMode(Pin, OUTPUT);
        delayMicroseconds(5);
        pinMode(Pin, INPUT);
        delayMicroseconds(5);
        b = digitalRead(Pin);
        delayMicroseconds(50);
        d = (d >> 1) | (b<<7); // shift d to right and insert b in most sig bit position
    }
    return(d);
}

void getCurrentTemp(char *temp)
{
  int HighByte, LowByte, TReading, Tc_100, sign, whole, fract;

  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0x44); // perform temperature conversion, strong pullup for one sec

  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0xbe);

  LowByte = OneWireInByte(TEMP_PIN);
  HighByte = OneWireInByte(TEMP_PIN);
  TReading = (HighByte << 8) + LowByte;
  sign = TReading & 0x8000;  // test most sig bit
  if (sign) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25

  whole = Tc_100 / 100;  // separate off the whole and fractional portions
  fract = Tc_100 % 100;

if(sign) temp[0]='-';
else temp[0]='+';

temp[1]= (whole-(whole/100)*100)/10 +'0';
//u temp[1]= 'a' ;
temp[2]= whole-(whole/10)*10 +'0';

temp[3]='.';
temp[4]=fract/10 +'0';
temp[5]=fract-(fract/10)*10 +'0';

temp[6] = '\0';
}

Sunday, February 5, 2012

Laboratory Power supply lm317 1.2 - 36 volt and current limiter 0 - 5 amps



The schematic for the lm317 based powersupply includes two PNP transistors to increase the power performance.

There is a fault on this schematic, the bd140 current limiter is connected wrong, i will make a new schematic latter.

You can make a shortcut protection circuit for this power supply also follow link




Saturday, February 4, 2012

EVduino-MS-08beta-Code

Version EVduino-MS08 beta will include: 

  • 4 pcs. Voltage sensors for 4 x 12 volt 
  • 1 pcs. Low current sensor 30 amps, measure car energy consumption, headlights, instrument lights and so. NOT electric heater and The DC engine 
  • 1 pcs. High current sensor 300-400 amps for engine consumption and electric heater 
  • Temperature sensor for the DC engines coil temperature, code piece for dallas ds18b20

Startup coding the EVduino-MS-08beta

Starup with the code using the 2,8" LCD example from nuelectronic, and modify this to fit my application.


I used a hole week trying to place mesured data in one of the black text boxes shown on above picture.

Well, i don't think i can be done with text_box_p. Text_box_p is used to place static strings as the 'Batteries' on the screen.

I found that another lib must be used to place variables, the font lib.

Command used:

font.putChar('y')

Example: 



The code:

void batteriesvoltage()
{
       //exampel place qwerty in the drawn RoundRect
        char i = 22;
        char sensorData[20] = "qwertyuiopasdfghjkl";
     
uint8_t row=0;

// draw font
tft.ClearScreen(WHITE);

tft.DrawRoundRect( 40, 70, 280, 230,  10, MENU_HIGHLIGHT_COLOR,1);

font.set_Font(f15x22);
font.set_Color(MENU_FONT_COLOR, MENU_NORMAL_COLOR,1);

font.set_Cursor( 50, 80);

for(i=0; i<23;i++) //loop until al chrs in sensorData is placed on the LCD display
          {
            font.putChar(sensorData[i]); //place the sensorData variable, sensorData come from a sensor as voltage sensor, current sensor, temperature sensor
         
if(font.CharWidth(i) !=0)
{
if( (font.CursorX + font.CharWidth(i)) > 270)
{
row++;
font.set_Cursor(50, 80+ (row* font.Font_Height + 2));
}    
}
 }

font.set_Font(f12x12); // set font to menu size
wait_for_OK();

}

Saturday, January 28, 2012

Power Supply variable with lm338

lm338 v.1 dual power supply

This lm338-v.1 power supply will be able to give something like two times 12- 36 volt and 2x5 amps (10 amps in the v.2 of this PSU witch includes transistors to get more current from the circuit). 

The trafos used are already able to deliver 2x 10 amps continua and 12 amps peak or so..

I use 2 x lm338 in V.1 but also lm317 can be used. I will use extra transistors to get the current up i V.2. Schematic will be equipped with current limit adjustable in steps, a current limiter with LED indicator, and i will try to find some way to make a reset able relay, than automatically disable output when short circuit or to high current drawn, Also i have some temperature sensible switches so power supply will shutdown at to high temperature on the cooling plates.

Basic DRAFT schematic from a test i made earlier.


Basic draft schematic of the dual lm338 PSU, without current limiter, short circuit protection and more

The cabinet with trafo'es, placed on my kewet electric vehicle bonnet.
The power supply is intend to be used to supply the EV when testing and adjusting lights and more optimization. No need to misuse the batteries ;)



Colling plates for the two lm338, and some pnp transistors like mj2955, or some sanken maybee



I use scraped knobs and gold plated banana plugs from a scraped nad 319 amplifier

At the side plate i have clued nappa leather


I do think this is a easy way to make functional test equipment. I will place 4 x led panel meters for voltage and amperes.


I use avery metal foil for laser printers to print the text for the front plate




 Frontplate with schorcut circuit rest, potmeters and output connectors


Shorcut protection circuit with relay in front between trafoes.




Links:

Current limit: high amp psu with current limiter 


Thursday, January 26, 2012

Reuse Scrapped VU meter as Voltage and Ampere meters

From scrapped HIFI equipment i saved two VU meters and wil use them as voltage and ampere meters for power supplyes. To messure ampere i use a pololu pcb with allegro's 30 amp hall effect linear current sensor.

In one VU meter they use two chips : LB1412 from sanyo



Specification for this chip:

  • Bar-shaped display of input level by means of 12 LEDs
  • High-order 5 dots with peak hold
  • Built-in oscillator for peak hold reset
  • Requires 1 pce. each of external C, R
  • Uses either oscillator at the time of stereo operation
  • Capable of also resetting manually
  • Capable of constant-current driving low-order 7 dots (green LED)
  • Constant-current value variable with an external resistor
  • Lower current drain available by connecting green LEDs in series
  • Built-in input amplifier
  • Requires no other light-up level adjustment than adjustment for 0 dB
  • D1 error: within ±3 dB of 20 dB
  • Supply voltage range : 10 to 16 V


In the other VU meter there is a also two chips: panasonic Dual 5-Dot LED Driver Circuit AN6888 and AN6888



AN6888/6889 is an IC driving 5 ´ 2-ch LED and is capable of logarithmic bar graph display for input signal.
Incorporating high gain rectification amp. enable to apply VU/Signal meter widely.

Because the output is the constant current pull-in type, the constant current value can be variable by external resistance. n Features


I am not sure what the difference is between the two types but i found a schematic:



Specification for this chipset:

  • Wide range of operating voltage : VCC (opr.) = 5V ~ 16V 
  • Power consumption can be reduced due to series connection of LEDs
  • Wide range of constant current : 5mA ~ 25mA
  • Built-in high gain amp. : GV = 26dB typ.



DC motor driver 9 ampere - 30 ampere peak

Found cheap PCB with ST VNH3SP30 motor driver IC It operates from 5.5 to 16 V and deliver continuous 9 Amps and 30 Amps peak! The PCB board offers built-in protection: against reverse-voltage, over-voltage, under-voltage, over-temperature, and over-current. I will check this PCB out some, maybee useful for my DIY electric bicycle http://www.pololu.com/catalog/product/705

Sunday, January 22, 2012

Arduino source code for StokerArduino v1.0

The project: pellet boiler datalogger v1.0 homepage is found here Arduino Pellet Boiler Data Logger v1 My Nerd Stuff

This is the code for the arduino only, you also need save.php to place on the (LAMP) webserver and if you wish to save data in thhe database the mysql must be setup properly to work. You can also choose to save data in a file only. This files name is data.txt.

Read more about how the ethershield i use works here: http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4

I will make a better descrribtion some day, with block diagram of how this works

Ressources

dallas ds18b20 codepiece and howto connect to arduino

EVduino-ms beta shield



The power supply with lm317 to protect EVduino from spikes in the EV





EVduino-ms beta optocoupler batteri voltage sensor




The beta version with standard 5% resistors, in final version use 1% or better.

I use 15K resistor inseries with the optocoupler LED and conect this direkt on the batteri (red and black wire).

The 3 pins behind the cny 17 runs trouh a double shielded cable to to EVduino-MS.

Between +5 volt and the cny17 opto's collector there is a pull up resistor 20K 1%.

The voltage of a lead acid battery are:

12,8 volt: fully charged
10,5 volt fully discharged

Other solutions for measuring battery voltage with arduino:

1 wire technology, DS2438 messure battery voltage AND battery temperature, great for LiFePo4 batteries in the EV http://www.maxim-ic.com/datasheet/index.mvp/id/2919

Also i will try to test a linear opto circuit found online before i deside how the final version shoulld be.

Saturday, January 21, 2012

Arduino based Electric Vehicle Monitoring System - The EVduino-MS

Arduino Electric Vehicle Monitoring System - the EVduino-MS-08b

  • Project start: 20 January 2012
  • Current version: 0.8 Beta
  • Project name: EVduino-MS
  • Licence and copyright: GPL open source
Update 23/1-2015: more about this kewet 2 electric vehicle

This Monitoring System is intend to be used in my KEWET 2 Electric Vehicle with 48 volt system voltage:


It can be used in all other Electric Vehicles. Just need to ad more opto voltage sensor circuits and make som more code. Also you need to make multiplexed analog input because there are only analog inputs for 14 batteries.

Block schematic looks something like this. This is preliminary version, you can't trust component values and more. Only made to tell something about the concept:



Project Status:
Main control unit:

DFRduino Mega 1280
2,8" LCD touch color monitor with onboard SD card reader
EVduino beta shield.
All build into 2  pcs. 7010 25 mm half box. The Size of one half box is: 123x70x26,1 mm.

I will make some kind of fancy front plate with some text on it, properly just 3 mm acrylic with silver laser label on it (avery L6013)

Connectors will be 3.5 mm jack gold, or a 25 pins sub-d gold connector or so.




Version 0.8 beta will include: EVduino-MS-08beta Arduino Code workbench 

Specifications DFRduino 1280:
  • Microcontroller ATmega1280
  • Operating Voltage 5V
  • Input Voltage (recommended) 7-12V
  • Input Voltage (limits) 6-20V
  • Digital I/O Pins 54 (of which 14 provide PWM output)
  • Analog Input Pins 16
  • DC Current per I/O Pin 40 mA
  • DC Current for 3.3V Pin 50 mA
  • Flash Memory 128 KB of which 4 KB used by bootloader
  • SRAM 8 KB EEPROM 4 KB
  • Clock Speed 16 MHz

Specifications for the 2,8" LCD touch color monitor:
  • The 2.8" TFT color LCD shield with touch screen interface
  • 320x240 screen resolution
  • 65K color space
  • touchscreen interfac
  • on-board AD7843 compatible controller
  •  SD card interface in SPI mode for external mass storage of photos and icons
  • Directly plug into Arduino Mega
  • Arduino software library included, also examples of graphic and font routines, touchscreen interface and calibration, and SD card (FAT filesystem) operation

Port usage:

Digital I/O Pins 54: 
  •   Digital ports 22 to 53 used by Touch screen, Lcd monitor and SD card
  •   PWM port 2 to 13 I/O provide PWM output, all free to use
Analog Input Pins 16:
  •   All 16 AD converters are free to use

The DFRduino Mega, Analog in 0 to 15 below at the picture and the free Digital I/O 2 to 13 With PWM on top left

The sensors and hardware:








High current sensor 300 Amps from http://www.mittnacht.net/




Temperature sensor one wire Dallas ds18b20, from sparkfun.comlet-elektronik.dkebay.co.uk and more 




Opto isolators cny17, from ebay.co.uk, or all around electronic stores



-------------------------------------------------------------------------------
The full 'Vision' is a version 2.0 of this Arduino EV monitor system EVduino-MS-Pro2

The pro2 version should include a professional print layout of the shield, build into a box. A finished, tested and adjusted Plug and Play box.

Also a DIY version could be made, i could call it version DIY-Pro2, incl. box with all hole made to it, components and more.

Sensors in The fully Pro2 developed version of the EV Monitor system:
  • up to 6 pcs. Voltage sensors for 6 x 12 volt battery packs
  • 1 pcs. current sensor 300 ampere, battery total
  • 6 pcs. battery temperature sensors
  • 1 pcs. engine coil temperature sensor
  • 1 pcs. indoor temperatur sensor
  • 1 pcs. outdoor temperature sensor
  • 1 pcs. tilt sensor for burgler alarm
  • 1 pcs. RFID chip sensor as carkey


Other features:

Blinking LED are automatically activated when a person with the 'carkey RFID' leave the car
Also a buzzer is connected as intern alert and alarm
Relay output to turn of lights and more automatically

Power supply:

Li Ion powered by Accessory power supply
Solar-charger with 30-60 watt solar-panel
Waist heat Thermoelectric Energy Generator charger (waist brake heat, engine heat and motor-controller heat)
remote on/off liquid fuelbased heater

Further adds to Arduino Monitoring system for electric vehicles:

* wifi connection to LAN
* webpage including graphs
* android app