Show Posts
Pages: 1 ... 52 53 [54] 55 56 ... 116
796  Using Arduino / General Electronics / Re: Difference between Arduino 5V power and output of 7805 5V power on: January 20, 2013, 10:58:09 am
I see no reason why that circuit shouldn't work.

I can only suggest going back and double checking your connections. I have attached a schematic to help.

Note that the + terminal of the supply goes to the Input pin of the 7805, and the - terminal goes to the GND pin.
797  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.
798  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=1894738
I 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.
799  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.
800  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.
801  Using Arduino / General Electronics / Re: Arduino MEGA on another PCB on: January 17, 2013, 04:29:30 am
Google 'Sparkfun Eagle Library', its on github and the outline and pin positions of a mega are in that library.

Edit: https://github.com/sparkfun/SparkFun-Eagle-Libraries
802  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:

Code:
#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
  }
}
803  Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove on: January 16, 2013, 11:49:23 am
Hmm, its roughly half of the MAX reset period (1us). If you use a diode rather than a wire then the delay becomes 300x the reset period required (800us) - Cathode to digital pin, Anode to reset pin.
804  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.
805  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:
Code:
#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).
806  Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove on: January 16, 2013, 10:14:43 am
Simplest way to do it:
Code:
void systemReset(void){
  WDTCR = _BV(WDCE) | _BV(WDE);
 
  WDTCR = _BV(WDE);
  while(1); //will reset in 16ms
}

More complex way (requires I/O pin):

Code:
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.
807  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).
808  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.
809  Using Arduino / Microcontrollers / Re: Reset pin on attiny85 on: January 14, 2013, 12:04:40 pm
Unless you use a bootloader.

I have had success with an Attiny84 using its internal oscillator with my customised version of optiboot installed on it, and then disabling its reset pin. I can then use UART to upload new programs.

The process should work for the Attiny85 also.

If you download this core:
https://github.com/TCWORLD/ATTinyCore/

Then in the IDE, select "Optiboot Attiny85 @8MHz", and then using ISP, burn the bootloader using the IDE.

Then connect the attiny to a serial port (you can use an arduino board with its processor removed). PB1 is the Tiny RX pin, PB0 is the Tiny TX pin.

If you open the serial monitor at 9600 board, then unplug power for the Attiny and reconnect it again (to reset it), it should print stuff to the serial monitor. If you can't read it dont worry, just keep sending the letter 'x' (lower case) with no line ending. Each time it will print something to the serial monitor. Eventually (maybe 10 to 15 times of sending 'x') it will stop printing stuff. At this point the bootloader is ready and the internal oscillator is calibrated.

You should then be able to upload sketches via the serial port. Once you have confirmed that you can do that, you will need to use avrdude to set the fuses to disable the reset pin making sure not to erase the chip.
810  Development / Other Software Development / Re: Library for Nokia LCD (128x128) on: January 13, 2013, 06:32:15 am
The latest version, V3.3 adds support for rotating the screen 90,180, and 270 degrees (anticlockwise) to allow your nokia display to be mounted in any direction and have the screen the correct way up.
There is also now support for character wrapping, whereby if a string is too long for the screen, it is automatically wrapped onto a new line.
https://github.com/TCWORLD/gLCD-Library
Pages: 1 ... 52 53 [54] 55 56 ... 116