Show Posts
Pages: 1 2 3 [4]
46  Using Arduino / LEDs and Multiplexing / Re: 8 x RGB LED Array on: November 12, 2012, 02:44:38 pm
So i have the hardware built,

I have the code written to take the CAN id and write it out to the PWM pins for Red, Green and Blue Brightness,

Now i need to figure how to get the 0-255 value i get on the first bit of the can message, to control the 8 LED pins in binary order, a bit like a counter,

I had been using byte
  • as the command for the PWM pins, i,e, analogWrite(3byte[3]0;

So it would be byte[1] for the pattern,

How do i do a simple binary output to the 8 led pins corresponding to the value in the CAN message?

Hope you can help guys
47  Using Arduino / LEDs and Multiplexing / Re: 8 x RGB LED Array on: November 11, 2012, 04:55:30 pm
Why would I to need to multiplex the cathodes? As if I wanted 3 greens on for example, I could simply activate the corresponding pins,

Yes that is exactly how the "pattern bit" should work,
So I have to find a way of relieving the pattern bit and turning that into the corresponding output.

Thanks so far
48  Using Arduino / LEDs and Multiplexing / Re: 8 x RGB LED Array on: November 09, 2012, 04:06:31 am
Here is a quick schematic of what i am proposing, the high and low side drive will need to be through power transistors,
attached.

As for the CAN code,

On Bit 1 of the CAN message i will recieve a value of between 00 and FF in HEX, being 0 to 255 in decimal as the Arduino recieves it from the CAN controller, or in binary   1111  1111

Each 1 represents an LED,
The binary addition of light values will reslt in one of the 255 possible LED patterns available with 8 LED,s
 
The LED's will be arranged in a straight line, and i am hoping that the LSB will correspond to the LED on the right hand end of the chain,

The main reason for this, is so that it will be a direct replacement for another existing product.


The can message will be as follows,

     Base ID, 023,     Data Length ,5,                                      (00,                     00,                      00,                          00,                          00,)

                                                                                     Pattern Bit       RED Brightness      Green Brightness         Blue Brightness            Enable, (always FF)

The RED, GREEN and BLUE, brightness channel will be simply read from the CAN message, and written to the Arduino PWM channels appropriately for different colours.

Hope this helps,

What do you think?
49  Using Arduino / LEDs and Multiplexing / Re: 8 x RGB LED Array on: November 08, 2012, 03:13:25 pm
The array needs to be multifunctional, for multicolour warnings, oil pressure, fuel pressure etc,

I had a thought of using common cathode led,s, connecting all reds to a own output for brightness, same for green and blue,

Then connecting each cathode to a digital output to pull low to activate each led as required,

Only a single colour or mix of colours in each led is required at a time,

From there, I need to find a way of turning a 0-255 value received over CAN  into the various combinations of led pattern?

Sound sensible?

Comments please guys,
Appreciate all help
50  Using Arduino / LEDs and Multiplexing / 8 x RGB LED Array on: November 08, 2012, 10:46:23 am
Hello All, i am looking at using 8 off RGB LED's as a shift light module in motorsport,

I am able to Recieve a CAN based message 5 Bits Long, i.e,   ( 00, 00, 00, 00, 00, 00 )

The first  bit, will controll the arrangement of the LEDS to illuminate, starting with the LSB being LED 1 and a binary addition to add further LED's in sequence,

Can anyone suggest a simple method of arraying 8 RGB led's and mapping an active sequence from 00 ( all off ) to 128 ( all on )

The brigtness of each colour will be controlled from the next 3 bits,

many thanks, and i will post results in the future,

Rich
51  Using Arduino / Networking, Protocols, and Devices / Re: CAN recieve template on: November 05, 2012, 11:34:17 am
Anyone?
52  Using Arduino / Networking, Protocols, and Devices / CAN recieve template on: November 01, 2012, 07:06:29 am
Hi all, i am looking for a simple CAN recieve sketch that i can modify, i have downloaded the one from the seeeduino site but its of no use as the code doesnt tally to the web desctiption, i am able to transmit fine but now need to encorporate a simple recieve and store procedure.
Ive looked through the ECU scanned codes available but none of it seems to have a simple recieve message and serial print function.

Hope someone can help.

Rich
53  Using Arduino / Networking, Protocols, and Devices / Re: Arduino CAN Controller Project on: October 10, 2012, 09:36:02 am
Hi there, also trying to do something similar, as a switch interface, to get a set of keypad switches onto the CAN Bus for an automotive application,

I have a power control module that will recieve CAN packets and turn on/off/pulse various outputs for body control on a motorsport vehicle.

I am writing the code for the various switch/keypad functions at the moment, and i have found some handy CAN info on the Wiki site for sending CAN packets out on the BUS, very simple to do,

Recieveing and decoding looks more difficult in their examples but i wi;ll stick with it and try to understand,

If anyone has some code or simple step by step explinations they would like to share i would be very interested to hear from them.

Rich
54  Using Arduino / Programming Questions / Re: Crank Signal Generator, Cant get below 10000uS in delay on: August 10, 2012, 09:10:59 am
Sorry, completely understand now, i must have muisread your post,

thanks smiley
55  Using Arduino / Programming Questions / Re: Crank Signal Generator, Cant get below 10000uS in delay on: August 10, 2012, 08:45:27 am
Hi Guys,
Sorry, maybe i have mislead you,

The issue i am having is not with the dsplay,
Only the last part of the code is doing the square wave output

I am using a scope to read the signal i am generating, i am happy with the display as it is.

This part of the code is what i am having issues with, the Constant long integer called "variable" is giving the gap between pulses in microseconds, changing the value to less that 10000 doesnt seem to speed up the frequency of the pulses.


thanks in advance,

i am new to the forum so apologies if my formatting isnt quite right yet



 unsigned long currentMicros = micros();            // Makes currentMicros = to microseconds since CPU start
 
    if(currentMicros - previousMicros > interval)
    {
      previousMicros = currentMicros;   
        i = i++;
     
      if (i < 72 )
      {
   
           ledState = !ledState;   
          digitalWrite(crankPin, ledState);
      }         
          if (i == 72 )
         
      {
              ledState2 = !ledState2;
              digitalWrite(camPin, ledState2);
             
      }
        if (i == 73 )
        ledState2 = !ledState2;
         digitalWrite(camPin, ledState2);
             
     
      if (i == 73)
     
      {
        i = 1;
       
      }
    }
 }

