Show Posts
Pages: [1] 2
1  Using Arduino / Project Guidance / Re: Sound Reactive Multi-Mode LED project on: December 17, 2013, 11:41:18 am
I Can post A picture of the Circuit diagram If it helps!
2  Using Arduino / Project Guidance / Sound Reactive Multi-Mode LED project on: December 16, 2013, 05:45:07 am
Hello All!

I am currently trying to develop a project for use in Cars to control LED's for interior use (Footwell Lights Etc)

Currently I have built a circuit that gives me control of a 12v LED output through a regulated 5v ATTINY microcontroller (Programmed with arduino of course)

As it stands currently, I have also managed to get simple LED sound reactive control Through an aux input with a TIP31C transistor. My dilemma is when i come to combine the two projects.

Would anyone be able to advise if there is any possibility of adding sound reactive control to the ATTINY? If so would i still need the TIP31 transistor?

I am also looking to convert this project to surface mount to save space... If there are surface mount versions of the TIP31C that would be ideal!

Thanks In advance for all your help!

Regards;
Al
3  Using Arduino / Project Guidance / Controlling Servos With XBox Wireless Controller Through Arduino? Xbee? on: November 21, 2012, 09:05:39 am
Hey Guys, I am getting involved in a project in which I need to control about 5 or 6 different servos/motors wirelessly.
We have decided that Arduino Is a good way to get everything working, and we want it to be controller by a wireless xbox controller interface.

So far, from what I have gathered, I will need to use the following method:

XBox controller
 >>>>>Wireless>>>>>>
Xbox wireless reciever for PC
>>>>>>Wire>>>>>
Laptop
>>>>>Wire>>>>>>
Xbee Transmitter
>>>>Wireless>>>>>>
Xbee Reciever
>>>>>Wire>>>>>>
Arduino Uno
>>>>>Wire>>>>>>
SERVOS

I am not 100% that this is the correct way to do it so I am asking for some advice.

1: WIll this method Work?
2: How do I convert the signal from the xbox reciever through the laptop to arduino outputs through the Xbee
3:How do I map the buttons to control the servo I want it to?

I really appreciate any assistance with this and I will upload Pics of the Project in progress once I have decided how it is going and got the components in.
Thanks"!

4  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: June 02, 2012, 07:06:17 pm
Are you sure you have the pin designations right?

Really sorry about that, It did work I just tried it again.. Turns out I forgot to set my arduino as isp before re-programming the ATTiny!
D'oh!

All works great now, I really appreciate all your help... Now to try and solder the circuit into a proto shield smiley-grin
I'll upload some pics of the finished product, And If I do end up getting some Pcb's made up, I'll be sure to contact you as I'll give you one as a thankyou! (Plus the components! smiley-razz )

5  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: June 01, 2012, 04:15:56 pm
No Dice! smiley-sad
6  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: June 01, 2012, 12:38:14 pm
Code:
// TURNS ON LED WHEN THE BUTTON IS PRESSED
// Includes Debouncing
// If button is held, Brightness changes

const int LEDS = 9; //Led pin
const int BUTTON = 7; // Input for button

int val = 0; //Stores value of button

int old_val = 0; //Stores previous value of button
int state = 0; // = LED off 1 = LED on

int brightness = 128; //Stores brightness
unsigned long startTime = 0; //When did we begin pressing?

void setup() {
  pinMode(LEDS,OUTPUT); //Sets Leds as output
  pinMode(BUTTON,INPUT); //Sets button as input
}

void loop() {
  val = digitalRead(BUTTON); // Reads button and stores
  if((val == HIGH) && (old_val == LOW)) {
    state = 1 - state; //Changes state of button
   
    startTime = millis();
    delay(10);
  }
  if ((val == HIGH) && (old_val == HIGH)) { //if the button is held for more than 500ms
  if (state == 1 && (millis() - startTime) > 500) {
    brightness++;
    delay(10);
   
    if (brightness > 255) {
      brightness = 0;
    }
  }
  }
 
  old_val = val; //Store new value
 
  if (state == 1) {
    analogWrite(LEDS, brightness); //Turn the LED ON at current brightness level
  } else {
    analogWrite(LEDS, 0); // Tun LED OFF
  }
}
7  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: June 01, 2012, 12:12:01 pm
You'd need a transistor to drive the relay, so no, do not ditch the transistor.  It's just fine.

