Show Posts
Pages: 1 [2] 3 4 ... 9
16  Using Arduino / LEDs and Multiplexing / make pwm output non linear on: December 07, 2012, 10:33:09 am
Non sure if I'm phrasing this well, but is there a way to take a pwm signal to drive an led, and using external components, introduce a non linear curve into the effective current that flows through an led?

The desire is to apply gamma correction to a dimmable led setup, but I dont' want to do it in software, as there is not enough resolution in 8bits to have a smooth 'bottom end' when using this (ie lookup table on arduino) method.

So basically, is there a hardware way to allow me to make more use of those precious 8 bits?
17  Using Arduino / LEDs and Multiplexing / Re: constantcurrentiness on: November 28, 2012, 06:27:15 am
Thanks Grumpy.  All made sense and I got it working.

A thought though -  When using led strip like https://www.sparkfun.com/products/10259  Is a constant current driver not the best solution? I've configured a driver circuit to work with a particular length of strip, but now if I want to use a different length, requiring a different current, I'd need to change the value of the current setting resistor.  Is this correct?

If so, is this a situation when a constant voltage circuit is more suitable?
18  Using Arduino / LEDs and Multiplexing / constantcurrentiness on: November 15, 2012, 12:02:09 pm
I'm trying to understand the circuit in figure 12, on page 6 of this data sheet - http://www.onsemi.com/pub_link/Collateral/NSI45090JD-D.PDF

'Dimming using PWM'

I want to use this constant current led driver with a ws2801 pwm driver (also cc) to allow me to control higher power leds with the ws2801, while retaining constant current functionality. I'm loaded with questions -

- What are the two resistors doing in this circuit, and how do I calculate their value?

- Am I right in thinking that while I can have an arbitrarily long chain of leds by supplying sufficient voltage, the maximum current through those leds (and therefore the ccr driver) can be 160mA?

- If need more current capacity than this, I see I can use 2 ccrs in parallel, which presumably will double this to 320mA.  What is figure 11 illustrating then with the use of a resistor on one ccr?  Is it used to set the max current to some value betwwen 160 and 320mA?

- If I need still more current than this, is there a better product or technique I could use? (bearing in mind the source is a pwm signal)

Thanks!
19  Using Arduino / LEDs and Multiplexing / Re: How did this guy daisy chain the tlc5940 over a long wire? on: November 15, 2012, 11:32:42 am
The RS485 chips are easy to use. No microcontroller communication required.

I've used these recently - http://uk.rs-online.com/web/p/line-transceivers/7327958/

They just need 5v, gnd, and the data signal input.  This outputs a balanced signal pair which goes down a twisted pair cable.  The same chip can receive this signal and convert it back into the original unbalanced data.

I've tested over >120m of cat5 but apparently you're good for >1000m
20  Using Arduino / Programming Questions / Re: libraries folder structure on: October 26, 2012, 07:54:57 am
Ok thanks.  This doesn't solve the nesting problem though
21  Using Arduino / Programming Questions / libraries folder structure on: October 26, 2012, 05:49:14 am
Hey.

I'm trynig to work out a good way of organising external libraries so they are easy to move to a new version of arduino, and so the example sketches are easy to browse.

Is it possible to specify a custom location to contain external libs?  This would make it easy to keep libs in one place and point a new arduino version to that folder.

Failing that, and something that is useful anyway, is to group the libs in categories.  This works in the example browser, and subfolders will create nice nested groups to make it easy to navigate to an example sketch within the ide.  However, when trying to compile one of these examples that has been nested, the library files will not be found (eg DmxSimple.h). Is this a bug?  Or something up with my installation?

Cheers
22  Using Arduino / Networking, Protocols, and Devices / Re: artnet to dmx project. memory issues? on: September 04, 2012, 04:29:13 am
The fix for me was to use an arduino mega
23  Development / Other Software Development / Re: Visual Micro Installation on: August 01, 2012, 09:24:35 am
http://www.visualmicro.com/page/Offer-Visual-Studio-Professional-Free-For-3-Years.aspx
24  Using Arduino / Project Guidance / Re: questions about chaining RGB LED+servo modules using WS2801 chips.. control? on: June 25, 2012, 07:55:43 am
Hi. I had the same problem. Seems the UNO can't handle the volume of data. The Mega works fine though
25  Using Arduino / General Electronics / Re: arduino - low power relay, without transistor on: June 20, 2012, 06:23:04 am
made 300 of those boards and I had to "Eat" them.