56  Using Arduino / Programming Questions / Crank Signal Generator, Cant get below 10000uS in delay on: August 10, 2012, 07:41:29 am
Hi All, i am having an issue with some code,
it is simplay putting out a square wave of 35 pulses with one missing one,
The missing one triggers the single cam shaft pulse.

The code works fine, but i dont seem to get any difference in speed below 10,000uS in gap between pulses.

I need to run from 800RPM to 8000RPM, with 36 events per revolution, thats a speed of 4800Hz

Am i runnign out of Processor capabilty to do this?

Code below

 */
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
float TPS1 = 0.0;
float TPS2 = 0.0;
int sensorValue = 0;



const int crankPin =  13;      // the number of the LED pin //crank pulse
const int camPin = 6;         // the number of the LED pin  // cam pulse

int ledState = HIGH;            // ledState used to set the LED
int ledState2 = LOW;           // ledState used to set the LED

unsigned long previousMicros = 0;
unsigned long interval = 5000;
unsigned long previousTime = 0;
int i = 0;


void setup() {
  Serial.begin(9600);
 pinMode(crankPin, OUTPUT);  // Sets Pin 13 as Digital Output
 pinMode(camPin, OUTPUT);    // sets Pin 6 as digital Output
 lcd.begin(20,4);
 
}

void loop()
{
  sensorValue = analogRead(A0);
  TPS1 = (sensorValue*5.0)/1024.0;
  Serial.println(TPS1,2);
 
  sensorValue = analogRead(A1);
  TPS2 = (sensorValue*5.0)/1024.0;
  Serial.println(TPS2,2);
 
 
  lcd.setCursor(0,0);
  lcd.print ("TPS1");
  lcd.setCursor(0,1);
  lcd.print ("TPS2");
 
  lcd.setCursor(5,0);
  lcd.print(TPS1,2);
  lcd.setCursor(5,1);
  lcd.print(TPS2,2);
 
    lcd.setCursor(9,0);
  lcd.print ("V ");
  lcd.setCursor(9,1);
  lcd.print ("V");
 
 
  lcd.setCursor(0,2);
  lcd.print ("CRANK ");
  lcd.setCursor(0,3);
  lcd.print ("CAM");
 
 
   
   


     unsigned long currentMicros = micros();            // Makes currentMicros = to microseconds since CPU start
 
    if(currentMicros - previousMicros > interval)
    {
      previousMicros = currentMicros;   
        i = i++;
     
      if (i < 72 )
      {
   
           ledState = !ledState;   
          digitalWrite(crankPin, ledState);
      }         
          if (i == 72 )
         
      {
              ledState2 = !ledState2;
              digitalWrite(camPin, ledState2);
             
      }
        if (i == 73 )
        ledState2 = !ledState2;
         digitalWrite(camPin, ledState2);
             
     
      if (i == 73)
     
      {
        i = 1;
       
      }
    }
 }

Pages: 1 2 3 [4]