Show Posts
|
|
Pages: 1 2 3 [4] 5 6 ... 66
|
|
49
|
Using Arduino / General Electronics / Re: Difference between Arduino 5V power and output of 7805 5V power
|
on: January 20, 2013, 08:08:52 am
|
|
You are going to have to post a diagram of how you wired everything up.
Also, when calculating the resistor for an LED, Vr=Vs-Vf where Vf=forward voltage of an LED, Vr = voltage across resistor, Vs=supply voltage. A standard Red LED has If=20mA (forward current), Vf = 2.1v(forward voltage).
So how much voltage is across the resistor? (Hint: think of it like a staircase, the supply lets you walk up 5 steps, then the LED forces you down 2.1 steps, so how high are you?) The resistor needs to have 2.9 volts across it to get you back down to the bottom of the staircase.
Its a series circuit, so all current that flows through the LED must flow through the resistor, meaning that there must be 20mA flowing through the resistor if you want 20mA to flow through the LED.
So using V=IR, you get 2.9 = 20mA * R => R = 2.9/0.02 = 145R. You will notice that there are some standard values for resistors, so the minimum standard value you would want is 150R. You will find that an LED can run quite happily at a lower current, so you can use a larger resistor if you want, the LED just won't be as bright, but its working life will be extended.
For example, at 270R, you would have I = V/R = 2.9/270 = 10.7mA flowing through the LED.
|
|
|
|
|
50
|
Using Arduino / LEDs and Multiplexing / Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
|
on: January 18, 2013, 06:36:24 pm
|
I understand that I want a fet with low RDS, typically measured in millionths of an ohm
I think that is mOhm, or milliohms, i.e. thousandths of an ohm. These are what I chose for my 12x12x12 cube. I ended up with 72 of them, and each one supplies 2 rows of 12 RGB LEDs, totalling 24*3=72 diodes per transistor = 1.44A peak current. http://uk.farnell.com/nxp/nx2301p/mosfet-p-ch-20v-2a-sot23/dp/1894738?Ntt=1894738I chose them for (a) price, (b) size, and (c) they are rated at 2A drain current at a Vgs of -4.5V making them suitable for 5v logic levels. Ideally one with a slightly lower on resistance (these are 0.1Ohm at -4.5V) would be better, but these were a good price and I only lose 0.144v which would have been lost over the PWM constant current sources I have wired to the Cathodes. In my case theThe power lost is 1.44^2 * 0.1 = 200mW, which is well withing the power dissipation the transistor can support.
|
|
|
|
|
51
|
Using Arduino / General Electronics / Re: Arduino MEGA on another PCB
|
on: January 18, 2013, 07:22:47 am
|
|
Ok, yeah, thats one of the annoying things about eagle.
There is a way around it though. If you select the mega footprint with the move tool, then while it is following the mouse, there is a button on the toolbar at the top which looks like a grid of 4 squares, the two on the left are shaded and there is a line down the middle. If you click that it will mirror the footprint and you can then place it down within the board outline.
|
|
|
|
|
52
|
Using Arduino / General Electronics / Re: Arduino MEGA on another PCB
|
on: January 17, 2013, 06:57:57 am
|
|
The outline has the pin headers on it aswell, correct?
If so, place it on the board, and then use the MIRROR command to flip it onto the bottom layer. This will simulate the mega board being upside down. As the pin headers are through hole, you can simply mount the header on the top of the board.
|
|
|
|
|
54
|
Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove
|
on: January 17, 2013, 04:25:49 am
|
That was just an example. You would call the systemReset() function at any point in the program you want. Wrap it in an if statement, for example: #define someIO 2 void setup() { // This code will only run once, after each powerup or reset of board pinMode(10,OUTPUT); digitalWrite(10,LOW); digitalWrite(someIO,HIGH); //enable pullup-resistor pinMode(someIO,OUTPUT); //THEN set to output, by doing so, pin is already high when switching to output meaning reset is not tripped.
Serial.begin(115200); }
void systemReset(void){ digitalWrite(someIO,LOW); while(1); }
void loop() { static unsigned long nextMillis = millis() + 1000; // This code loops consecutively if (millis() > nextMillis){ digitalWrite(10,!digitalRead(10)); nextMillis += 1000; } if (Serial.available() && (Serial.read() == 'K')){ systemReset(); //reset only when you send the uppercase letter 'K' (for kill?) through the serial port } }
|
|
|
|
|
56
|
Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove
|
on: January 16, 2013, 11:30:07 am
|
|
It works because there is more in the circuit that just an I/O pin connected from an output to the reset pin.
Consider that there is also the "Auto-Reset" 100nF capacitor connected between the pin and GND (or +5v depending on how the DTR pin of the USB-Serial chip is set).
When the I/O pin goes low, it discharges (or charges if DTR=5v) that capcitor rapidly down to around 0v with respect to the GND at the reset pin end. When the chip then puts the I/O pins into a High-Z state, the 10k pullup has to charge (or discharge) that capacitor back up to +5v at the reset pin end which takes some time - sufficient time to reset the chip. If it wasn't sufficient time, the autoreset function itself wouldn't work.
|
|
|
|
|
57
|
Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove
|
on: January 16, 2013, 11:09:08 am
|
regarding point (2). I have used this method in several projects and it works fine from what I have seen. Try this out: #define someIO 2 void setup() { // This code will only run once, after each powerup or reset of board pinMode(10,OUTPUT); digitalWrite(10,LOW); digitalWrite(someIO,HIGH); //enable pullup-resistor pinMode(someIO,OUTPUT); //THEN set to output, by doing so, pin is already high when switching to output meaning reset is not tripped. }
void systemReset(void){ digitalWrite(someIO,LOW); while(1); }
void loop() { // This code loops consecutively delay(1000); digitalWrite(10,HIGH); delay(1000); systemReset(); }
you will see an LED connected to pin10 blink on for a second then go off for a second (and the bootloader LED flashes in between). (This assumes pin 2 is connected to the reset pin).
|
|
|
|
|
58
|
Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove
|
on: January 16, 2013, 10:14:43 am
|
Simplest way to do it: void systemReset(void){ WDTCR = _BV(WDCE) | _BV(WDE); WDTCR = _BV(WDE); while(1); //will reset in 16ms } More complex way (requires I/O pin): void setup(void){ digitalWrite(someIO,HIGH); //enable pullup-resistor pinMode(someIO,OUTPUT); //THEN set to output, by doing so, pin is already high when switching to output meaning reset is not tripped. }
void systemReset(void){ digitalWrite(someIO,LOW); while(1); } Just connect one of the Arduino digital pins to the reset pin, and then replace 'someIO' with the number for the pin you chose.
|
|
|
|
|
59
|
Using Arduino / Microcontrollers / Re: Advantages of Arduino Uno over PIC18F4550
|
on: January 16, 2013, 09:47:31 am
|
|
C++ and AVR-GCC.
There is free a C compiler for PIC18 but it doesn't do any sort of optimisation and it is very strict in how it likes you to write code - if you want a compiler which optimises the code you have to pay Microchip many hundreds of pounds. The one thing I have found when working with PICs is that there software is so intermittent in whether or not it works.
The AVR also has better (well more useful) hardware timers (PWM, counters, interrupts etc).
|
|
|
|
|
60
|
Using Arduino / Displays / Re: SOLVED - unable to make it work 1.8 SPI TFT 128x160
|
on: January 16, 2013, 07:26:53 am
|
Don't forget that
MOSI > MISO MISO > MOSI
One devices OUT is another devices IN.
No... MOSI -> MOSI MISO -> MISO MOSI = "Master OUT, Slave IN" MISO = "Master IN, Slave OUT" The Slave devices IN pin, connects to the Master devices OUT pin, so the Slave MOSI and Master MOSI must be connected. This is not UART, its SPI, where data moves around in a loop containing shift registers.
|
|
|
|
|