Ouch, that's got to hurt.


I found and bought one of these - http://uk.rs-online.com/web/p/solid-state-relays/5356314/ 

Works really well, and only draws ~8mA, straight from an arduino pin
26  Using Arduino / General Electronics / arduino - low power relay, without transistor on: June 19, 2012, 01:09:26 pm
Is this ok to do (digital pin straight to relay coil), as long as the switching coil needs no more than 200mW @ 5V?

Presumably a 5v diode is still necessary?

thanks
27  Using Arduino / Project Guidance / Re: questions about chaining RGB LED+servo modules using WS2801 chips.. control? on: June 18, 2012, 06:17:14 am
No worries. Note that I'm using an arduino Mega.  I know some people have had success with the UNO and artnet, but not me.
28  Using Arduino / Project Guidance / Re: questions about chaining RGB LED+servo modules using WS2801 chips.. control? on: June 18, 2012, 05:32:39 am
from http://forums.adafruit.com/viewtopic.php?f=47&t=24256

Quote
These figures are strictly I/O time and don't include any overhead for calculating the pixel image. Thus your actual speed will be somewhat less, depending on the complexity of the rendering code involved.

Original library using digitalWrite:
1000 + 470 microseconds per LED
(For 150 LEDs, about 14 frames/second)

Revised library with direct PORT writes:
1000 + 130 uS/LED
(~ 50 FPS)


Revised library using hardware SPI:
1000 + 17 uS/LED
(~280 FPS)

the one in bold is for soft spi. so given that artnet will limit you to 512 leds you should be ok!
29  Using Arduino / Project Guidance / Re: questions about chaining RGB LED+servo modules using WS2801 chips.. control? on: June 18, 2012, 05:25:25 am
That's because the hardware spi is used by the ethernet shield.  soft spi seems to work fine. I can't remember what the clock speed is but it's possible you'd notice it affect the update speed if you had loads of led chained but I doubt it.

  How many do you plan to use?
30  Using Arduino / Project Guidance / Re: questions about chaining RGB LED+servo modules using WS2801 chips.. control? on: June 18, 2012, 04:34:27 am
Are you using ws2801 or ws2803?

If so, you're in luck. It's all working. Though only working reliably with a Mega2560.

Think this is working code. Let me know if you have any questions.

Needs this lib -https://github.com/adafruit/Adafruit-WS2801-Library

Code:

//----WS2801
#include "Adafruit_WS2801.h"

int dataPin  = 6;    // WS2801 Data
int clockPin = 7;    // WS2801 Clock
Adafruit_WS2801 strip = Adafruit_WS2801(16, dataPin, clockPin); //Configure WS2801 as follows: (number of ws2801, dataPin, clockPin)


//----Artnet
#include <SPI.h>         // needed for Arduino versions later than 0018
#include <Ethernet.h>
#include <EthernetUdp.h>         // UDP library from: bjoern@cs.stanford.edu 12/30/2008
#define short_get_high_byte(x) ((HIGH_BYTE & x) >> 8)
#define short_get_low_byte(x)  (LOW_BYTE & x)
#define bytes_to_short(h,l) ( ((h << 8) & 0xff00) | (l & 0x00FF) );
#define UDP_PACKET_MAX_SIZE 2048



// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x03, 0x65 };
IPAddress ip(2,0,0,101);

unsigned int localPort = 6454;      // local port to listen on

//customisation: edit this if you want for example read and copy only 4 or 6 channels from channel 12 or 48 or whatever.
const int number_of_channels=512; //512 for 512 channels
const int channel_position=1; // 1 if you want to read from channel 1

// buffers for receiving and sending data
char packetBuffer[UDP_PACKET_MAX_SIZE]; //buffer to hold incoming packet,
byte buffer_dmx[number_of_channels+channel_position]; //buffer to store filetered DMX data

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;