In this circuit, the input at pin2 goes low when the button is pressed, and from what I can see that looks correct.  Does the code expect the input to be active low or high?

Right, The code waits for the button input to be high, so I think that's where the problem could be... I can paste the code if you need?
And I really appreciate your help on this by the way! smiley-grin
8  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: June 01, 2012, 10:48:22 am
Oops! Forgot to paste the links! :L Sorry!

9  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: June 01, 2012, 09:56:08 am
Finally got the last of the components for this today, and I just built a breadboard circuit. It works... BUT It's working as if it's reading the reverse of the button, eg it thinks its being pressed when its not, and when its not being pressed it thinks it is!
Because I have it set to a momentary press to turn on/off, that bit is not affected due to a simple state change in the program, But what it does is it stays on and changes brightness as if you are holding the button! :S I think I have wired it up correctly... Here's a photo of my breadboard circuit... Can you spot anything i've done wrong? I have double checked! :L
And as regards to the circuit schematic, thanks for the offer that is very kind of you, but i'll have an attempt at it in KiCad then post it here for you guys to double check smiley-razz

Cheers again,
Al
10  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: May 29, 2012, 07:18:00 pm
Hey guys, Thanks for all the help...
BillO that looks like a KI cad shcematic!? smiley-razz
I was hoping to get a couple of mini pcb's produced to make the finish more professional and tidy, I was wandering if you could send me the KI cad files for that schematic so I can convert it to a PCB layout?
That would be awesome! smiley-grin
I have just ordered the specific components you stated, so I'll breadboard a circuit when I get them in the post and If it all works I'll send off for a pcb or two! (I could send you one if you like, as a thankyou for helping?)
Anyway... let me know! smiley-grin
¬Al
11  Using Arduino / General Electronics / Re: Using 5v To switch 12v supply? (ATtiny in car use) on: May 22, 2012, 08:52:19 am
Thanks for the replies,
The Forward Voltage is 12v
The Forward Current 20mA
More info here : http://www.phenoptix.com/index.php/led-tape/blue-12v-led-strip-5cm-smd-leds-flexible-tape.html
I believe That If I use an LM317 Voltage Regulator with Resistor values of R1= 330 Ohms And R2 = 1kOhm I can get a moderately accurate 5.04v Supply to the ATtiny.

As for the transistor, I'm still confused But I have been told I can use an NPN 2N3904 General Purpose tranistor with specific resistors to do this, not entirely sure how though as I effectively need two inputs (12v Supply for the LED Strips, and 0 - 5V Variable supply from the ATTiny ouput pin) with one output to the LED's that varies relatively to the ATTiny.
I know this is possible due to a transistor obviously being and acting as a transforming resistor; effectively raising the voltage but keeping the proportions.. A bit more help would be appreciated! smiley-grin

And as for the Resistors on the LED's, the 12v Strips I am using have built in SMD resistors.
12  Community / Local Groups / Re: South West UK on: May 21, 2012, 04:21:58 pm
Bridgwater

YES! Same haha! Know of anything local? <30 mins driving distance?
13  Using Arduino / General Electronics / Using 5v To switch 12v supply? (ATtiny in car use) on: May 21, 2012, 02:17:33 pm
Hi guys, This is a tricky one that has me confused!

