text:
How to start a block of code after a certain time?
I'm using a ATMega328P-PU on a breadboard as an arduino. How do you start a code after say 20 seconds have elapsed since startup?
Example code:-
if(condition)
{
     //Start sending morse code!
}

My current code uses millis() and fails miserably. The speaker does not get activated. I'm using the standard circuit mentioned at the Arduino website
My current code:-
time = millis();
  if(time>=20000)
      txEnable=true;
      val = analogRead(analogPin);
  if(val!=0)
  {
    standby=false;

  }
  else
  standby=true;
  if(txEnable==true && standby==true)
 {

  if(!callsignSender->continueSending())
    {
        callsignSender->startSending();
    }

 }

You are comparing an analog reading with zero. Are you sure you don't mean digitalRead()? If you really need an analog value, instead of comparing with zero you should compare to some low threshold.

I'm basically writing this code for a ham wireless repeater. Its in Pune.(VU2PHA). The analog read value is for detecting any incoming signal for repeating. Its a small scale model for the same big repeater. The repeater custodian is my friend and I'm making it for him.

The define a "noise threshold" and treat any value below the threshold as equivalent to zero.

@Edgar Bonet I'm going to fine tune that once I get in touch with VU2ASH (one of the custodian). I'm making a protosketch.

I have to use the following protocol. https://docs.google.com/document/d/1-MHXkswdqyO2CX3Q_D83SsUi4Uosm34mRVtucOoSkCM/edit?usp=docslist_api

The following bare-minimum code will switch pin 13 to high after 20 seconds:
void setup() {
  // assuming pin 13 has a LED connected (as on most Arduino boards)
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW); // would also work without this line
}

void loop() {
  unsigned long time = millis();
  if (time >= 20000) {
    digitalWrite(13, HIGH);   // set the LED on
  }
}

Try if this works for you, i.e. if a LED connected to that pin will light up 20 seconds after reboot.
If not you will need to find the problem: Is your ATmega running at the correct speed? Is your code executed at all? Are the peripherals working?

millis() returns time in unsigned long format. Above code needs to be adjusted. (Otherwise its bound to create trouble) I'll try your code though. Pls try searching for alternatives!

Well, it would work for what it's written. But I've changed it to ulong.

Note that I don't suggest that you actually use code written like that for any other purpose than testing...


text:
Passing a long string from SoftwareSerial to Serial
I'm currently playing around with a GPRS shield on an Arduino Uno, for which I have to write raw AT commands over the SoftwareSerial. At the moment, I just want to be able to talk to the GPRS from my PC, so I've written a really basic program to send serial in two directions:
#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);

void setup()
{
  GPRS.begin(19200);
  Serial.begin(19200);
}

void loop()
{
  if (GPRS.available())
  {
    Serial.write(GPRS.read());
  }

  if (Serial.available())
  {
    GPRS.write(Serial.read());
  }
}

So the communication looks something like this:
         HW               SW
+----+ Serial +-------+ Serial +------+
|    |        |       |        |      |
|    +-------->       +-------->      |
| PC |        |Arduino|        | GPRS |
|    <--------+       <--------+      |
|    |        |       |        |      |
+----+        +-------+        +------+

This seems to work fine for shorter commands:
AT+CPIN?

+CPIN: READY

OK

But I'm really interested in doing a NETSCAN to see what networks are available. When I try it, I get this:
AT+CNETSCAN

------MOST SUITABLE CELL------
Operator:"YES OPTUS",MCC:505,75

And that's all. I pulled out a logic analyser to spy on the serial pins themselves, and it appears that the complete message is being sent back to the Arduino from the GPRS module perfectly okay - but for some reason, it gets cut off before it reaches my PC.
This is what the logic analyser sees over the SW (top two tracks) and HW (bottom tracks) serial lines:

So it appears that the entire GPRS response is being read by the Arduino before it starts to send anything back to the PC, and I assume that some sort of buffer has been overrun and I only get the start of the message.
So - how should I go about passing through long strings between serial ports like this? I assumed that using if (X.available()) instead of while would alleviate any issues with long strings (because it appears that this way the two serial ports should take turns with one byte at a time), but is that assumption incorrect?

The output of the logic analyser is pretty clear. The problem will be a buffer overflow. One question is whether it is the receive buffer or the send buffer.
My best guess is the receive buffer: What could go wrong with your code is that the interrupts used by SoftwareSerial take precedence over the ones used by HardwareSerial. So maybe that's the reason why nothing is sent before the full message is received.
The SoftwareSerial library has a debug flag (_DEBUG) which you can enable to pulse a pin as an overflow indictator.
What I would try is to swap Software- and HardwareSerial (i.e. use SoftwareSerial for the communication with the PC). If the problem is as described above it should then vanish because the HardwareSerial does not block interrupts (nor the program flow) while receiving a byte.

Using software serial to PC appears difficult as far as I can tell! Is there a good guide somewhere? My other possibility is trying to get my hands on a Leo, or any other board with more hardware serials.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Determining power consumption with Arduino and JeeLib
I built a basic LED blinker to serve as a car theft deterrent. Originally I was using a 9V battery and delay() but I've refined my approach to consume less power. Here's my code, utilizing the JeeLib library:
#include <JeeLib.h>

int led = 13;
ISR(WDT_vect) { Sleepy::watchdogEvent(); }

void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
}

void loop() {
  blink_quick();
  blink_quick();
  Sleepy::loseSomeTime(8000);
}
void blink_quick() {
  digitalWrite(led, HIGH);
  Sleepy::loseSomeTime(250);
  digitalWrite(led, LOW);
  Sleepy::loseSomeTime(250);
}

It just blinks twice every 8 seconds. I also used 4 AA batteries as they have a higher amperage rating. How long should this system work before I need to replace the batteries?
My thinking is that AA batteries offer 2000mAh and an Arduino typically consumes about 45mA on average. If I were running the above code with delay() instead of the JeeLib functions, it would last for 44 hours. Let's call one cycle the two blinks and the following 8 seconds of rest. I am confused about how long I should factor in for the digitalWrite(led, HIGH) and the corresponding 'low' call, because the rest of the time, the circuit is using JeeLib. I am just interested in figuring out how long I can let this run without changing the batteries, and admittedly I am not experienced enough to tell definitively.
Thanks!

Did you already go through the countless "how long does X run on Y batteries" questions here?  [moderator note: at the moment of writing "here" was EE.SE]

@PlasmaHH I went through a few, but I figured JeeLib changes a few things and I couldn't find much on that specifically even though it seems to be very popular for this kind of Arduino setup elsewhere.

I also understand that it is difficult to give an exact rating, but could it run for a week, a month? I'm really confused as to how to estimate.

What board are you using? For example, the Uno has a lot of other components that will consume power, even if you sleep the main processor. Instead use something like a Pro Mini.
You can bypass the voltage regulator, and just supply 4.5v by using 3 AA batteries. You can even use just 2 AAs if you have the 3.3v version. The lower the voltage the less current the ATMega uses.
Most importantly, measuring the power consumption using a multimeter. Measure the current the led uses. Disconnect the led, and measure how much the arduino uses. Use this handy Battery Life Calculator, and just fill in those numbers.
Run the led with the lowest current, where the led is still visible enough. Running a power-led at just 1mA will still give a decent amount of light.
In your situation, if coded correctly, power usage of the ATMega is negligible. The only real power user is the led. If you run the led at 1mA, and use a set of AA batteries, you get around 3.5 years of running time, no problem.

As mentioned in another answer use a multimeter to measure.  However I would recommend using the cars battery to power the system.  A parasitic draw on a cars battery of under 1 amp is considered acceptable (per what I learned in school).  A parasitic draw is current used while the car is off.  Get a clamp ammeter and check your parasitic draw and if you have the available amperage to spare run it from your battery. To check your parasitic draw place the clamp around the ground wire (or multiple ground wires) at the battery terminal.
If you run it from your car battery you will never have to worry about changing the battery and it becomes a set and forget system.

I have a lot of detail about here: Power saving techniques for microprocessors

Let's call one cycle the two blinks and the following 8 seconds of rest. I am confused about how long I should factor in for the digitalWrite(led, HIGH) and the corresponding 'low' call, because the rest of the time, the circuit is using JeeLib.

To answer this specific question, we can work out a "power budget" by taking the large consumption time (eg. the LED being on) and working out how much that is, as a fraction.
So in your case you have the LED on for 500 ms every 8 seconds. That is:
8 / 0.5 = 16

That is, 1/16th of the time. Or, putting it another way:
0.5 / 8 = 0.0625

So, let's say the LEDs use 20 mA. The average consumption then is:
0.020 * 0.0625 = 0.00125 A (1.25 mA)

And let's assume that while asleep it uses 1 mA. So the total consumption on average is:
1 + 1.25 = 2.25 mA

So if you have a 2000 mAh battery, you would get:
 2000 / 2.25 = 888.88  hours

However as others have pointed out, this is pretty meaningless if you use a development board. The on-board LED, the voltage regulator, the USB chip etc. will use much more power than you save by going to sleep. You have to move to a low-power or custom design, which minimizes these extra effects.
With careful design you should be able to get the sleep usage down to around 6 µA with the watchdog timer to wake you up.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Thin battery to power arduino micro with nRF8001?
I'm building a project which needs to fit in a wallet. I have an Arduino Micro hooked up to a nRF8001. I attempted three button cells wired in series, which provided a solid 7.5 volts, but only 20mA.
A 9V battery successfully powers it, but that's too big to fit in a wallet. I was considering using an A27 battery, but even that's thicker than I would like.
Is there any battery I can use that's a reasonable thickness, and won't explode on me? Thanks!...

You'd probably be better off replacing both chips with an nrf51822 both running your code, and containing the radio.  Then you can run it on a single coin cell.

I think you should use a 3.7v mini battery that are around 200-300mAh capacity. These batteries are variable on online stores and are very thin. Now as you require 5v there are mini DC-DC boost converters available what you can use with them.

Either of these two are pretty good depending on how long you want it to live and how much current your device draws:
https://www.sparkfun.com/products/731
https://www.sparkfun.com/products/10718
You can still probably power the micro from these even though they're 3.7v. When charged they'll be closer to 4.2v and it will still probably run down to 3.5v anyway.
Or you could just put two in series to increase the voltage

Oof. Are these safe to keep in a wallet that I might fall asleep on? I feel like the heat and weight might be enough to cause one of those nasty lithium battery fires.

I've never had any problems with these batteries overheating in tight spaces. The heat will depend on hw much current you draw from the battery. It sounds like you won't need much.  Still though, I wouldn't suggest sleeping on it.

This is the same battery in smart watched and cellphones. If enclosed they are fine.

