People who code: we want your input. Take the Survey
59

Know this is old but I ran onto it during my search for Nano(V3)'s not uploading so thought might help someone else. Problem is the bootloader - Arduino IDE BUT I Found an easy solution (right under my nose). I realized that my nano's had been uploading just fine then I had finally updated the Arduino AVR Boards from 1.6.20 to 1.6.21. I didn't think ...


18

This answer lists the 4 basic choices: HardwareSerial, always the best. Simply use the pre-defined Serial variable. On some Arduinos, there are extra HardwareSerial ports, called Serial1, Serial2, etc. The Nano only has Serial. AltSoftSerial, the best of the software serial libraries. Only one instance is allowed, and it is must be used on one of the ...


17

if (!(millis() % 500)) ... There are two issues with this. The first, and most obvious, is that the condition will be true for a full millisecond. During that millisecond you will be toggling the LED on and off very fast. Whether you end up doing an odd or even number of toggles is anyone's guess. The second and less obvious problem is that millis() skips ...


16

The ADC inside the Arduino does not measure voltage, but rather a voltage ratio. Namely the ratio from the voltage at the analog input to the voltage at the Vref pin. In the default configuration, the Vref pin is internally tied to the +5 V line. You can select to use instead an internal reference as Vref: analogReference(INTERNAL); This reference ...


14

The Arduino Nano cannot do 800 kb/s. As you can see in the source code, the bit duration is rounded to the nearest multiple of 8 CPU cycles. In your case, it is rounded to 3 × 8 CPU cycles, which yields a baud rate of 666.666 kb/s. That is 16% too slow, an error too large for any communication to be possible. At 400 kb/s ...


13

Well, it depends on what you have attached to the Arduino. If you are using the pins to do things you will definitely require more current. If you ONLY want to power the Arduino, then I calculated what I think it should be below. (You should also check with someone who owns this device for an experimental value, and not just a calculated value. ) Based on ...


13

This solved it for me. Download this driver Install it Run sudo nvram boot-args="kext-dev-mode=1" Reboot Serial ports now showed up in the Arduino IDE and also when I used ls -1 /dev/tty* Hopes this helps someone. Reference: This thread


13

Get yourself a Arduino Leonardo, Micro or Pro Micro (or Due, Zero, M0). Those can emulate a keyboard. Start with reading the Arduino Keyboard Mouse reference. The Arduino Nano can not use the Arduino Keyboard Mouse library. Since many years, there is a library called "V-USB" that requires some extra hardware and makes it possible for a ATmega328p ...


12

The main difference between the ATmega32u4 and the ATmega328P is that the 32u4 has onboard USB. When ATmega328P are used in an Arduino they are often coupled with an FTDI USB to serial chip. The FTDI chip is about $5 so this may be where the extra cost comes in. Having the USB chip separate is actually not a bad thing: The Atmega328P consumes less power ...


12

Depending on how recent a version of the AT Instruction Set interpreter your chip has, the two instructions you tried may not be valid ones; they are not listed in Espressif's ESP8266 AT Instruction Set document. Searches for either "CIOBAUD" or "IPR" in the current document (version 1.5.3) return no results. The baud rate commands are now "AT+UART_CUR" ...


11

I can suggest you to try this : AC DC Step Down Converter It is as small as the Apple's tiny cube, and it can be placed inside of a wall easily. (I'm personally using this with an arduino micro)


11

I successfully restored both boards using the reset button: Power off the board (I disconnected the USB cable from computer) Press and hold the reset button Connect USB cable (keep holding the reset button) Click "Upload Sketch" Wait a second or two until Arduino software says "Uploading..." in the status bar Release the reset button Use these steps to ...


11

This is to be expected. The other pins have nothing connected to it, so their voltage is floating. The Arduino MCU only has a single ADC. To read the different analog pins, it uses a multiplexer to connect the pin you want to read to the single ADC. The ADC inside the MCU have a "sample and hold" capacitor inside it. To read the voltage at the pin, it ...


11

A Uno which isn't doing anything useful except being turned on will use about 50 mA of current from the power jack at 9V. If you use 3 x alkaline AA batteries (giving a nominal voltage of 4.5V) directly into the 5V pin of the Arduino then you might get 2500 mAh which would be 50 hours at 50 mA per hour. You can save a considerable amount of power by using ...


10

