Show Posts
Pages: [1] 2
1  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 19, 2012, 06:51:33 am
I still think they're the problem, not the MOSFETs. The cathodes all seem to be joined together when they arrive at a MOSFET, Is it possible that charge from the capacitor is leaking into other LEDs via. that junction? If so you need to put more diodes in there to prevent it.

If you want smaller capacitances in your MOSFETS you probably have to use smaller ones. T220 MOSFETS have a big chunk of silicon inside them so capacitance is always an issue. You can try something like a VN1206L which comes in a T0226.

An oscilloscope would solve this mystery far, far faster than debating in forums...


You are correct. I need a diode in the cothode as well to completly isolate each led. This seems to solve the problem.
2  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 18, 2012, 04:38:08 pm
Quote
It would take about 8.2ms just to put the data to the column shift registers plus the time i need to get that data from the other arduino
(an other 8.2ms at best) which kinda limits my refresh rate.

I am not sure how your have structured your hardware but it takes about 0.1ms to shift a byte into a HC595, on a 1MIPS AVR, and much faster if you use hardware spi.

To drive 64 leds, you need to shift at most two bytes and that should be no more than 0.2ms, and likely much lower than that if you are running your chip at 16MIPS.

As fungus has pointed out, your hardware doesn't make a whole lot of sense to me and you may want to rethink how you approach the whole thing.


its 64x64=4096 leds
3  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 18, 2012, 04:34:37 pm
First you have to figure out what the problem is.

The problem is that the MOSFETs take more time than they should to turn on and off thus leds that should not light up do so.

What are the capacitors for?
for exactly that
It looks to me like they might be keeping the LEDs lit up for a short time after your MOSFET switches off.

Why do you write to the output ports multiple times?

Ignore it. It has no impact on my problem whatsoever
4  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 18, 2012, 01:27:17 pm
Two arduinos one has an ethernet shield and gets the state of each led from a website.
The other acts as a display controller refreshing the screen and geting the state of each led from the other arduino.

The actual screen is 64x64 leds. Each led is a standar 5mm 20mA variant. The actual refresh rate does not matter
but it must not seem to flicker or turn off-on while the arduino updates the screen from the other arduino.
The reason why i put the capacitor-resistor-diode is so that each led can remain on even after i have refreshed the screen.
Additionaly without the capacitor each led would output about 1/64th of the nominal light. With the capacitor i can get them to full brightness.

It would take about 8.2ms just to put the data to the column shift registers plus the time i need to get that data from the other arduino
(an other 8.2ms at best) which kinda limits my refresh rate.


Or different MOSFETs. Get some that are designed for switching at 5V logic levels.

Do you have any particular in mind? All i find have 500-1600pF at 5Vgs. Gate capacitance is proportional to the current capability of the mosfet.
5  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 18, 2012, 09:22:29 am
MOSFETs have internal capacitance, some more than others, see your datasheet.

OTOH I'd suspect all those capacitors in your circuit before the MOSFETs. What exactly are they for? It looks to me like they might be keeping the LEDs lit up for a short time after your MOSFET switches off.



yeah acording to the datasheet its about 1400pF at 5Vgs. The more i read about it the more i think i need mosfet drivers to drive the actual mosfets

Precisely
6  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 18, 2012, 08:36:20 am
Why are you writing the same value to port D over and over again?

Your mosfets are designed for 10V gate drive, so they may not turn on fully with 5V from the Arduino, unless you are using drivers that are not shown in your schematic.
I am trying to "simulate" how much time its needed to refresh the entire screen. Final design will have 8x8bit shift registers for rows and columns.

Problem is not the turn on (i think they can get to at least 1 amp) but the turn off. They seem to be too slow. Would a MOSFET driver such as this one help?

For fast transients, capacitors appear to be shorts.

I see your point but they also help provide a more consistent current to the LEDs so that they dont apear to be dimmed .

7  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 17, 2012, 10:14:00 am
Where exactly?
8  Using Arduino / LEDs and Multiplexing / Re: Fast switching of Power MOSFETs on: October 17, 2012, 09:32:24 am
Yeah sorry i posted the wrong schematic.
This should be correct.
9  Using Arduino / LEDs and Multiplexing / Fast switching of Power MOSFETs on: October 17, 2012, 09:12:32 am
Hi i am trying to do a buffered (Capacitor) multiplexed LED screen.