I run my projects directly from a 3v CR2032 lithium cell. Bypassing any voltage regulator. You could use something like a I'd get a 3.3v arduino, something like a Arduino Pro Mini. (You can also use your micro, but you'd have to "underclock" them, as the ATMega32u4 isn't necessarily capable of running 16Mhz at 3V.)
By bypassing the voltage regulator, you don't get any of the losses.

Will the button feels provide enough current for everything? The arduino and the nrf8001?

nRF8001 peak current is 12.5mA. Atmega will be around 5mA. Which seems to be fine for a CR2032. Note that you only have 240mAh of capacity.

So in other words, this would be a battery replacement every 12 hours. Fantastic.

That is just peak current. Nominal power is lower, and you can put them both into sleep mode most of the time (depending on your application).

You can use rechargeable Ni-Cd batteries of 3 AAA size cells with wired connection.There are also small 4V rechargeable lead-acid batteries,which are mostly used in led torch.

I think the problem there would be 3xAAA are larger than a 9v battery so its probably going to cause more size issues.  Also NiCad is not good to have in your pocket where coins might be, in fact a I can't think of a battery that is good for use in a pocket without a proper case.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Problem in Uploading through Visual Studio
This is my simple program:

int led = 13;
void setup()
{
    pinMode(led, OUTPUT);
  /* add setup code here */

}

void loop()
{
    digitalWrite(led, HIGH);
    delay(1000);
    digitalWrite(led, LOW);
    delay(1000);
  /* add main program code here */

}

I tried to upload it using Visual Studio 2013 using a plugin Visual Micro for Arduino. But it resulted in this error:

Compiling 'bb' for 'Intel® Galileo Gen2'
Binary sketch size: 83,455 bytes (used 1% of a 10,000,000 byte maximum) (0.17 secs)
Compiling debug version of 'bb' for 'Intel® Galileo Gen2'
Binary sketch size: 85,056 bytes (used 1% of a 10,000,000 byte maximum) (2.81 secs)
Uploading to I/O board using 'COM3'
starting download script
Args to shell: C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/x86/bin C:\Users\Shiran Abbasi\AppData\Local\V.Micro\Arduino\Builds\bb\izmir_fg/bb.elf COM3
COM PORT Abbasi\AppData\Local\V.Micro\Arduino\Builds\bb\izmir_fg/bb.elf
Converted COM Port Abbasi\AppData\Local\V.Micro\Arduino\Builds\bb\izmir_fg/bb.elf to tty port
Sending Command String to move to download if not already in download mode
Deleting existing sketch on target
Moving downloaded file to /sketch/sketch.elf on target

#!/bin/sh

echo "starting download script"
echo "Args to shell:" $*

# ARG 1: Path to lsz executable.
# ARG 2: Elf File to download
# ARG 3: COM port to use.

#path contains \ need to change all to /
path_to_exe=$1
fixed_path=${path_to_exe//\\/\/}

#COM ports are not always setup to be addressed via COM for redirect.
#/dev/ttySx are present. Howwever, COMy -> /dev/ttySx where x = y - 1

com_port_arg=$3
com_port_id=${com_port_arg/COM/}
echo "COM PORT" $com_port_id
tty_port_id=/dev/ttyS$((com_port_id-1))
C:\arduino-1.5.3-Intel.1.0.4/hardware/arduino/x86/tools/izmir/clupload_win.sh: line 20: Abbasi\AppData\Local\V.Micro\Arduino\Builds\bb\izmir_fg/bb.elf: syntax error: invalid arithmetic operator (error token is "\AppData\Local\V.Micro\Arduino\Builds\bb\izmir_fg/bb.elf")
echo "Converted COM Port" $com_port_arg "to tty port" $tty_port_id

echo "Sending Command String to move to download if not already in download mode"
echo "~sketch download" > $tty_port_id
C:\arduino-1.5.3-Intel.1.0.4/hardware/arduino/x86/tools/izmir/clupload_win.sh: line 24: $tty_port_id: ambiguous redirect

#Move the existing sketch on target.
echo "Deleting existing sketch on target"
$fixed_path/lsz.exe --escape -c "mv -f /sketch/sketch.elf /sketch/sketch.elf.old"  $tty_port_id 1>&0
C:\arduino-1.5.3-Intel.1.0.4/hardware/arduino/x86/tools/izmir/clupload_win.sh: line 28: $tty_port_id: ambiguous redirect

# Execute the target download command

#Download the file.
host_file_name=$2
$fixed_path/lsz.exe --escape --binary --overwrite $host_file_name  $tty_port_id 1>&0
C:\arduino-1.5.3-Intel.1.0.4/hardware/arduino/x86/tools/izmir/clupload_win.sh: line 34: $tty_port_id: ambiguous redirect

#mv the downloaded file to /sketch/sketch.elf
target_download_name="${host_file_name##*/}"
echo "Moving downloaded file to /sketch/sketch.elf on target"
#$fixed_path/lsz.exe --escape -c "cp sketch /sketch/sketch.elf"  $tty_port_id 1>&0
$fixed_path/lsz.exe --escape -c "mv $target_download_name /sketch/sketch.elf; chmod +x /sketch/sketch.elf"  $tty_port_id 1>&0
C:\arduino-1.5.3-Intel.1.0.4/hardware/arduino/x86/tools/izmir/clupload_win.sh: line 40: $tty_port_id: ambiguous redirect

Any help would be appreciated.

I see nothing that looks like an error in the output you posted. Is that all you got?

yeah it's all i got and it's very annoying because when i upload the same program using arduino ide, it gets uploaded successfully.

@jfpoilpret can u help me?

I'm afraid I can't help as I think we are all lacking information here. First how do you know the upload went badly since there is no real error message? What I find strange in the output you psoeted is the shell script that has nothing to do here since you are on Windows...

You have to keep Visual Micro up to date when using new Ide's. The intel Ide functionality was evolving but has now been moved to the Arduino 1.6.2+ boards manager. Again, with the latest Visual Micro releases it is supported

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Relay built in to cable with arduino interface
To be able to switch 220 volt stuff on and off using arduino, I need a relay (I assume). Is there really no nice extention cable with built in relay so you dont need to cut and connect high voltage.
I imagine a Power strip With a simple input port that can be controlled from the andruino, just like a relay board. When I Google this I get a lot of USB controlled and remote controlled, but none that works with an andruino project.

PowerSwitch Tail is what you are looking for.


text:
nrf24l01+ does not work with a battery, or very unreliably
For a project in progress, I have an Arduino UNO sending a message when a condition occurs, and a Raspberry Pi that listens to it. Both are fitted with NRF24L01+ modules with antennas.
It works perfectly when the Arduino is powered from a wall socket, for instance using a 9V / 1A power supply. But when I try it with a 9V battery (which is supposed to supply 600 mAh), the Raspberry Pi receives only 1/10 of the messages.
Could you tell me:

Why this happens
How I can solve this problem (software / wiring / capacitor / ...)
What would be the best way to power an Arduino whose only job is to detect that a switch closes, and emit a message over the air

Here is the code of the emitter (Arduino). And there is the code of the receiver (Raspberry Pi).
Thank you.

600mAh is capacity, not current.

4 rechargeable AA batteries (4 x 1.2V)(bypassing the voltage regulator). Note that you will probably only get a few days of usage out of batteries, because you are using an UNO, since the USB-to-Serial chip doesn't sleep.

Actually I think I should be able to use just two AA batteries. I was just testing the design on the UNO. It's really not a low power device... The regulator sucks a lot of current, and there is the power LED. So it's probably using most of the juice of the 9V battery already, doing nothing.

According to the datasheet of another 9V battery, I should not expect more than 30 - 50 mA of constant current. This is probably the reason why.
Long story made short: One can not power a NRFL01+ reliably with a 9V battery.
I'd be better off using 2xAA batteries.

According to my measurements, the Uno would take 50 mA from a 9 V battery. You are already at the upper end of the range you quoted. Now power up a transmitter and the voltage probably drops so low it fails. One can not power a NRFL01+ reliably with a 9V battery - more like, "One can not power a Uno reliably with a 9V battery".

I'd be better off using 2xAA batteries. - why not 3xAA batteries? That's only 4.5 volts. Put it straight onto the 5 V pin.

Does anyone have idea/guess, for how long it will run on 3xAA batteries ?

Another thing to consider is that a nrf24l01+ chip at full power will potentially be pulling more current than your 5v reg can supply, try a lower power setting on the PA.

This is exactly the opposite. NRF24L01+ draws maximum 14mA of current. Arduino Uno board draws much much more.

Add a 100uf capacitor between ground and 3.3v directly on the nrf breakout. They're very susceptible to noise on the power supply. I had issues with the same thing and this solved it. Also, make sure you're powering from 3.3v. Also make sure you solder the negative to the negative!

I got a similar problem while not exactly the same but it may include the solution. I have a arduino nano with the nrf24l01 with the adapter and antenna (PA LNA). Transmitter work well but the receiver only work/receive data when plug by USB to the computer, not using an external battery (by USB too). I search for hours looking for a solution (the capa, the robin nrf24 tutorial, SPI problem, power supply problem, trying with another nrf24 module...) without finding any reason for this unexpected behaviour. Then i figured out that  the USB cable that i use make a big difference: two were preventing transmission, one allowing transmission (the 3 cables perfectly work to upload sketch): i was thinking to a ground plan problem due to different size of USB cable but then i check the voltage arriving on the adapter of the nrf24l01. It was 4.7V for the cables that doesn't work, 4.6 with the cable that work. Then i just bypass the arduino alimentation of the nrf24l01  by using a regulated power supply directly applied on vcc and gnd of the adapter. By manually adjusting the voltage i could trigger the transmission with 4.5 V and stops it at 4.7V. I don't know why it's work like this (defect of the 5V to 3.3V regulator of the adapter?) but that do the trick for me. I know that it looks like a very unlikely solution for you but if you are desperate after hours of research, take a minute to put a voltmeter just before the adapter to look for difference in  the voltage in the condition where it works versus where it doesn't work.


text:
Is there an Arduino Simulator or Emulator that runs on OS X?
Is there an Arduino Simulator or Emulator or cross-compiler to native Mac executable that runs directly under Mac OS X, and does NOT require a Windows or Linux VM or an active internet connection for running in the cloud?
There are previous questions here on similar topics, but they do not seem to address exactly this particular use case subset.

Is this not adequate? http://123d.circuits.io/

I am using the Wokwi Arduino simulator for a long time. It runs on all three platforms. Mobile, Windows OS, and macOS.
I have checked the working of the simulator in both Android and iPhone. Both give a good performance as well.

Arduino CodeBlocks plug-in has an Arduino simulator. Be carefull when setting it up and use full paths, it's easy to mess up, but works beautifully once done.


text:
What are the differences between the 1.0.x and 1.6.x IDEs?
What is a summary the main differences between the Arduino 1.0.x and 1.6.x IDEs?  Why do some Arduino products, such as the LightBlue Bean, still require use of the 1.0.6 IDE?

http://arduino.cc/en/Main/ReleaseNotes find 1.0.6 and start scrolling up

Question modified for an answer that fit on this page.

I think Arduino's version history is a bit confusing. I'm not an expert but I think this explanation will help. First let's note that version 1.6 was released 2015.02.09. However, back in 2012, version 1.5 BETA was created and it remained in beta for several years. Meanwhile, the 1.0.X version evolved independently here's an excerpt from the changelog

ARDUINO 1.0.6 - 2014.09.16
ARDUINO 1.0.5-r2 - 2014.01.08
ARDUINO 1.0.5 - 2013.05.15
ARDUINO 1.0.4 - 2013.03.11
ARDUINO 1.0.3 - 2012.12.10
ARDUINO 1.0.2 - 2012.11.05

So you can see that 1.0.6 isn't as old as one may think. Many vendors probably chose not to develop their products against the 1.5 version (or branch) because of its beta status. 1.5 being in beta for as long as it did lends to a confusing version history. I did get the impression that LightBlue Bean is working on compatibility with 1.6.x because their getting started page mentions

Download and extract the Arduino app, version 1.0.5. We currently do not support newer versions of the Arduino IDE.


text:
Comparison of an Arduino's performance?
How does an AVR-based Arduino's CPU performance compare to a vintage PC (Apple II, PC-XT, TRS-80, et.al.)?
How many megaflops of number crunching can one get out of an AVR-based Arduino?

take a look here: http://forum.arduino.cc/index.php?topic=40901.0 There is reference to 30k float divisions per second, so it is 0.03MFLOPS. Also, this topic was brought up before, please google before asking: http://robotics.stackexchange.com/questions/535/how-computationally-powerful-is-an-arduino-uno-board

The topic wasn't searchable in this forum, and one can't seem to dup a Q across stackexchange sites without admin help.

this is not a forum and google searches across interwebs since 1998

OK, so I just ran some really old benchmarks on a LightBlue Bean (AVR 328p Arduino at 16 MHz).  The Bean ran the Byte Sieve benchmark slightly slower than a VAX 11/780.  The Bean also ran some of my old floating point computations about 2X faster than the 11/750 (this VAX model has no FPU to be fair to the AVR).  That puts the Bean's math performance at somewhere around 70 kFLOPs (with few divides in the mix).  A DEC VAX is several times faster than vintage 8-bit personal computers, an IBM PC-XT being roughly 1/3 to 1/2 a VAX "MIP" in benchmark performance, with an Apple II being slower still.

An 11/780??!? Those were the days :)