Nowadays, most smartphones come with a charger that is linked to the USB plug of the phone. The charger for my HTC says: 5V, 1A, I guess this voltage must be regulated (but I haven't checked it has the charger is sealed). The charger itself has a female USB socket on which you can plug any USB cord to link to your Arduino. IMPORTANT! I have never tried it ...


10

Loop runs as long as loop needs to run. Instructions in a CPU run sequentially. The more instructions there are the longer it takes to run. The more code you put in loop the longer loop will run. There are two ways to know how long each iteration of loop will take: Profiling: Actively time each iteration of loop, though be warned, the act of timing ...


9

You can use fill_solid. For example fill_solid( leds, NUM_LEDS, CRGB(50,0,200)); Or fill_solid( leds, NUM_LEDS, CRGB::Red);


9

The reset on an Arduino does not erase anything. It merely restarts execution of an already uploaded program. Also the AVR needs to be powered on for it to realize whether it has been reset. Every time you power on an Arduino it automatically starts code execution from the beginning of the program in the flash memory.


9

A USB-powered Arduino Nano will have an ADC voltage reference which can't be relied on, due to the +/- 5% tolerance of the incoming USB voltage. On top of that, the Nano has an MBR0520 Schottky diode (D1) that will drop between 0.1 and 0.5 V depending on its own manufacturing tolerances, its temperature, and the current draw of your board. What can you ...


9

Here is an analogy for you to help you understand why using the IRQ is a good idea. Imagine you are at a conference. There's hundreds of you in the audience, and you are in a question and answer session with the person on the stage. Maybe their presentation has just come to the end and they're fielding questions from the audience. Lots of people have ...


9

Not only can you share the grounds - sharing the grounds is required for there to be any form of meaningful circuit for signals to get around the place. To copy-and-paste a blog post I wrote some time back: A lot of the time on the Arduino forums we get questions regarding wiring things together. One common format is: I want to connect my 12V powered ...


8

You don't need to add anymore components to your schematic. But you can leave some components. Before you're adding a button to your schematic please consider first how you want to detect your signal. A logic 1 as if a button is pressed? Or logic 0 as if a button is pressed. You can do this using pull-up and pull-down resistors. These resistors should be ...


8

The way to do this, since there is no digital value in between HIGH and LOW, is to actively create a signal on the pin you can recognise. Note that if the signal coming in to the pin is a datastream (a sequence of HIGH and LOW) that runs all the time this may not work reliably, but it's good for things like buttons and other simple sensors. Any signal on a ...


8

Is it an original Nano or a clone? The original Nano uses FTDI's FT232 ship, whereas clones use the CG340 USB-to-TTL chip. The former works fine straight away Mac OS Sierra, whereas the latter needs a driver. The CG340 driver doesn't work under Mac OS Sierra. Fortunately, someone patched the driver and made it available at GitHub. There you'll also find ...


8

One microsecond is only 16 CPU cycles. The CPU needs 4 cycles to prepare itself for servicing the interrupt (save the program counter, load the interrupt vector and clear the I bit in SREG). The interrupt vector itself is a jmp instruction that takes 2 cycles. When the ISR is done, it executes the reti instruction (return from interrupt) that takes 4 cycles....


8

Important information: Wire.write() does NOT send anything over the I2C lines. It just puts the data into the libraries internal buffer. The actual transmission is then done by Wire.endTransmission(). I2C is packaged transmission protocol. That means, that the transmission is done in confined data packages. In your master code you are calling Wire.write() ...


7

The last resort option is to open a 5v phone charger and replace the metal prongs that go in a socket with two wires, and replace the usb socket with another pair of wires that go the arduino board, but still, an Arduino Pro Mini or an Arduino Nano is smaller than the phone charger. You will probably have to do something like that. Because of the nature of ...


7

The Nano boards that I have used all have pins on 0.1" (2.54mm) spacing. There are single-row female connectors that are designed to accept 0.025" square pins. One example is Samtec 32 position female header but there are many others. Note that these female headers are available to accept either 0.018" round or 0.025" square pins. My great preference is ...


7

A divider is used to (as the name suggests) reduce a higher voltage to a lower voltage. Using a divider on a small voltage will only make it smaller and harder to measure. To get the most out of your measuring you need to have the reference voltage as close to the highest voltage you want to measure as possible. The highest voltage that can be applied is ...


7

Is there a way to compile arduino code without automatically uploading it, so that I can put the pre-compiled binary up for download on a website? Yes, you can save the .hex file produced by the compiler. If you turn on verbose output from the compiler you can find the temporary directory where it is stored. Simply copy from there to a folder for download ...


Only top voted, non community-wiki answers of a minimum length are eligible