// art net parameters
const int art_net_header_size=17;
const int max_packet_size=576;
char ArtNetHead[8]="Art-Net";
char OpHbyteReceive=0;
char OpLbyteReceive=0;
short is_artnet_version_1=0;
short is_artnet_version_2=0;
short seq_artnet=0;
short artnet_physical=0;
short incoming_universe=0;
boolean is_opcode_is_dmx=0;
boolean is_opcode_is_artpoll=0;
boolean match_artnet=1;
short Opcode=0;





//SETUP
void setup() {
 
//----WS2801
  strip.begin(); //Initialize WS2801 'strip' (WS2801 chips in a chain)
  strip.show(); // Update LED contents, to start they are all 'off'
 
//----Artnet 
// start the Ethernet and UDP:
  Ethernet.begin(mac,ip);
  Udp.begin(localPort);

  Serial.begin(57600);
 
//  pinMode(6, OUTPUT); // setup pin 6 as output to test an artnet channel with an led
}




//MAIN LOOP
//----Artnet
void loop() {
  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  if(packetSize)
  {
    //debug(packetSize); // uncomment this line to show packet info in serial monitor
  Udp.read(packetBuffer,UDP_PACKET_MAX_SIZE);
  //read header
  match_artnet=1;//valeur de stockage
  for (int i=0;i<7;i++)
     {
      if(char(packetBuffer[i])!=ArtNetHead[i])
      {match_artnet=0;break;}//if not corresponding, this is not an artnet packet, so we stop reading
     }
     if (match_artnet==1)//if its an artnet header
     {
       /*artnet protocole revision, not really needed
       is_artnet_version_1=packetBuffer[10];
       is_artnet_version_2=packetBuffer[11];*/
   
       /*sequence of data, to avoid lost packets on routeurs
       seq_artnet=packetBuffer[12];*/
       
       /*physical port of  dmx N°
       //artnet_physical=packetBuffer[13];*/
       
       //operator code enables to know wich type of message Art-Net it is
       Opcode=bytes_to_short(packetBuffer[9],packetBuffer[8]);
       
       if(Opcode==0x5000)//if opcode is DMX type
       {
         is_opcode_is_dmx=1;is_opcode_is_artpoll=0;
       }   
         
       else if(Opcode==0x2000)//if opcode is artpoll
       {
         is_opcode_is_artpoll=1;is_opcode_is_dmx=0;
         //( we should normally reply to it, giving ip adress of the device)
       }
   
       if(  is_opcode_is_dmx=1)//if its DMX data we will read it now
       {
         //if you need to filter DMX universes, uncomment next line to have the universe rceived
         //incoming_universe= bytes_to_short(packetBuffer[15],packetBuffer[14])
       
         //getting data from a channel position, on a precise amount of channels, this to avoid to much operation if you need only 4 channels for example
         for(int i=channel_position-1;i< number_of_channels;i++)//channel position
         {
           buffer_dmx[i]= byte(packetBuffer[i+18]);
           //note that channels are zero based, ie the first channel is buffer_dmx[0]
         }
       }
     }
  }
 
 
 
//----WS2801
    for(int i=0;i<512;i++)//channel position
      {
          strip.setPixelColor(i,buffer_dmx[i*3],buffer_dmx[i*3+1],buffer_dmx[i*3+2]);
      }
     
     
     strip.show();
     
 
//analogWrite(6,buffer_dmx[0]);  // test channel 0 with an led on pin 6
 
}//end MAIN LOOP








//debug method
int debug(int packetSize)
{
  Serial.print("Received packet of size ");
    Serial.println(packetSize);
    Serial.print("From ");
    IPAddress remote = Udp.remoteIP();
    for (int i =0; i < 4; i++)
    {
      Serial.print(remote[i], DEC);
      if (i < 3)
      {
        Serial.print(".");
      }
    }
    Serial.print(", port ");
    Serial.println(Udp.remotePort());
    delay(10);
}
Pages: 1 [2] 3 4 ... 9