text:
Use Arduino pro micro to program pro mini?
So I got a pro micro and 2 pro minis and I was wondering if I could use the pro micro to program my minis? Anyone has any links or guides on how to do this, if at all possible?

Other than the normal ArduinoISP guides?

I don't know if it will still work but I will suggest you this.
As arduino micro is Leonardo compatible and you r two arduino minis are based on atmega328. You should be able to use the tutorial posted above to use micro as programmer for the two mini.
Hope that helped.


text:
Can I measure the current (mA) of my project with just a multi meter?
I have a project and wish to choose the correct battery back for it such that it will last the required amount of time between each recharge of the battery pack. I am using an Arduino Duemilanove with various attachements and shields.
I can measure that the draw on the project at the point the USB connects from my PC to the Arduino board (by attaching the multimeter to the Vcc and GND solder points on my Arduino board) which reads 5V DC as expected. Is there a way I can meausre the current (without any additional equipment) ?
I suspect somehow using Ohms law and measuring the resistance between two points would be the answer (knowing the voltage is 5V) but I can't work it out (as in where to measure) with my lack of any electrical knowledge.

No, you won't get the right result measuring resistance. Integrated circuits contain lots of semiconductors which are inherently non-linear.
You need to somehow put your multimeter in series with the power supply, set to the mA range. The easiest way I can think of is to use an external battery (7v or higher) and make up a custom cable with standard barrel jacks. As your board appears to have a linear voltage regulator, the current measured will be very close to the current consumed when powered from the USB port.

NOTE: This may be inaccurate if the power usage isn't constant - driving a stepper motor, for example; high current for a short period, low current the rest of the time. Your multimeter will not be quick enough to pick up the peaks and troughs. You will probably get the median (most common) current, not the mean (average).

That is a fairly simple method an electrical beginner like me can follow, thank you very much. I knew there would be a simple way but I couldn't see it myself.

A reasonable method is to place a small value resistor in series with the supply, connect a capacitor from the Arduino side of the resistor to ground and then measure the voltage drop across the resistor.
If you set the resistor value such that the highest current drawn drops less than about 0.1 Volts then it will have minimal effect on most circuits.
For example if max current is 100 mA then as R = V/I, Rmax <= V/I = 0.1/100 ma = 0.1V/0.1A = 1 Ohm.
So generally
Rseries <= Vdrop_max / Imax_A  (I in Amps) or
Rseries = Vdropmax x 1000 / Imax_mA   (I in milliAmps)
Then I_ma = Vmeter x 1000  / R
Example:
Max current = 350 mA.
R <= V/I = 0.1V /0.350  A = <= 0.286 Ohm.
A 0.1 Ohm - which is a readily available standard value, will probably be good.
Then if meter reads say 0.033 volt (33 millivolts) then
ImA = V_mv / R   = 33/0.1 = 330 mA.
A larger resistor value, giving a larger voltage drop, can be used if the circuit will tolerate the resultant lower supply voltage.

Measure the drop with a meter set to 0.2 V (200 millivolts). Nit all meters have a 0.2 V range but even some reasonably cheap ones do have and it is worth having a meter with this range for various purposes.
Connect a capacitor from Arduino 5Vin to ground - the more uF the better. 100 uF probably OK, 1000 uF better ... .
This method will smooth out short current peaks and give you an average current. This aspect can be expanded on if of interest.


text:
Erratic behaviour using Serial.print() when powering only from power supply
I'm using an arduino uno with a thermal printer and the following code:
#include "Adafruit_Thermal.h"
#include "skull.h"
#include "SoftwareSerial.h"
int printer_TX_Pin = 8;  // This is the yellow wire
int printer_RX_Pin = 9;  // This is the green wire
Adafruit_Thermal printer(printer_RX_Pin, printer_TX_Pin);

void setupPrinter() {
  printer.begin();
};

void doPrint(char* output) {
  Serial.print("Will print: ");
  Serial.print(output);
  Serial.print("\n");
  printer.println(output);
  printer.feed(2);
}

void setup() {
  setupPrinter();
  doPrint("This is a test to see if it will print only from power supply");
}

void loop() {
}

That code works fine if the arduino and printer are plugged into 5v and the arduino is also plugged in to a computer with USB. Once I remove the USB cable it starts printing:
This is a test to see if it will
This is a test to see if it will
This is a test to see if it will
This is a test to see if it will
This is a test to see if it will

over and over infinitely. In other programs it prints a slightly garbled first line then stops. When I remove the serial.print lines, this doesn't occur. Why would that be?

Are you using a standard Arduino board? E.g. the Arduino Uno?

Yes, it is an arduino uno

It seems likely that your Arduino is repeatedly resetting, which means it's starting the program again from the beginning all the time. This can be caused by insufficient power.
For the standard 5v Arduino boards, the minimum recommended voltage for an external power supply is usually 7v. An on-board regulator brings it down to 5v.
Technically, you can run them directly from an external 5v supply. However, you have to ensure that it's properly regulated, and that you bypass the on-board regulator.
Obviously you also have to ensure your external supply is capable of sourcing sufficient current. If you're just running an Arduino and a small thermal printer then it's probably OK, but it's certainly worth checking.

I'm using a 5v 4amp power supply with the arduino, neopixels and the printer powered directly from it and then a PIR sensor and adafruit musicmaker shield + 3w 4ohm speaker powered from the arduino. The printers maximum current draw is 1.5 amps. Should I use a 7v supply in this case?
I have a program that runs the lights and sound and then resets only when it gets to the printing part. I suppose it could be when the printer runs this causes a problem with the power causing it to reset?
Why would having the USB help though? I thought that the usb power was bypassed when using DC power.

@Tom - A supply of 7-12V would be a good idea. It will be falling-back on the USB power when possible because your DC supply is too low.


text:
Unable to see SPI clock in oscilloscope
I am using the following code and when I am probing pin 13(SCK), I can't see any clock signal in the oscilloscope.
#include <SPI.h>
int SCS=10;
int SI=11;
int SCLK=13;
int EXTCOMIN=4;

void setup()
{
 pinMode(SCS,OUTPUT);
 pinMode(EXTCOMIN,OUTPUT);
 pinMode(SCLK,OUTPUT);
 digitalWrite(SCS,HIGH);
 tone(EXTCOMIN,50);
 SPI.setClockDivider(SPI_CLOCK_DIV16);
 SPI.begin();
}

void loop()
 {
 }

The SPI port is only clocked when you call SPI.transfer().

@EdgarBonet thanks, yeah now I am able to see the clock with the desired frequency