I am using MOSFETs to drive the Anodes and Cathodes (IRF9640 and IRF930 respectivly). The problem that i have is that some LEDs dimly light up unless i put a 35μs delay between the anode switch. I suspect that it's the MOSFETs not having enough time to turn off? Shouldn't MOSFETs turn on-off times be at 100s of nanoseconds?

I have attached the schematic.


Code:
/*
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(2, OUTPUT);    
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {

  
  for (int i=2;i<64;i++) {
    PORTD = B01010100;
    PORTD = B01010100;
    PORTD = B01010100;
  }
  delayMicroseconds(200);
  clear();

  
  for (int i=2;i<64;i++) {
    PORTD = B10101000;
    PORTD = B10101000;
    PORTD = B10101000;
  }
  delayMicroseconds(200);
  clear();
  
  
  //Final Screen will be 64x64
  for (int i=2;i<64;i++) {
    for (int i=2;i<64;i++) {
      PORTD = B11110000;
      PORTD = B11110000;
      PORTD = B11110000;
    }
    delayMicroseconds(200);
    clear();
  }
}

void clear () {
  PORTD = B11110000;
  delayMicroseconds(35);
}
10  Using Arduino / Project Guidance / Re: millis() overflow when? (UNO+22) on: April 10, 2011, 12:20:55 pm
To answer the questions regarding the accuracy of the internal oscilator
My little arduino lost 49sec for a run of 2days 17:23:49 so with my calculations it looses 1 sec every 4804 sec which translates to around 1 hour and 20 min and 208ppm

I have upgraded the the code for this project. It can also operate as a Stopwatch Timer and a Countdown Timer with adjustable start times.

I will post the code as soon as I finish the project.
11  Using Arduino / Project Guidance / Re: millis() overflow when? (UNO+22) on: March 20, 2011, 01:17:15 pm
Yeah it is four pin for the data but there arent many spare outputs left cause in some other projects which I use the same LCD  I have the ethernet Shield pluged in. I should propably update only the parts of the screen that i need but lcd.cursor is slower than printing a single character.... but for the running/paused timer status I will have to figure something more efficient.
12  Using Arduino / Project Guidance / Re: Dual seven segment display on: March 20, 2011, 06:36:26 am
This is my code for a multiplexed 3 digit 7 segment display almost same wiring to the schematic by Leon Heller just for three digits and without any resistors/transistors.

NumPrint () Translates each number to segments that need to be on and the ones that need to be off.
SegmentWrite () handles the lighting for each segment on the current digit.
Cursor () selects the digit.
UpdatePrint () prints the '-' symbol in all digits. Application specific you shouldnt need it.

You need to know what pin corresponds to which segment + the pins for each digit.

Basicaly LEDs that are off are reversed polarized and the ones that are on are correctly polarized. This is why you select the digit with the LOW value and the on segments with a HIGH value.


Code:
void setup() {
  firstdigit =1;
  seconddigit = 2;
  thirddigit = 3;
}

void loop()
{
  Print ();
}

void Print () {
  Cursor(1); NumPrint(firstdigit);
  Cursor(2); NumPrint(seconddigit);
  Cursor(3); NumPrint(thirddigit);
}

void UpdatePrint() {
  Cursor(4);
  SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,LOW);
}

void NumPrint (int number) {
  switch ( number )
      {
         case 0:
            SegmentWrite(LOW,LOW,LOW,LOW,LOW,LOW,HIGH);
            break;
         case 1:
            SegmentWrite(LOW,HIGH,HIGH,LOW,HIGH,HIGH,HIGH);
            break;
         case 2:
            SegmentWrite(HIGH,LOW,LOW,LOW,LOW,HIGH,LOW);
            break;
         case 3:
            SegmentWrite(LOW,HIGH,LOW,LOW,LOW,HIGH,LOW);
            break;
         case 4:
            SegmentWrite(LOW,HIGH,HIGH,LOW,HIGH,LOW,LOW);
            break;
         case 5:
            SegmentWrite(LOW,HIGH,LOW,HIGH,LOW,LOW,LOW);
            break;
         case 6:
            SegmentWrite(LOW,LOW,LOW,HIGH,LOW,LOW,LOW);
            break;
         case 7:
            SegmentWrite(LOW,HIGH,HIGH,LOW,LOW,HIGH,HIGH);
            break;
         case 8:
            SegmentWrite(LOW,LOW,LOW,LOW,LOW,LOW,LOW);
            break;
         case 9:
            SegmentWrite(LOW,HIGH,LOW,LOW,LOW,LOW,LOW);
            break;
         case -1:
            SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,HIGH);
            break;
         default:
            SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,LOW);;
      }
}

void SegmentWrite(bool a,bool b,bool c,bool d,bool e,bool f,bool g) {
  digitalWrite(0, a);
  digitalWrite(1, b);
  digitalWrite(2, c);
  digitalWrite(3, d);
  digitalWrite(4, e);
  digitalWrite(5, f);
  digitalWrite(6, g);
}

void Cursor(int CurPos) {
  delay (1);
  SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,HIGH);
  switch ( CurPos )
    {
      case 1:
        digitalWrite(7, LOW);
        digitalWrite(8, HIGH);
        digitalWrite(9, LOW);
        break;
      case 2:
        digitalWrite(7, LOW);
        digitalWrite(8, LOW);
        digitalWrite(9, HIGH);
        break;
      case 3:
        digitalWrite(7, HIGH);
        digitalWrite(8, LOW);
        digitalWrite(9, LOW);
        break;
      case 4:
        digitalWrite(7, HIGH);
        digitalWrite(8, HIGH);
        digitalWrite(9, HIGH);
        break;;
    }
}
13  Using Arduino / Project Guidance / Re: millis() overflow when? (UNO+22) on: March 20, 2011, 06:15:18 am
Thank you all for your answers smiley
I dont think I will deal with overflow because 49 days is already an overkill for a timer.Plus I will let Arudino run for a day and measure its drift with my ntpd server.

I did some profiling though. By simply counting how many millis() it takes to complite a loop() i arived at the conclusion tha writting to the LCD is VERY slow.
This two take roughly 4ms to complete
Code:
    lcd.setCursor(8, 0);
    lcd.print("Running ");

and these two onother 5ms (sprintf takes no time)

Code:
    sprintf(out, "%.2ud%.2u:%.2u:%.2u.%.2u",days,hours,minutes,seconds,millisec);
   
    lcd.setCursor(1, 1);
    lcd.print(out);

The rest of the code is way too fast to be counted by millis total ~9ms.
14  Using Arduino / Project Guidance / Re: millis() overflow when? (UNO+22) on: March 18, 2011, 12:30:38 pm
That was fast smiley
Thanx so i should propably change my code to include days.
15  Using Arduino / Project Guidance / millis() overflow when? (UNO+22) on: March 18, 2011, 12:25:51 pm
Hallo,
i wanted to make a timer with my LCD so i drafted an early scetch to test its practicality. From general reading on the old forum I was 99% certain that arduinos millis() function would overflow every 9.5 hours or so but mine is still correctly counting for the last 23 hours.

This is the scetch from 0022 IDE running on an UNO

Code:
#include <LiquidCrystal.h>

extern volatile unsigned long timer0_millis ;

unsigned long currentTime;

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

char out[17] ="";

void setup() {
  lcd.begin(16, 2);
  lcd.print("Timer");
  pinMode(9, OUTPUT);
  analogWrite(9, 40);
 
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
}

void reset () {
  timer0_millis = 0UL;
}

void loop() {
  if (!digitalRead(A0)) {
    currentTime=millis();
    //unsigned long days    =currentTime / 86400000;
    unsigned long hours   =currentTime % 86400000 / 3600000;
    unsigned long minutes =currentTime % 86400000 % 3600000 / 60000;
    unsigned long seconds =currentTime % 86400000 % 3600000 % 60000 / 1000;
    unsigned long millisec=currentTime % 86400000 % 3600000 % 60000 % 1000 / 10;
   
    sprintf(out, "  %.2lu:%.2lu:%.2lu.%.2lu", hours, minutes, seconds,millisec );

    lcd.setCursor(0, 1);
    lcd.print(out);
    lcd.setCursor(8, 0);
    lcd.print("Running ");
  } else {
    timer0_millis = currentTime;
    lcd.setCursor(8, 0);
    lcd.print("Paused  ");
  }
 
  if (digitalRead(A1)) {
    timer0_millis = 0UL;
  }
}

So when does the millis() function overflows?
Pages: [1] 2