Basically I have used my arduino to program a little ATtiny85 that turns On/off Supply to a pin (LED's to be attached) With the function of being able to adjust the brightness by holding the button down (As explained in getting started with arduino book example 5).

I have it all working to the stage where I can turn on and off and vary brightness of some 3v led's without the use of resistors, BUT I designed the circuit for use in my car where I wanted to use 12v LED strips. The input voltage for the ATtiny is 3.2 - 5.5 V so I will have to use a voltage regulator to limit that (I forgot how to do this exactly to what I need! smiley-razz) . The problem arises where I am not sure if it is possible to effectively Upscale the voltage from the pin to 12v (Whilst still being able to adjust voltage to vary brightness) Or to use the ATtiny's output to effectively switch on and alter the 12v supply seperately.
I think it may be possible with some kind of transistor but this one truly has me confused!

That probably sounded like a load of nonsense so I professionally made up a BS8888 Standard Engineeirng drawing for you below smiley-wink (The wonders of paint! smiley-razz)



I would greatly appreciate any help you could give me... I'm truly stuck! smiley-grin

Thankyou and happy modding!
¬Al

EDIT: I just noticed I forgot to connect the other pin of the Button to the +VCC on my expert diagram hahaha, assume it is connected smiley-razz
14  Using Arduino / Programming Questions / Re: Help with using button to change function!? on: March 31, 2012, 05:03:28 pm
Quote
I understand about setting the switches with the state change, but a problem i came across was not being able to press the button thereby changing the function in the middle of the function itself. I had to hold the button until the loop had restarted, this is because in the functions i am using I have delays between LED illumination.
Those delay()s will kill you every time.

Think about how you would manage the LEDs switching, with a pad of paper and a watch. Pretend that the delay() was 30 minutes, instead.

You would switch an LED on, and you could stare at the watch until 30 minutes had passed. That's what delay() does.

Or, you could switch the LED on, write down the time, and go have a beer and watch a ball game. Periodically, you would need to go see if half an hour had elapsed. If so, do something, and write down the time.

The blink without delay example tries, not very well, to illustrate this second way.

Instead of the Arduino going and having a beer and watching the ball game, it is going and checking the switch state, so the change can be noticed much more quickly.

In your two functions, which you would still call just like you do now, the delays need to be removed, and millis() used to determine when a state change needs to occur, just as Marek080 suggested. When the state change occurs, perform some action, and note the time.

One of the function will be called a lot more often, but, in the end it won't do any more work. It's just that most of the time, the function will simply return (just as if you checked the watch every second, to see if the 30 minutes was up).

That makes sense, but My head is not clicking today, I really appreciate your help, but i'm going to start with a fresh mind tomorrow and hopefully i can edit my code sucessfully!
Thanks!
15  Using Arduino / Programming Questions / Re: Help with using button to change function!? on: March 31, 2012, 04:14:18 pm
Quote
if i past in the code i have so far could you help me apply your solutions into it?
After you try, if you have issues, by all means post and ask for help. You need to try though.

Fair enough, Thanks for the motivation! I understand about setting the switches with the state change, but a problem i came across was not being able to press the button thereby changing the function in the middle of the function itself. I had to hold the button until the loop had restarted, this is because in the functions i am using I have delays between LED illumination... So i want to try and overcome that too... This is what i Had Previously:
Code:
//6 LED Chaser Pins 8 - 13
 
const int LED1 = 13;
const int LED2 = 12;
const int LED3 = 11;
const int LED4 = 10;
const int LED5 = 9;
const int LED6 = 8;   //PIns 8 -13 can be referred to as LEDs 1 - 6

void setup() {                

  pinMode(LED1, OUTPUT); //Sets all the LED's as outputs.
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  pinMode(LED6, OUTPUT);

}

void loop()
{
    chaser();            //Runs Function 1 - Chaser
    centerchase();       //Runs Function 2 - Centerchase
}

void chaser()              //The first Function
{                
    digitalWrite(LED1, HIGH);  
  delay(100);              
    digitalWrite(LED1, LOW);
  digitalWrite(LED2, HIGH);
  delay(100);
    digitalWrite(LED2, LOW);
  digitalWrite(LED3, HIGH);
  delay(100);
    digitalWrite(LED3, LOW);
  digitalWrite(LED4, HIGH);
  delay(100);
    digitalWrite(LED4, LOW);
  digitalWrite(LED5, HIGH);
  delay(100);
    digitalWrite(LED5, LOW);
  digitalWrite(LED6, HIGH);
  delay(100);
    digitalWrite(LED6, LOW);
  digitalWrite(LED5, HIGH);
  delay(100);
    digitalWrite(LED5, LOW);
  digitalWrite(LED4, HIGH);
  delay(100);
   digitalWrite(LED4, LOW);
  digitalWrite(LED3, HIGH);
  delay(100);
    digitalWrite(LED3, LOW);
  digitalWrite(LED2, HIGH);
  delay(100);
    digitalWrite(LED2, LOW);  
}

void centerchase() // The second function
{
    digitalWrite(LED1,HIGH);
    digitalWrite(LED6,HIGH);
    delay(100);
    digitalWrite(LED1,LOW);
    digitalWrite(LED6,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
    digitalWrite(LED3,HIGH);
    digitalWrite(LED4,HIGH);
    delay(100);
    digitalWrite(LED3,LOW);
    digitalWrite(LED4,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
        digitalWrite(LED1,HIGH);
    digitalWrite(LED6,HIGH);
    delay(100);
    digitalWrite(LED1,LOW);
    digitalWrite(LED6,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
    digitalWrite(LED3,HIGH);
    digitalWrite(LED4,HIGH);
    delay(100);
    digitalWrite(LED3,LOW);
    digitalWrite(LED4,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
}    

This is what i had after attempting to add a button in, I used a slihgtly different method but i still dont see why it won't work properly....

Code:
//6 LED Chaser Pins 8 - 13
 
const int LED1 = 13;
const int LED2 = 12;
const int LED3 = 11;
const int LED4 = 10;
const int LED5 = 9;
const int LED6 = 8;   //PIns 8 -13 can be referred to as LEDs 1 - 6
const int BUTTON = 7; //Pin 7 can be referred to as BUTTON
int val = 0; //Val used to store input of Switch or pin 7
int state = 0; //0 Shows LED off 1 is LED on
int old_val = 0; // Previous version of val

void setup()
{                

  pinMode(LED1, OUTPUT); //Sets all the LED's as outputs.
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  pinMode(LED6, OUTPUT);
  pinMode(BUTTON, INPUT); //Sets Button as input
}

void loop()
{
     val =digitalRead(BUTTON); //Reads the value of the button and stores
     if ((val == HIGH) && (old_val == LOW))
{
      state = 1 - state;  //Check if state has changed
      delay(10);
}
    old_val = val; // Val is now old val so its stored
          if (state == 1)
{
    chaser();            //Runs Function 1 - Chaser
}
      if (state == 0)
{
    centerchase();       //Runs Function 2 - Centerchase
}

}

void chaser()              //The first Function
{                
    digitalWrite(LED1, HIGH);  
  delay(100);              
    digitalWrite(LED1, LOW);
  digitalWrite(LED2, HIGH);
  delay(100);
    digitalWrite(LED2, LOW);
  digitalWrite(LED3, HIGH);
  delay(100);
    digitalWrite(LED3, LOW);
  digitalWrite(LED4, HIGH);
  delay(100);
    digitalWrite(LED4, LOW);
  digitalWrite(LED5, HIGH);
  delay(100);
    digitalWrite(LED5, LOW);
  digitalWrite(LED6, HIGH);
  delay(100);
    digitalWrite(LED6, LOW);
  digitalWrite(LED5, HIGH);
  delay(100);
    digitalWrite(LED5, LOW);
  digitalWrite(LED4, HIGH);
  delay(100);
   digitalWrite(LED4, LOW);
  digitalWrite(LED3, HIGH);
  delay(100);
    digitalWrite(LED3, LOW);
  digitalWrite(LED2, HIGH);
  delay(100);
    digitalWrite(LED2, LOW);  
}

void centerchase() // The second function
{
    digitalWrite(LED1,HIGH);
    digitalWrite(LED6,HIGH);
    delay(100);
    digitalWrite(LED1,LOW);
    digitalWrite(LED6,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
    digitalWrite(LED3,HIGH);
    digitalWrite(LED4,HIGH);
    delay(100);
    digitalWrite(LED3,LOW);
    digitalWrite(LED4,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
        digitalWrite(LED1,HIGH);
    digitalWrite(LED6,HIGH);
    delay(100);
    digitalWrite(LED1,LOW);
    digitalWrite(LED6,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
    digitalWrite(LED3,HIGH);
    digitalWrite(LED4,HIGH);
    delay(100);
    digitalWrite(LED3,LOW);
    digitalWrite(LED4,LOW);
    digitalWrite(LED2,HIGH);
    digitalWrite(LED5,HIGH);
    delay(100);
    digitalWrite(LED2,LOW);
    digitalWrite(LED5,LOW);
}    

What the above does is getting there, when i press the button it will switch to the other function, BUT i have to HOLD ON the button until the end of each function cycle before it will register the state change. I took a video of the circuit using 6 leds. Shown below: (Photobucket upload)
Pages: [1] 2