(META: This question has been answered in the comment section of the question itself. (And I'm also unable to comment to say that he should answer his own question...) That's why I'm putting this answer here.)
You might want to look into the basics of SPI, the clock will only oscillate when there is an actual data transaction in progress. (This will prevent desynchronisation by a bit. And will make both sides know when data is being send. Often along with a SS)
You can check this by continiously sending something in your code and then probe the clock pin with an ossciloscope.
You might want to accept this as an answer, so that nobody it's clear this question is already answered.


text:
Will the arduino power autoselection logic short the regulated 5V and the USB 5V?
From the reference design of the Arduino UNO r3, I find that USBVCC will be connected to +5V via mosfet T1 if Vin is below 6.6V.
Doesn't this short the two sources if Vin is just below 6.6V?
The datasheet for regulator U1 (NCP1117) mentions input range as low as 6.5V for the 5V version.
This question came to mind when researching if I can simultaneously power the arduino with USB and the 5V-pin. There are many warnings not to do so, and some say its ok anyway. I realise that this will short the USB 5V with my external 5V if Vin/PWRIN is not connected or less than 6.6V/~7.3V, but how bad is that considering that this may happen anyway by design (if the theory above is correct)?

The mosfet act like a diode. So only power can flow from the USB and not to the USB. Which should protect your computer backfeeding. Great question. I think you should look a the situation where USBVCC is high than your external 5v, and the reverse. I think it also depends on the type of power-supply.

If you connect a power supply directly to 5V pin on gpio it bypasses voltage regulator hence your board may be damaged if the power supply generates  spikes. But you can power it using 5V supply directly to 5V pin provided you are using a good quality power supply. If you are supplying the power via Vin or power jack there is additional voltage regulator in path giving extra security. Thus you need more 6.5v so as the output of the regulator is 5v. If you supply 5v to Vin the output is nearly 4v thus the board doesn't get enough power.

Do you often see 5V power supplies that generate spikes?

@Wirewrap: the farther away the power supply is from the target the more likely it is to pick up noise. A wall-wart, regulated, power supply over a 2m wire is generally not a good idea. It's always best to have the regulator as close as possible to the target, i.e. on the same PCB.


text:
Operating Sharp memory LCD with Arduino
I am trying to write to Sharp memory LCD "LS027B7DH01" which isn't going well for me. I didn't find any useful information for beginners. I just want to display any character on the LCD. Here's my code:
#include<SPI.h>

int SCS=10;
int SI=11;
int SCLK=13;
int EXTCOMIN=4;

 void setup()
 {
   pinMode(SCS,OUTPUT);
   pinMode(EXTCOMIN,OUTPUT);
   pinMode(SCLK,OUTPUT);
   pinMode(SI,OUTPUT);
   digitalWrite(SCS,HIGH);
   tone(EXTCOMIN,40);
   SPI.setClockDivider(SPI_CLOCK_DIV16);
   SPI.setBitOrder(MSBFIRST);
   SPI.setDataMode(SPI_MODE0);
   SPI.begin();
   SPI.transfer(0×20);
   delay(3000);
}

void loop()
 {
   SPI.transfer(0×80);
   delay(3000);
   for (byte i=0; i<30;i++)
    {
       SPI.transfer(i+1);
       delay(3000);
      for(int j=0; j<50;j++)
       {
         SPI.transfer(0x0F);
         delay(3000);
       }
       delay(3000);
       SPI.transfer(0×00);
    }
    delay(3000);
    SPI.transfer(0×00);
  }

What adapter-board are you using?

@Gerben: I am not using any adapter board, directly connected arduino with the sharp lcd

As the page Sharp Memory LCD Breakout A2 shows, it seems that you need some additional circuitry to drive the display, such as capacitors and resistors. This is why breakout boards are usually employed. Quoting the page:

This is a simple breakout board for Sharp’s new Memory LCD displays (
  LS013B4DN02 and LS013B4DN04). It brings all pins to a 0.1″ header and
  provides necessary caps and resistors. The new revision A2 also adds
  an optional boost converter for those wanting to run 5V display from
  sub 3.3V supply.The footprints are there, but parts are not populated
  to save cost. I’ve also added silk labels to the header pins on the
  back. This is an open design under CC BY SA license.

Of course, you can always make your own breakout circuit. For example, you could reproduce the breakout board using a breadboard and some resistors and capacitors. The schematics are provided on that page for A1

and A2

So, in short, either purchase a breakout board, or make one. Once you have done that , you can use the CraftyCoders Arduino Library
Hope that helps.

I am a beginner in coding but I don't want to use libraries written by someone. I want to learn how to code the Sharp Memory LCD maybe starting with writing a character to the LCD. I am trying hard for the past two days but it isn't going well. I am able to turn on the display and the clear command is working but the write command is not working. I have added the code above, which I am working on.                                                                                As far as hardware is concerned, I have followed the above connections in my breakout  board.

@Naresh, You should use the library to validatie that your connections and the display itself are working. After that your can create your own library/driver code.

I looked at this question as I too plan to drive a Sharp Memory LCD manually with my own code at some point.  From your question and comments I think you are going about it the wrong way, even if you are already very proficient with the electronics side of the task.
As mentioned, the breakout board is the easiest way to connect the screen and the library is the easiest way to program it.  I suggest you use both initially and then replace them one by one.  I did this when driving a 32x32 LED matrix.
Once you have a little bit of code running that displays what you want on the screen, try removing the breakout board and wiring the display yourself without changing the code at all.  If the display is not what you expect, you know the problem is in the wiring so you don't waste time looking into your code.
Once the wiring is sorted, start on the driver code.  Leave the wiring and your code that makes the display show what you want untouched so that you know any problems are in your driver code.  The other advantage of this is that you have the working library as reference for how the screen works and what signals to send with what sort of timing.
As a pointer to why your code is not doing what you expect, I think you may be misunderstanding how the screen works.  Your question and code suggest you may be trying to display ASCII characters on the screen which I believe can be done easily with some LCD displays but I'm fairly sure that these LCDs are not character based - you have to manually set or clear each individual dot.  I think the minimum number of dots you can set at a time is a full single line of the display.
In your code you have a delay of 3000ms after every byte send.  At that rate it would take 2mins 30secs just to transfer the data for a single line of the screen so maybe you are sending the correct data, but are not waiting long enough to see the results.  I've also read that you have to do something (sorry, not quite sure what) at least once per second to prevent problems with the screen - this suggests that taking over 2mins to send a line of data could not work as you expect.


text:
Multiple interrupts in same sketch
I am trying to create an Arduino program that combines a pulse sensor (that measures the Beats Per Minutes) and a music shield. I am experiencing some difficulties with the coding because the pulse sensor has an extensive interrupt routine that occurs every 2ms while the music shield has its own interrupt.
    Through research I have found that the Arduino Uno cannot have two interrupt routines at
    the same time.

Is it possible to code around this issue in order to have both the interrupt
           routines worK?

I am attaching the code below:
//Include Music Shield Library
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>

// Define everything needed for the Music Shield
#define BREAKOUT_RESET  9     // VS1053 reset pin (output)
#define BREAKOUT_CS     10    // VS1053 chip select pin (output)
#define BREAKOUT_DCS    8     // VS1053 Data/command select pin (output)
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7       // VS1053 chip select pin (output)
#define SHIELD_DCS    6       // VS1053 Data/command select pin (output)
#define CARDCS 4              // Card chip select pin
#define DREQ 3                // VS1053 Data request, ideally an Interrupt pin

//Explain what musicplayer means
Adafruit_VS1053_FilePlayer musicPlayer =
  // create breakout-example object!
  //Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);

//Variables for the Pulse Sensor
int pulsePin = 0;                   // Pulse Sensor purple wire connected to analog pin 0
//These variables are volatile because they are used during the interrupt service routine!
volatile int BPM;                   // used to hold the pulse rate
volatile int Signal;                // holds the incoming raw data
volatile int IBI = 600;             // holds the time between beats, must be seeded!
volatile boolean Pulse = false;     // true when pulse wave is high, false when it's low
volatile boolean QS = false;        // becomes true when Arduoino finds a beat.

//Define integer range for the switchcase map function
const int sensorMin = 70;           // sensor minimum, dicovered through research MAY CHANGE
const int sensorMax = 230;          // sensor maximum, discovered through research MAY CHANGE

//Now we are going to set up the sensor and the shield.
//The swtichcase does not need setup because we are not using the serial monitor for it.
void setup(){
Serial.begin(115200);
  Serial.println("Adafruit VS1053 Simple Test");
  interruptSetup();                 // sets up to read Pulse Sensor signal every 2mS
//Now we setup the rest of the shield.

  if (! musicPlayer.begin()) {      // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }
  Serial.println(F("VS1053 found"));

  SD.begin(CARDCS);    // initialise the SD card

  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(05,05);

  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int

}
//Void setup is done, now we tell the arduino what to do with all this information.

void loop(){
   // read the sensor:
  int sensorReading = analogRead(A0);
  //A0 should be BPM
  // map the sensor range to a range of four options:
  int range = map(sensorReading, sensorMin, sensorMax, 0, 4);

//In our map range 0=70-110, 1=110-150, 2=150-190, 3=190-230, 4=end(DEAD)
// do something different depending on the
// range value:
//Track 1 is resting music, track 2 is medium beat, track 3 is fast beat, and track 4 is continous beeps.
  switch (range) {
  case 0:    // 70BPM - 110 BPM
    Serial.println(F("Playing track 001"));
    musicPlayer.playFullFile("track001.mp3");
  case 1:    // 110 BPM - 150 BPM
    Serial.println(F("Playing track 002"));
    musicPlayer.startPlayingFile("track002.mp3");
  case 2:    // 150 BPM - 190 BPM
    Serial.println(F("Playing track 003"));
    musicPlayer.startPlayingFile("track003.mp3");
  case 3:    // 190 BPM - 230 BPM
    Serial.println(F("Dangerous"));
    musicPlayer.startPlayingFile("track004.mp3");
  case 4:    // DEAD
    Serial.println(F("DEAD"));
    musicPlayer.startPlayingFile("track005.mp3");
    break;
  }
  delay(1);        //This is the delay of the switchcase.
                   //The Music Shield Requests 100, so this MAY CHANGE
}

volatile int rate[10];                    // array to hold last ten IBI values
volatile unsigned long sampleCounter = 0;          // used to determine pulse timing
volatile unsigned long lastBeatTime = 0;           // used to find IBI
volatile int P =512;                      // used to find peak in pulse wave, seeded
volatile int T = 512;                     // used to find trough in pulse wave, seeded
volatile int thresh = 512;                // used to find instant moment of heart beat, seeded
volatile int amp = 100;                   // used to hold amplitude of pulse waveform, seeded
volatile boolean firstBeat = true;        // used to seed rate array so we startup with reasonable BPM
volatile boolean secondBeat = false;      // used to seed rate array so we startup with reasonable BPM

void interruptSetup(){
  // Initializes Timer2 to throw an interrupt every 2mS.
  TCCR2A = 0x02;     // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE
  TCCR2B = 0x06;     // DON'T FORCE COMPARE, 256 PRESCALER
  OCR2A = 0X7C;      // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE
  TIMSK2 = 0x02;     // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A
  sei();             // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED
}

// THIS IS THE TIMER 2 INTERRUPT SERVICE ROUTINE.
// Timer 2 makes sure that we take a reading every 2 miliseconds
ISR(TIMER2_COMPA_vect){                         // triggered when Timer2 counts to 124
  cli();                                      // disable interrupts while we do this
  Signal = analogRead(pulsePin);              // read the Pulse Sensor
  sampleCounter += 2;                         // keep track of the time in mS with this variable
  int N = sampleCounter - lastBeatTime;       // monitor the time since the last beat to avoid noise

    //  find the peak and trough of the pulse wave
  if(Signal < thresh && N > (IBI/5)*3){       // avoid dichrotic noise by waiting 3/5 of last IBI
    if (Signal < T){                        // T is the trough
      T = Signal;                         // keep track of lowest point in pulse wave
    }
  }

  if(Signal > thresh && Signal > P){          // thresh condition helps avoid noise
    P = Signal;                             // P is the peak
  }                                        // keep track of highest point in pulse wave

  //  NOW IT'S TIME TO LOOK FOR THE HEART BEAT
  // signal surges up in value every time there is a pulse
  if (N > 250){                                   // avoid high frequency noise
    if ( (Signal > thresh) && (Pulse == false) && (N > (IBI/5)*3) ){
      Pulse = true;                               // set the Pulse flag when we think there is a pulse
      IBI = sampleCounter - lastBeatTime;         // measure time between beats in mS
      lastBeatTime = sampleCounter;               // keep track of time for next pulse

      if(secondBeat){                        // if this is the second beat, if secondBeat == TRUE
        secondBeat = false;                  // clear secondBeat flag
        for(int i=0; i<=9; i++){             // seed the running total to get a realisitic BPM at startup
          rate[i] = IBI;
        }
      }

      if(firstBeat){                         // if it's the first time we found a beat, if firstBeat == TRUE
        firstBeat = false;                   // clear firstBeat flag
        secondBeat = true;                   // set the second beat flag
        sei();                               // enable interrupts again
        return;                              // IBI value is unreliable so discard it
      }

      // keep a running total of the last 10 IBI values
      word runningTotal = 0;                  // clear the runningTotal variable

      for(int i=0; i<=8; i++){                // shift data in the rate array
        rate[i] = rate[i+1];                  // and drop the oldest IBI value
        runningTotal += rate[i];              // add up the 9 oldest IBI values
      }

      rate[9] = IBI;                          // add the latest IBI to the rate array
      runningTotal += rate[9];                // add the latest IBI to runningTotal
      runningTotal /= 10;                     // average the last 10 IBI values
      BPM = 60000/runningTotal;               // how many beats can fit into a minute? that's BPM!
      QS = true;                              // set Quantified Self flag
      // QS FLAG IS NOT CLEARED INSIDE THIS ISR
    }
  }

  if (Signal < thresh && Pulse == true){   // when the values are going down, the beat is over
    Pulse = false;                         // reset the Pulse flag so we can do it again
    amp = P - T;                           // get amplitude of the pulse wave
    thresh = amp/2 + T;                    // set thresh at 50% of the amplitude
    P = thresh;                            // reset these for next time
    T = thresh;
  }

  if (N > 2500){                           // if 2.5 seconds go by without a beat
    thresh = 512;                          // set thresh default
    P = 512;                               // set P default
    T = 512;                               // set T default
    lastBeatTime = sampleCounter;          // bring the lastBeatTime up to date
    firstBeat = true;                      // set these to avoid noise
    secondBeat = false;                    // when we get the heartbeat back
  }

  sei();                                   // enable interrupts when youre done!
}// end isr

I wrote most of the SFEMP3Shield library. Where it appears that AdaFruit based much of theirs on. That said I have used Timer1 library with mine just fine to invoke the filling of the VS1053.
Where I am suspicious that AdaFruit's Library's did not Interrupt lock out the SPI packets. As I did on the SFEMP3Shield library, as to keep other things from messing up the frame. Where a brief skim of your code, initially looks fine.
You have not described your symptoms.
Where as using 2ms IRQ's and noting the VS1053 library reads the SdCard in 500byte chunks I image these reads are blocking and corrupting your 2ms ISR.
You can try to slow them down, just to see if they stop getting messed up.
You can try to using the polling method of the VS1053, instead of interrupts.
You can try to use the more feature mature SFEMP3Shield library and its documentation noting that it also uses the more mature SdFat. As the stock SD library may be part of your problem.


text:
Using an Arduino board to program an AVR
I think the arduino board is awesome.
Though I'm not interested in the library and IDE at all...
Is there a way, to use an AVR 328p, as you normally would, on an arduino board?
I like how arduino's can be programmed through serial, can get powered through serial and I often use serial as a debugging option. Making my own board (with ICSP programmer) would not be able to do this (withouth bootloader).

The Question
Do I have to use all the stuff from arduino?

Can I use my own compiler for an arduino board? (GNU-GCC / AVR)
Can I use my own IDE for an arduino board? (Eclipse / Atmel Studio)
Can I still program through serial then? (Does the bootloader care which compiler I used? Does Eclipse/AVR studio have the options to program through serial?)
Other stuff I should take in mind. (Annoying things like AVR studio not having a COM port window, though that's an easy fix.)

Edit: We've programmed an AVR 328P (GNU-GCC / Eclipse / ICSP) in school, so I know it takes quite some work to get the compiler set up, working with Eclipse. You don't have to completely describe the proces :) Just to avoid someone spending hours on an answer that's easily found on the internet.
(On my search for this subject I could only find people doing the other way around, getting an 328p chip to work with arduino)

Hope this helps. If my answer is insufficient, you can suggest me improvements for the comments.

FYI, the Arduino IDE works on top of avr-gcc, the GNU binutils and avrdude. The Arduino core library is built on top of avr-libc. If you wish, you can use the library without the IDE and vice-versa.

I actually didn't know that, sounds interesting.
I just don't want too much overhead. The bootloader is okay I think as it enables the serial uploading of code, which is great for my user experience.
But apart from that I try to make it as "professional" as possible, how people in real companies work. (Please don't take this as an 'insult').
I believe Eclipse is easier to use, but was worried it might not work as well with the arduino (uploading through serial). And personally I don't like it to use libraries (though I probably will for some things) but mostly from the chip manufacturer self.

Do I have to use all the stuff from arduino?

A = No!

Can I use my own compiler for an arduino board? (GNU-GCC / AVR)
Can I use my own IDE for an arduino board? (Eclipse / Atmel Studio)
Can I still program through serial then? (Does the bootloader care which

Of Course! I use Eclipse IDE and I programming boards with Arduino bootloader directly in C/C++ using avr-gcc and avrdude.
Configuring Eclipse
First, let's download a plug-in for integrating AVR GCC and Avrdude + Eclipse IDE
To install the plug-in, point to the menu "Help> Install new software":

We will set a new location to download the plugin. Click the "Add ..." and type: AVR - Eclipse and the URL: http://avr-eclipse.sourceforge.net/updatesite

Now select the plugin that appeared in the list and click "Next":

Next, next, "I Acept the terms...", restart...
Now we install the plug-in, we will set it up. Point to the menu "Window> Preferences." Click in "AVRDUDE". The following screen:

On the next screen "AVR DUDE" let's set our recorder. Click "Add" to "Programmer configuration". Search for "Arduino".

Or, if you prefer, you can program making use of avr libraries in own Arduino IDE. Try to upload the following code into an Arduino board! While a blink costs almost 1,056 bytes of memory using an Arduino Uno, the following code uses only 164 bytes and does the same thing :)
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>

#define set_bit(Y,bit_x) (Y|=(1<<bit_x))
#define clr_bit(Y,bit_x) (Y&=~(1<<bit_x))
#define tst_bit(Y,bit_x) (Y&(1<<bit_x))
#define cpl_bit(Y,bit_x) (Y^=(1<<bit_x))

#define LED PB5

int main( ){
    DDRB = 0xFF;

    while(1){
        cpl_bit(PORTB,LED);
        _delay_ms(200);
    }
}

If you use Linux, you can take a sudo cat/dev/ttyACM0 to detect what lies serial and echo "string" >> /dev/ttyACM0 to send data.

This is (I believe) exactly how we did it at school.
Though would this still enable me to program the arduino through the serial connection? Withouth an ICSP/USBasp programmer?

Yes, you can program it without a ICSP/USBasp programmer. Just change the recorder's type to "Arduino" on Eclipse IDE. I did not have another example of photo, in my photo is "USBasp" but just search for Arduino and exit programming. You can also use the Arduino IDE typing code directly in C ++. Test my example :) What is your Arduino board? Well, she must have a conversion circuit Serial/TTL. Sometimes is a ATmega8 sometimes one FTDI chip. (Sorry my english)

I've not yet bought an arduino board.
Though I think of going for an arduino nano breadboard (USB), one of those you can put on a breadboard.
They seem to have ICSP header also, but I think it's inconvenient to have 2 USB's going to your PC (one for serial and one for uploading code)
But if it's so that I can upload code through serial, this is/will be the answer?
(It was more towards a theoretical question, though you did really give in-depth explanation, might save me (and others) some time :D)

I recommend you buy an Arduino Uno. You can take the ATmega328P and put it on a breadboard and can write the bootloader in other chips (bootloader is a firmware header responsible for writing the code for serial). What about the upload, you'll use only one USB. When recording via ICSP is used SPI communication. But the Arduino can be recorded by the same Serial and Serial port is for communication. In my projects I use Eclipse and I record my atmegas using an Arduino board. Then just take them out and add the PCB project.

See this and this

Hmm, I've actually looked at that, but it costs more and also needs a FTDI chip (as soon as you take the MCU off the arduino board.
When the ATmega 328 (in the nano arduino) has the bootloader, it's good to go, fully serial? ;D
And even then the nano arduino has an ICSP header which I could use?
But anyway, this question seems solved! It is possible, but the details may vary for each user.


text:
If I have a group of Arduinos connected via I2C, can one Arduino cause the rest to freeze?
I have a group of four Arduino boards connected via I2C.  One is the master, which sends and receives values from all of the others.  I noticed that the Master will stop executing its loop if power is removed from one of the other Arduino boards.
Can one Arduino in a I2C group cause the rest to freeze?
Is there a way to prevent this?
I am using one of the Arduino boards to connect to a server via network shield and I don't want the other Arduino boards to be effected if the networked Arduino freezes.

It really depends on the code that you are using.  Can you pair down your code and post the master and slave i2c portions so we can have a look?

I wish I still had it, but that code got re written and I have not seen the problem again.  If I se it happen again , I'll update the question.

More specifically, the question should really be if the I2C code (library?) and any surrounding code can handle failures of the remote end, or it if will sit and wait forever, and if it can possibly get into a state that is not recoverable even if the remote end does start operating normally again (such as after the remote, but not local, end is reset).

Sounds like the unpowered node pulled down the I2C +5V. I've also had I2C devices not work when the arduino is powered by 5V plug (but does with USB power).

There are a number of places in the standard Wire library where the code goes into a tight loop waiting for an interrupt to occur. If that is missed for some reason, it will loop indefinitely.
By removing power from one of your devices you may be introducing electrical conditions that prevent the I2C messages from being transmitted properly (possibly just noise). Alternatively the device may parasitically power up from the SDA/SCL data and then behave in unpredictable ways. It is probably unwise to do this.
There is an alternative I2C master library at http://dsscircuits.com/articles/arduino-i2c-master-library which does not hang (I believe it times out instead).

I can say from personal experience, I had a similar event. I had a logic analyzer hooked up and was using it. I got the code working the way I wanted.  A day later when I tried it the code failed.  Turned to be because I had not powered up the logic analyzer and it was still hooked up.  If I unhooked it or powered it on everything worked fine.  This was on an Netduino BTW, but it leads me to believe (not being an electronics person per se) that yes it very possible if some unexpected load is on the I2C bus.


text:
What is the best transmitter/receiver to use with an Arduino RC?
I want to customize an RC car that I have because the controller is gone. I'm going to use an Arduino with a custom motor controller but I have no idea what to use for the transmitter/receiver. I've seen some IR sensors being used but I want something that uses a frequency channel. Has anyone had experience doing this? What is the easiest way to go about accomplishing a remote controlled Arduino car?

That depends largely what is controlling it
Some options include:

wifi, if you have an expansion board, from a PC or phone (spec says: 66ft/20m)
bluetooth works great, directly from your phone (spec says: 32ft/10m - 320ft/100m)
433mhz ASK transmitter/receiver from another Arduino or other hand-designed circuit (spec says: 100m/320ft)
Infrared receiver - from a TV remote! (range unknown, depends on remote & conditions; would not trust it 10m outside without testing).
Cellphone network - longest range (nationwide!). If you get a cheap android to do some of the work, you can use the phone's compass & gps & extra processing power, as well as the camera(s)!
Remote control. I know you said you lost yours, but in case someone else is looking here, you can hook up an rc receiver to an Arduino fairly easily. https://www.sparkfun.com/tutorials/348 for more info.

Many of these ranges specified will depend on the antenna. If your car can tell it's lost signal, then it can stop; otherwise you have to outrun it, or wait for it to hit a wall.
Edited to include cellphone network, and added ranges to options

Here is a link to a pair of Arduino compatible wireless transceivers. One of the listed applications in the description is "remote control systems such as RC vehicles," so I think this product would suit your project well.
According to the reviews / answers to questions on Amazon, the transceivers have an reliable range of just around 120 feet, so this component would be entirely appropriate in a remote-controlled build.

You need two arduinos for this, and 120 feet isn't very far, but thanks. +1


text:
How to generate gcode for Arduino Mega 2560 and Ramps 1.4 CNC Router
I had a Prusa I3 3D Printer which use Arduino Mega 2560, Ramps 1.4 and Pololu - A4988 Stepper Motor Driver.

I want to convert my 3D printer to CNC Router using my Dremel with Flexible shaft like this.

I found the one project on instructables.com at here
http://www.instructables.com/id/Arduino-Controlled-CNC-3D-Printer
They give config for Mega 2560 as CNC router.
But i don't know how to generate g-code for these cnc router.
Please help me to generate g-code from STL, DXF and Image(PNG or SVG) files to use with this type of cnc router.

Inkscape (free) will generate gcode from an svg using "gcode tools" add-on (also free)

For generating g-code from an SVG, you could try to parse the SVG into a set of relative commands, and using the relative commands to generate G-code. Since you were originally using the frame as a 3d printer and now you want to use this as a CNC machine, you could try to invert the data. But, for generating the code I would go read up on how to parse the various file formats, and read the specs on each of the formats. However, most of the file formats you listed are proprietary, and you won't be able to find an open spec for them.
Of the formats that you listed, it would probably be the easiest to parse the SVG, as it's an open spec, and is a lot like XML.
This is going to be really difficult to actually do, because you're essentially reimplementing a full CNC controller.
I would start with getting 2 dimensional stuff down like drawing shapes and setting routing depth.
Some Resources
Here are some resources that might help you with parsing the various file formats. I only listed the ones that have an open standard.

http://www.w3schools.com/svg/default.asp
This link describes the SVG format, and it does a fairly decent job at it.
http://en.wikipedia.org/wiki/G-code
http://en.wikipedia.org/wiki/STL_%28file_format%29


text:
Portable power for an UNO with a nrf24l01+ attached?
Okay so I have an UNO that has an nrf24l01+ attached. I want it to be completely wireless so free of the 5v USB power and the 12V wall plug. In this case what can I use? I do not wish to plug the power directly into the Vin as I am relatively new and afraid that it might fry the board. So I wish to plug it into the barrel jack. So I have read that using a 9v battery to power UNO is a waste of power as most of the power is translated into heat. Also, using 4 AA batteries seem to be a good solution except that I'm not sure if it has enough power for nrf24l01+ as I've read that an arduino with nrf24l01+ on batteries creates an unstable wireless node. I would like some help on what I can power the UNO with.

Vin is the same as the barrel jack (they are directly connected on the PCB). The NRF24L01 requires at least 2.7v. The uno board is however very inefficient (e.g. the usb-to-serial chip is always powered).

Oh I thought that the Vin bypasses the voltage regulator but it turns out that its the 5v and 3.3v that does bypasses it, not the Vin. Despite the fact that the uno is inefficient, thats the board that I need to use. So back to the question, since it requires at least 2.7v, 4 AA batteries of  6V should be enough right? I am unable to try it out as of now as I do not have the time to buy the necessary things to try...

That is kind of pushing the limits. 6v is the absolute minimum the voltage 5v regulator requires. If the batteries are drained a bit, they will go under this 6v limit. You could use 4 rechargable (1.2v) batteries to give you 4.8V, which you can connect directly the the 5v rail. But don't expect to get more than a day of battery life.

Hmmm... Alright. Thanks for the advice. I guess if no one else has solutions I will use 6 AA batts of 9V instead of a straight 9v batt since I need a high current. Thanks!

I've used the usb battery chargers (marketed to recharge cell phones) with great success on many different Arduino boards. They come in a variety of mAH capacities and are easily recharged with any powered USB port/power adapter.
Here's a link to one I've used. (I'm not affiliated with Duracell in any way).
http://ww2.duracell.com/en-US/product/instant-usb-charger.jspx

this is certainly a easy off the shelf solution, which likely suits this user

Sorry for the long wait in accepting your answer. I was setting up the exhibition in a location that was devoid of Wifi. I eventually went for the 6AA batts. But seeing your solution, I think it is the best and easiest solution. And its off the shelf as well!

Brilliant, much easier than trying to get batteries into the DC barrel adapter, which is what I was trying to do (and can’t find the barrel size/type anywhere!)

To get an idea of run time, I used this battery to power an Uno with a photocell attached for at least 16 hours. I was running a sketch to record the amount of sunlight to determine the best place for some tomato plants. The sketch didn't use any low power techniques. https://github.com/linhartr22/LightMeterLogger

Firstly if you only need short runs, go with the usb battery pack answer, but if you need the longest time from least batteries:
As has been pointed out, for best battery consumption an arduino board is not efficient due to power regulators and led lights. For best performance you want a standalone 328 chip with its BOD (brown out detector) reduced to 1.8v and then you can run it and the nrf24 chip off 2x AA batteries.
But all this might be a bit beyond you.
One thing though that will help your battery life is a PNP transistor or Mosfet on the +ve of your nrf24l01+ module triggered by a arduino io pin. as these power amplified versions dont sleep (per say, the chip does but not the PA) so it will always be consuming a large amount of power regardless of state. So just use your io pin to power it on and off for each use.
(that is unless you need it on always for recieving, in which case this wont help)


text:
time error in controlling a clock
I have designed and 3d printed a clock.
I am controlling the clock using a Arduino sketch running on a Attiny2313. The stepper motor I am using is a 12v 1:12 ratio stepper. The total number of steps per revolution are 288.
The problem I am facing is that I am unable to get the time right. I have got the steps per revolution of the minute ring bang on, but some how the motor gains 10/11 minutes every 24 hours.
I have used a lot of the code from the stepper motor library. I am not using the stepper motor library as the code gets larger than what can fit into the 2k attiny memory.
Any help is appreciated.
int number_of_steps = 288;
int motor_pin_1 = 9;
int motor_pin_2 = 10;
int motor_pin_3 = 11;
int motor_pin_4 = 12;
int ledpin = 13;
int delayTime = 4;
int buttonPin = 4;
int buttonState = 0;
int enablepin = 8;
int whatspeed = 40;
int last_step_time =0;
int step_number = 0;
[color=red]int blinkDelay = 939; [/color]
int step_delay = 60L * 1000L / number_of_steps / whatspeed;
int step_direction = 0;
void setup() {

 pinMode(motor_pin_1, OUTPUT);
 pinMode(motor_pin_2, OUTPUT);
 pinMode(motor_pin_3, OUTPUT);
 pinMode(motor_pin_4, OUTPUT);
 pinMode(buttonPin,INPUT);
 pinMode(ledpin, OUTPUT);
 pinMode(enablepin,OUTPUT);

}

void loop() {
 buttonState = digitalRead(buttonPin);
 if (buttonState ==HIGH){
   enablemotor();
   movestep(20);
   digitalWrite(ledpin,HIGH);
 }
 else{
   digitalWrite(ledpin,LOW);

   for (int xx = 0; xx<59;xx ++){

     enablemotor();
     movestep(42);
     //delay(100);
     motoroff();
     blinkk();
   }
   enablemotor();
   movestep(89);//85;

   motoroff();
   blinkk();
  //delay(3000);
 }
}

void enablemotor(){
 digitalWrite(enablepin,HIGH);
}

void movestep(int steps_to_move){
 int steps_left = abs(steps_to_move);

 if (steps_to_move > 0) {
   step_direction = 1;
 }
 if (steps_to_move < 0) {
   step_direction = 0;
 }

 while(steps_left > 0) {
   // if (millis() - last_step_time >= step_delay ) {
   //last_step_time = millis();
   if ( step_direction == 1 ){
     step_number++;
     delay(step_delay);
     if (step_number == number_of_steps) {
       step_number = 0;
     }
   }
   else {
     if (step_number ==0){
       step_number = number_of_steps;
     }
     step_number--;
   }
   steps_left--;

   stepmotor(step_number % 4);

   //}
 }
}

void stepmotor(int thisStep){

 switch (thisStep) {
 case 0:    // 1010
   digitalWrite(motor_pin_1, HIGH);
   digitalWrite(motor_pin_2, LOW);
   digitalWrite(motor_pin_3, HIGH);
   digitalWrite(motor_pin_4, LOW);
   break;
 case 1:    // 0110
   digitalWrite(motor_pin_1, LOW);
   digitalWrite(motor_pin_2, HIGH);
   digitalWrite(motor_pin_3, HIGH);
   digitalWrite(motor_pin_4, LOW);
   break;
 case 2:    //0101
   digitalWrite(motor_pin_1, LOW);
   digitalWrite(motor_pin_2, HIGH);
   digitalWrite(motor_pin_3, LOW);
   digitalWrite(motor_pin_4, HIGH);
   break;
 case 3:    //1001
   digitalWrite(motor_pin_1, HIGH);
   digitalWrite(motor_pin_2, LOW);
   digitalWrite(motor_pin_3, LOW);
   digitalWrite(motor_pin_4, HIGH);
   break;
 }

}

void blinkk(){
 for (int i = 0 ; i<30;i++){
   buttonState = digitalRead(buttonPin);
   if (buttonState ==HIGH){
     break;
   }
   else{
     digitalWrite(ledpin, HIGH);   // set the LED on
     delay(blinkDelay);  // 968           // wait for a second
     digitalWrite(ledpin, LOW);    // set the LED off
     delay(blinkDelay); //968
   }
 }
}

void motoroff(){
 digitalWrite(enablepin,LOW);
 digitalWrite(motor_pin_1, LOW);
 digitalWrite(motor_pin_2, LOW);
 digitalWrite(motor_pin_3, LOW);
 digitalWrite(motor_pin_4, LOW);

What is your clock source?

I guess the value for blinkDelay is too low. How did you even get that value? Even so, the clock of the ATTiny2313 isn't that accurate. Better get an RTC chip of sorts.

It is very difficult to accurately control timings with delay(),
because you have to account for the time needed to execute the rest of
the code, including interrupts. You can easily have better accuracy by
using millis() like this:
static unsigned long last_step_time;
unsigned long now = millis();
if (now - last_step_time >= step_delay) {
    do_one_step();
    last_step_time += step_delay;
}

This is almost what you have commented out in your own code, except that
millis() should be called only once per iteration, hence the now
variable.
This may still have less than perfect accuracy due to your clock source.
If your Arduino is clocked from a quartz you should be able to get
decent timing accuracy. If it is clocked from a ceramic oscillator you
are out of luck. In any case, you can always improve the accuracy by
calibrating your clock: you measure its drift and correct for it in
software. Then you have only to worry about thermal fluctuations of the
clock frequency, which should not be an issue with a quarts.
For best accuracy, you can use either an RTC or a watch crystal
connected directly to your ATmega chip. This last solution is only
possible if you go for a bare microcontroller, without the Arduino
board. See this answer
for more details about this option, as well as the way to correct
for the drift in software.

the millis i used in my code was acting weird. the clock worked for 288 steps and then the step delay value would become zero and the motor would stall . i couldnt figure out what was wrong and went back to using delay. i will try your code .

@ekaggrat: Beware I just edited a mistake in the code above. last_step_time should be incremented by step_delay instead of becoming now, because it is intended to contain the time when the motor should have been pulsed, irrespective of whether the pulse has been delayed by some interrupt.

You should consider using hardware timers (millis() uses this, see answer of edgarBonnet.
Or you might want to use a Real Time (Calendar) Clock chip, which often has even better accuracy (some even adjust to temperature).
Also a possibility is using a GPS module, and using the GPS time which should be extremely accurate and will not drift (since it's synchronized).
Post on AVR timer precision (hardware timers):
http://www.seanet.com/~karllunt/interval.html
RTC (Real Time Clock) example:
http://www.instructables.com/id/Real-Time-Clock-DS1302/
GPS example:
http://blog.arduino.cc/2014/01/06/simple-arduino-micro-gps-clock-project-arduinomicromonday/

millis() is based on a hardware timer, and is as accurate as your primary clock source.

@EdgarBonet I was unaware of that, edited it in my answer.
Though, you could say the primary clock source isn't 'accurate'.
It'll drift in time by temperature differences, some RTC's even adjust for this. And (somehow) synchronizing (gps?) would be the best way to go.

Yes. By “as accurate as” I mean: no more accurate, no less accurate. It’s synonymous with “as inaccurate as”.


text:
What is the maximum wire length for serial communication between two Arduinos?
I am building a project in which two Arduinos will be linked by three wires: TX an RX for serial communication and a common GND. What would be the maximum length of the wires here before communication gets affected?
I am using an Arduino Mega R3 on one side and an Arduino Mini on the other one.
I have no particular requirement for the Baud rate, I could use the lowest one if this helps in any way.

You need to specify

The order of range you are interested in - is it in the order of metres, tens of metres, kilometers or interstate ?:-) . ALL are possible with suitable compromise.
How you intend to connect to the circuit - direct Arduino pins, high/low buffer, differential drivers, ...

If you use 5V/0V "unipolar" then at say 9600 baud you can get many metres with suitable drivers. If you use an Arduino pin directly wire resistance and inductance will start to matter as range increases.
At 300 baud you can achiever hundreds of metres with twisted pair cables. As range increases aspects like cross-talk from the other circuit and external noise increase in importance. At longer ranges having 4 wires with signal + ground twisted together in each case helps BUT it is likely that at ranges of interest 2 wires plus ground will work OK.
If you are prepared to use enough voltage and slow enough signalling you can signal over thousands of miles - as was done with very early telegraph cables. The thousands of volts needed and signalling speeds of perhaps a few bits per second will be a disincentive in most cases.

The distance I would like to cover is approximately 40-50 metres from inside our house to the gate outside. My intention was to connect the relevant Arduino pins directly with a cable that I found from a previous intercom installation.

Some danger to Arduino with longish runs of cable. Induction, leakage, electrostatic charge. (Lightning & ground rise from power fault only maybe but ...). Reverse clamp diodes to power supply rails on all lines a good idea. Basic driver IC a VERY good idea. Even an xx74xx14 hex  Schmitt inverter IC at each end would be useful. (where xx is varies with family). Proper line drivers even better but that's a start. IF your Arduino is valuable use a buffer.

Thanks everyone for the comments and suggestions.
In order to find out if I can cover the given distance (ca. 40m) with a simple connection, I gave it a try with two Arduino Uno, respectively set up as a sender and receiver. The boards are directly connected via the TX/RX lines (pins 0 and 1) at 9600 bits per second. The sender sends out a test string every second while the receiver is listening for incoming data.  I am using an existing line (no info about the quality/specs of this cable.
Anyway, the sender/receiver pair seems to work without any problem at this distance and configuration.

Thanks, would you have any particular suggestion / link to an IC or driver chip?

@hobie  At 50 metres and 9600 baud you can probably achieve OK results (try it and see) with almost any 5V digital driver IC and even just digital output ICs. A useful starting point are the Schmitt trigger CMOS inverters typically 74xxx14, CDxxx14, MM.....14. Look for Schmitt triggered inverters, avoid the lowest drive power ones.

@hobie  This Digikey catalog search for Schmitt inverters quantity 5 price ordered  provides many alternatives. This 74LV1G14 single gate package costs 26c each in 1's and 5c in thousands. They can (probably) be used at the receiving end to produce squared up receive signals ...

@hobie and at around 30 mA at 4,5V Vcc (32 max) they provide a useful amount of line drive. There are also many dedicated bus drivers and many otyer Schmitt gates.

This is not exactly what you are asking for but it would be robust and available at low cost in the form of arduino modules. The way I would do it is use a Can Driver and receiver on each end. They are inexpensive differential line drivers. There is nothing that prevents using Async at whatever baud you want up to about 1 megabaud. Run a wire for ground it helps. You will wind up using 5 conductors or 2.5 pairs of wire. Ethernet cable should work fine. You can send some power over the spare wires if you like. You also have the option of using some of the automatic CAN drivers that automatically switch to transmit mode when data is sent and receive otherwise, this will keep you to three wires.


text:
GSM dongle instead of GSM shield?
I googled for this problem many times and ended up with no results, so I decided to post it here.
Can we use a GSM Dongle (usb dongle) instead of a GSM shield (like SIM900 module) to send and receive SMS in Arduino? If so how it is possible?

YES you can with an Arduino Yùn
The dongle will have to be handled by the linux part of the board and doing so will leave you all the I/O pin free for your project.
You might want to check out this for the howto:
https://n00bsys0p.wordpress.com/2009/08/26/sending-recieving-sms-with-a-3g-device-in-linux/

this link was drives me to the correct track.i have done it in Ubuntu in my laptop and it was successful. next i gonna try it on my Galileo board

Not directly. The standard Arduino Uno doesn't have the hardware/software necessary to act as a USB host, which means it can't talk directly to other USB devices.
You might be able to get it work via a USB Host Shield. I don't know how compatible that is with GSM dongles though because I assume you can't install drivers on it. Additionally, if you're using a shield anyway, you might as well use a GSM shield.
If you're able to get an alternative board then another possibility might be the Arduino Yún. It has a USB host built-in which is operated by the Linux part of the board. I don't know for certain that it would handle a GSM dongle, but it may be worth looking into.

So all we need to accomplish  above task is a USB host port. i think Intel galileo generation 2 boards have a USB host port.that is the board which I going to use in my project.

No, not "all you need" - you need the port, and you need a software stack to drive it.

You can search for, or create your own 'breakout' board.
You could actually get an sim900 chip running on a breadboard.
I think  this might be most usefull to you: http://img01.cp.aliimg.com/imgextra/i2/87365807/T267qSXa4aXXXXXXXX_!!87365807.jpg
http://www.aliexpress.com/store/product/Gprs-module-gsm-gprs-module-sim900-development-board-mini-v2-module/124015_1030035160.html
Though this one is quite expensive. (As it doesn't even has a SIM900 on it?)
There is no reason the SIM900 can't work withouth arduino board..
But the reason it's used with an 'shield' is because it's easier to connect and enables to draw power from the arduino. (You do need a good supply for the sim900, it can have peak-power levels, which might reset your arduino)

So yes, you could make your own dongle based on a SIM900! Which works great for Embedded/Realtime (UNO).
But also, you might want to use a board that has Linux (But bear in mind that this is 'completely' different from the UNO. Check the other answer in this case.
Edited, Chris explained me you simply can't use an usb device withouth a USB host with USB driving software.

A USB stick would not work at all with a another USB peripheral such as a "serial TTL converter" - it requires not only a USB host, but software to drive that.

@ChrisStratton I failed common sense there.
Edited my answer.
Also, you could make a SIM900-based 'dongle' (not for usb, but UART)?
Using the Yún could be overkill?

Usually, these usb dongles consist of two parts: the usb part, and the gsm part. If you can find the spec on the gsm chip, you might be able to bypass the usb part.
Unfortunately, these circuits are usually surface mount - tiny pins, tiny traces, and lots of them. Soldering them will probably be tricky.

also im in the try of that.YOU HAVE TO USE USB TO SERIAL CONVERTOR CIRCUIT TO ACCESS ARDUINO BY UART (mosi....... miso) connections .and the software in the dongle is the problem here.the difference between the gsm shield and the dongle is .........the SOFTWARE  FIREWALL you have to flash the dongle by your own risk.........try this


text:
do two arduinos that are linked to a common 9v rail and ground still need a common negative connection for a serial tx rx connection?
so that there a 2 wires rather than 3 to connect between the two for purposes of serial communication.  And the same question for 3 arduino megas on a common rail and using serial connections?

All voltages are ground referenced, hence the ground is the only (supply) connection required. Remote modules can be self-powered and signals will still be discriminated as long as ground is connected.

thank you for your prompt reply , the 9v and negative rail are connected for purposes of powering the arduino boards anyway.  I should have asked Do I need an additional connection between the grounds to that provided by the power connection.

If they're using a common ground then their grounds should be already connected.


text:
Arduino Nano For Home Automation
My question is about the arduino Nano or Micro and the smallest and cheapest way to control a bigger power source. I would wire it with a socket so that I could send a command from the board and a light would turn on for example.

A relay is a common way to allow a smaller power source to safely control a larger one. A relay is like a switch.
Here's some reference material about using a relay with a microcontroller. You shouldn't have much trouble finding more material now that you know what you're looking for.

So your question is: "How to control a bigger power source using the Arduino Nano or Micro".
This tutorial on youtube gives an explanation:
https://www.youtube.com/watch?v=sOz41WQF7wE
It's about a motor, but the answer is the same.
You should use a relais/mosfet
This one is actually pretty great also:
https://www.youtube.com/watch?v=Te5YYVZiOKs


text:
Arduino Nano Max Current Draw best Motors
I know that the Arduino Nano cannot source more than 40ma per pin. My question is there any type of motor or continuous rotation servo that I could use four of to make a robot without making the Nano shutdown. I would prefer the price to not exceed $10 in total.

Just add an transistor or mosfet. That way you can switch more that 40mA.

How would I do that. Could you provide a diagram. Also, could I do that with a PN222A or another common transistor?

PN222A can go upto 500mA. Example with diagram.

@Gerben - you should put that as an answer.


text:
Arduino Nano Motor
If I had four of these motors and attached them to the Arduino Nano on four separate digital pins or analog pins without transistors and a 9v power supply attached to the regular power supply input would that work?

Yes, but don't expect to win any races.
If you use analogWrite(HIGH) on your digital pins (3, 5, 9, 10, and 11) your motors should receive 40 mA max at 5V (see http://arduino.cc/en/Main/arduinoBoardNano). So the motors will run, just not very fast.
A switching transistor would be a very simple addition that would allow you to achieve higher current input to the motors and get their full potential.
If you want to reverse the direction of the motors you'll need to investigate getting a cheap motor driver board.


text:
How can I make a garage door laser sensor?
I would like to make a sensor that detects when my car is clear of a certain point. So, when backing in my car to my garage, I would have a beam and sensor. When the beam is broken, an LED light would turn on and then when the beam gets through, the light turns off and I know that the car will clear the garage door.
I am pretty sure I have to use either an Arduino or Raspberry Pi, but I'm completely new to home automation. There are a few other things I'd like to do but this is a good starter.
I don't know where to start.

I'd suggest adding a mirror, so you don't need wires at both sides of the garage. You don't even need an arduino. Laser, LDR or Phototrasistor, Transistor or Opamp, Potentiometer for fine-tuning triggerlevels, and an led. You could even just shine the laser on the photosensor of a cheap night-light.

@Gerben I love the night light idea.

I agree with @Gerben but would recommend a reflector so the mounting angle is not critical.  Having said all that I think you could do this more simply by using an ultrasonic range sensor.

You could also use a mirror so all the wiring is as the same side or the door.

I would recommend using laser and LDR. This will be very efficient and will not cause any problem due to light or ultrasonic deflecting. It will be precise by mm if you do thing right way. I made a simple porject back in 2005 using laser, LDR and relay.
Here what you need to do.
Get a laser, any laser will work. www.ebay.com/itm/6mm-650nm-DC-5V-5mW-Mini-Laser-Dot-shaped-Diode-Module-WL-Red-Copper-Head-Tube-/291089398593?pt=LH_DefaultDomain_2&hash=item43c647bb41
Get a PhotoResgister www.ebay.com/itm/Reliable-Hot-New-20-PCS-Photoresistor-GL5528-LDR-Photo-Resistors-Light-Dependent-/161434780484?pt=LH_DefaultDomain_2&hash=item2596434344
Put ldr in the dark box and drill a hole in it so that no other light can enter 2mm diameter hole will work.
Connect the LRD to your board. Fire laser and change status of indicator led by the value of ldr.
Check this link for refrence www.instructables.com/id/Arduino-Laser-Tripwire/?ALLSTEPS

I am pretty sure that Arduino would be enough for this project since the proper computation should not be that complex. Arduino Uno seems to be the simplest to start, at the same time not being too big for your application domain. However, you could also consider some smaller Arduino model, there would not be any "computational power" problem probably.
You could use an Infrared Proximity Sensor to check whether a car is present or not, here is a link that could be useful for this: http://arduinomega.blogspot.it/2011/05/infrared-long-range-sensor-gift-of.html
In this way, the system would light ON one or more LED(s) whenever the measured distance turns out to be less than some threshold value that you decide (maybe using a test-driven approach), and then light it/them OFF once the distance returns over the fixed threshold.
Hope this will be helpful.

Yeah, but I'm just not sure that IR will give me the accuracy. Essentially, as soon as I'm clear of a certain point, I want to trigger an action.

Looking at its characteristics, the sensor I linked to you above should be able to detect movement up to 150 cm far. So, it depends on how far from the car you plan your sensor to be in your project. However, consider that, even if IR sensors are not that accurate with respect to Ultrasonic sensors, for example, an object like a car would be easily detectable. As far as the responsiveness of the system is concerned, it depends on the frequency with which you perform your sensing. On the other hand, IR sensor are much more cheaper, and work well in closed/quite-dark places like a garage.

I'll look into it. I'd be curious to see how wide the detection area is. When the car is parked, there's only 2-3 inches between the car and door, ideally. Thanks!

You're welcome! Have a nice time working on your project!

I cant make out from the picture if you have consider this thought.
Install sensor at height so car tail breaks the beam.
Also It might not be ideal solution if you have multiple car lets say one Range rover SUV and another hatchback.
You might want to consider having multiple sensor from ground to around 4-5 feet.

Yep, that's exactly what I want to do. I back into a single-car garage, so essentially, as the car enters, the beam would be broken near the garage door. When the front of the car clears the door, the beam would pass and trigger the sensor.

You want a light sensor like at http://rookieelectronics.com/light-sensor-using-arduino/ - the usual way is infrared (same as remote controls), so you can't see it. You might want to blink the light, to get a more accurate signal (i.e. turn the led on; test the brightness; turn it off; test the brightness; find the difference) in different light conditions.
Personally, I would probably use a http://www.dx.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696#.VRH9k3WjlIc Ultrasonic distance sensor - but there are lots of ways to accomplish this.
Not an Arduino answer, but.... a friend of mine put his car in the exact place it should be, then hung a tennis ball from the roof, at the right place so it just touches the windscreen. Now, when he pulls into the car, he moves forward until the tennis ball touches his windscreen, and he knows he's in exactly the right place.

Ultrasonic could work, but the smooth curved surface of a car might deflect the waves at shallow angles without reflecting them back to the sensor, causing a false negative.

True. You'd have to think about where you put the ultrasonic. I would go for pointed at the license plate. Alternatively, if you place it pointing OUT from BELOW the license place, you could take it with you - LOL

Yeah, I've tried the tennis ball trick already. Problem is kids play with the ball. Also, because I'm backing in and the garage is dark and I have tinted windows, It's not clear when I hit the tennis ball.

I know some projects are just for the sake of the project alone but have you considered this no-tech solution?
http://www.instructables.com/id/Automatic-garage-parking-aid/

Hah. I loved the idea of the ball being tied to the garage door. Great stuff. However, because I back in to a single car garage with very tight tolerances, I wanted something more accurate and unchanging. If one of the kids was playing with the tennis ball, then suddenly I'm out a few inches and the garage door may come down on the front of the car.


text:
ESP8266 + Arduino Uno: Can't send AT Commands
I'm trying to get the ESP8266 up and running without a FTDI chip, just my Arduino Uno. But it seems really difficult. What I did:

attach the ESPs VCC directly to Arduino Uno 3.3V; RX->TX; TX->RX

Result: surprisingly worked for 2 mins, however the AT commands returned ERROR sometimes. (baud rate: 9600)

attach the ESPs VCC to 3.3V 500mA power supply; RX->TX; TX->RX

Result: AT commands don't work anymore, nothing is displayed in the serial monitor, not even my input; red LED constantly on.

attach the ESPs VCC to 3.3V 500mA power supply; TX->TX; RX->RX

Result: blue LED constantly on, no response, same as before

change back RX/TX connection, experimenting with baud rate (300 - 115200)

Result: blue LED flashes on start, flashes when something is sent (no matter what the baud rate is), however still no output at all.
Suddenly, I was also getting this error while uploading:

ser_recv(): programmer is not responding

Detaching the TX connection solved the problem. Btw, I am also using a voltage divider between TX of the Arduino and RX of the ESP.
Afterwards, the blue LED was on constantly again, even though I haven't changed the wiring... (really weird)
To me it looks like the Arduino Serial monitor isn't sending anything, because I don't even see my input. However, the Arduino can output stuff, therefore I assume a connection between Arduino and PC is existing. Maybe it has to do with the connection between TX -> RX, but I see no shorts, just an ordinary voltage divider (100 Ohm and 200 Ohm resistors).
As you might see, I spent a lot of time trying to figure this out. I'm kind of stuck now, as I'm not sure what else to try. If you have any ideas, tips or advice please leave an answer.
Sorry for my English, it's not my native language. If you don't understand something, feel free to ask.
Hope you can help me!

If you don't get the answer you need or just for future reference, there is a forum dedicated to the ESP8266 that can be found here ... http://www.esp8266.com/

Tx and Rx should be crossed; meaning connect Arduino Tx to ESP Rx and vice versa.
Your second (and first) attempts are correct. Use 1uF capacitor between Vcc and Gnd. This will provide a more
robust connection since the ESP can draw too much current which might cause it to reset.
When using external power supply, hook together the Arduino Gnd to the PS Gnd.
If you get "Programmer is not responding" - disconnect and reconnect the Arduino USB. Also, you shouldn't get this at all since you are not trying to program the Arduino, just use its FTDI as proxy to the ESP. Any serial terminal application can do it (you don't have to use the built-in terminal in Arduino IDE).

When the 8266 is powered from the Arduino there is barely power enough for sending. So there will be power glitches that makes the USB port inactive.
Even a short voltage drop seems to disable the USB port until it is pulled and reconnected.
I struggled with this. One solution is external power for the WiFi chip. One other solution is to put a 1000 uF capacitor on the 3V power line and ground. That has worked for me.

I have powered the ESP module with 3.3V of Arduino itself.
I too used to get the error always until I changed my settings to "no line ending" at the bottom of the serial monitor.
I had kept it to "NL & CR" from other answers that I read here, and that was the reason for errors I suppose. Anyway changing it gave me the AT OK.
You should try that first.

Put CH_PD HIGH for AT mode COM.
Note if you upgrade firmware you need to take CH_PD LOW to write new firmware.
Also note if you upgrade your firmware for the LUA com speed will probably default to 115200 and then SoftSerial wont work.
I found it best to test on Arduino Mega as has extra serial ports.