Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arduino-mega]

A microcontroller board based on the ATmega2560 or 1280 chip. Use this tag for questions specifically regarding the Mega, and not just general Arduino usage.

49
votes
11answers
265k views

How do I split an incoming string?

I am sending a list of servo positions via the serial connection to the arduino in the following format 1:90&2:80&3:180 Which would be parsed as: servoId : Position & servoId : Position ...
37
votes
1answer
154k views

How do you use SPI on an Arduino?

With reference to the Arduino Uno, Mega2560, Leonardo and similar boards: How does SPI work? How fast is SPI? How do I connect between a master and a slave? How do I make an SPI slave? Please note: ...
25
votes
7answers
25k views

How can I get a unique ID for all my Arduino boards?

Once you have uploaded a sketch to one of your Arduino boards, it is hard to know exactly what source code led to that sketch. Indeed, you may change the source code of your sketch on your PC without ...
22
votes
8answers
11k views

Are global variables evil in Arduino?

I'm relatively new at programming and many of the coding best practices I'm reading effectively state that there are very few good reasons to use a global variable (or that the best code has no ...
10
votes
3answers
28k views

What are the fundemental differences of different Bluetooth modules for beginners?

I'm a beginner to microcontrollers and electronics, albeit not really to computers and programming. Starting out with the Arduino, I came to a point whereby I'm really interested in getting my ...
10
votes
2answers
22k views

Arduino Mega timeout communication with programmer error

I have an Arduino Mega 2560 and it was working fine until about lunch time when I started getting this error: avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout ...
9
votes
2answers
18k views

3.3V, 5V and 9V pins on Arduino

On my Arduino Uno R3 and Arduino Mega R3, there are 5V and 3.3V pins. However on this page Introduction to the Arduino Board, there is a 5V and 9V pin but no 3.3V pin. The page at Arduino: What ...
9
votes
4answers
28k views

2.4" TFT LCD Shield isn't working on Arduino Mega

Even on ebay's website it is mentioned that I can't use 2.4" TFT LCD Shield display on attach to Arduino Mega. The problem is that I bought this shield by mistake. I want to put this shield onto ...
9
votes
4answers
8k views

What is the cheapest way to add wifi to Arduino?

I am trying to find some sort of wifi adapter for Arduino, it needs to be as small as possible (not a shield) and as cheap as possible. So far I can only seem to find shields that cost about £10+ ...
9
votes
1answer
3k views

Setting timer3 in CTC mode - conflict with servo library

I would like to set up a timer in order to call a function 800 times per second. I'm using the Arduino Mega and Timer3 with a prescaler of 1024. To choose the prescaler factor I've considered the ...
8
votes
1answer
352 views

Can you query the current serial port's speed?

Is there some code I can use to find out what the a chosen serial port's speed is running at ?
7
votes
5answers
3k views

Can I make delayMicroseconds more accurate?

I'm trying to bit bang DMX data and that requires 4us pulses. Not having much luck with the results I'm checking to see how good the Arduino is at delaying... Seems to be pretty terrible at it. Here'...
7
votes
2answers
3k views

How to update a variable in an ISR using Timers

I'm trying to check the frequency of Timer3 using a counter. The value of the counter, declared as volatile, is incremented in the ISR and every second the sum is shown in the main loop and the value ...
7
votes
2answers
3k views

OOP vs Inline with Arduino

I have been programming for quite a while now but I am new to Arduino and AVR Programming. The main question I have about programming these Micro-controllers is are there major differences in ...
7
votes
1answer
11k views

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 ...
7
votes
1answer
3k views

Event driven programming

I have ran across a couple of different event libraries that are available on the AVR and Andruino but I am not sure which one is the best option. What I would like to do is design my program in a ...
6
votes
3answers
2k views

Advisability of Using Bit Fields in Structs

I have to track a large amount of data (for an Arduino) in a program while taking care of a fair amount of other business. I started with a struct like this: struct MyStruct { // note: these ...
6
votes
4answers
6k views

How to interconnect multiple Arduinos with a Rpi to control home-lights/switches

While planning the lightning infrastructure (wall-switches and lights) of my new home (it's still under-construction) I choosed to go through the "automated route" way and due to my background (I'm an ...
6
votes
3answers
26k views

I2C 2 way communication between Arduino Uno and Arduino Mega

If I remove the transmission code from slave this works properly but I need to transmit from slave. Here is my master code #include <Wire.h> void setup() { Wire.begin(3); Wire.onReceive(...
6
votes
1answer
703 views

Arduino Digital Input Causing Output Problems

I am working on a simple project using an Arduino Mega 2560 that involves reading a 12-bit binary encoder signal and which is used to cycle a digital pin high and low (depending on the angular ...
6
votes
1answer
6k views

References (e.g, libraries and tutorials) for connecting the 24-bit ADS1256 ADC to arduino

The ADS1256 chip is a high precision 24bit, 8 channel, analog digital converter based on SPI communication that is suitable for biomedical applications and perfect for sensing ECG and EEG signals. I ...
6
votes
1answer
173 views

Why do MEGA2560 digital pins go high on serial disconnect?

I'm trying to set up a system using an that delivers a specific number of digital pulses to a device using one of the digital pins. The number of pulses delivered is specified over a the Mega's USB ...
5
votes
2answers
2k views

16x2 LCD showing blocks under text

I have a LCD connected to a Arduino Mega 2560 using the instructions in LiquidCrystal library. It is not the first time I am using a 16x2 LCD but I never have encountered a problem like this. When I ...
5
votes
1answer
5k views

How do I specify a working directory when saving to SD card?

I'm trying to datalog to a EyeFi SD card by writing to a file with a jpg extension. Here's that portion of my code so far: // see if the directory exists, create it if not. if( !SD.exists("/DCIM/...
5
votes
1answer
1k views

ATmega AVR frequency measurement with timer/counter

I've been rehashing some existing libraries I found on some obscure forums to measure a frequency on digital pin 5, using the ATmega328P/ATmega2560 Timer/Counter modules and an interrupt based ...
5
votes
1answer
125 views

Whats the function of the resistor between MCU and its Resonator in Arduino Mega?

I was looking Arduino Mega's schematic and I noticed a resistor between the MCU and its resonator. R3 in this image: Why is it there and what is its function?
5
votes
1answer
141 views

Why is my Analog Input channel adding voltage to my signal?

EDIT: Here are the links to the sensor spec sheet (http://www.omega.com/temperature/pdf/HX71.pdf) and manual (http://www.omega.com/Manuals/manualpdf/M4543.pdf) for your reference. I'm using a ...
5
votes
2answers
4k views

DC Motor Speed Measurement using Rotary Encoder

I have written the following code to measure the speed of a unidirectional DC Motor.I have attempted to measure the time between successive interrupts in order to calculate speed. boolean check; ...
5
votes
1answer
4k views

3.95 MCU Friend Arduino TFT LCD flickering

I got the 3.95" LCD from aliexpress which uses IL9488. I used the MCUFRIEND_kbv library. I am using an Arduino Mega as I need other GPIO to be used for other purposes. I can't use the Uno because of ...
5
votes
2answers
5k views

How to program a CAN-BUS Arduino shield to control car windows?

My project is to control car windows using voice recognition. I have successfully controlled some LEDs using the EasyVR Arduino shield using and Arduino MEGA. Now I want to take control of the windows ...
5
votes
2answers
930 views

How can an Arduino Mega 2560+Wifi Shield 2.0 (SeeedStudio) receive data from database in a XAMPP server on my PC?

I'm trying to connect my Arduino Mega via Wifi to my XAMPP server. My main objective is get a value from my database and store it on a variable in Arduino code. With this new variable I'll be able to ...
4
votes
4answers
2k views

ArduinoUNO/MEGA, Is there a way to exceed 256 in analogWrite

I am using Arduino UNO/MEGA, I want to analogWrite(pin, val); where the value is 0-1023. How can I make that ? Thanks.
4
votes
2answers
2k views

Can I force Arduino Not to be powered by USB?

I'm building a 3D printer and I'm using a Atmega2560 + RAMPS board. The whole thing is powered by an ATX PSU (12v for motors and stuff, 5v for the Arduino), but when I plug in my USB cable, I can't ...
4
votes
5answers
4k views

What does Arduino do in 15ms?

I was wondering why there is a 15 ms delay between each iteration of a the main loop. Code: The following code shows the execution time expressed in microsec between each loop void setup() { ...
4
votes
2answers
405 views

What is the circular gold pad on arduino mega 2560 v2 and above?

Could someone point me to the documentation that describes the gold dot and surrounding gold circle on the front of my arduino mega v2 board. It is right above the ICSP header and reset button, and ...
4
votes
2answers
450 views

How to deal with unusual neopixel grid

I have built a custom installation in my home with 896 WS2812 LED driven by an ArduinoMega 2560 and powered by several rails just fine. However, the installation is arranged in a checkerboard-like ...
4
votes
1answer
1k views

PWM signaling with Arduinos: What is the reason for the ground connection?

This may sound like a very dumb question and I apologise in advance. I've gone through reading about PWM and working on some example sketches to control PC fan speeds using PWM and Arduino. In all ...
4
votes
2answers
8k views

How to choose between AM230x and DHT22 temperature and humidity sensors?

I'm looking forward to getting an accurate humidity and temperature sensor. Right when I decided to go with a DHT22 module, I saw AM230x (AM2301, for example). How do I choose between DHT22 and ...
4
votes
1answer
11k views

How to generate gcode for Arduino Mega 2560 and Ramps 1.4 CNC Router [closed]

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....
4
votes
1answer
26k views

ov7670 + Sd Card + arduino

I have three devices for making a motion activated security camera system: this is the camera : LINK OV 7670 this is the SD Card module: LINK and a basic motion Sensor: PIR with 3 pin I have an ...
4
votes
2answers
146 views

How to move my robot in the right direction?

After all there is more question poping up then answers i decide to upload the pdf where is everything writen, like the wire, motor type and what we can and can't use. Here is the link pdf format of ...
4
votes
1answer
3k views

ArduinoMEGA: 64 digital inputs cause random digitalRead values

I have 64 hall effect sensors (magnetic field sensors) (DRV5023AJQLPG) connected to an Arduino MEGA 2560. For that, I use 48 digital pins and 16 analog pins as digital input pins. The program in the ...
4
votes
1answer
2k views

How to make XBee module interrupt/wake arduino

What I am trying to do is, to have arduino in low power mode and waking up only when a packet is received and is available to be read from the buffer. A scenario : Zigbee XBee module is not ...
4
votes
1answer
4k views

Understanding Soil Moisture Sensor Values

I have soil Moisture sensor inserted into the pot soil, wet in state. (not too damp) and soil moisture sensor is connected to Arduino Mega 2560. This is the soil moisture sensor I am using: Soil ...
4
votes
3answers
6k views

Arduino Hardware serial library with rts/cts flow control support

Does there exist (any user developed etc.) version of the Hardware UART serial library that has support for RTS/CTS based flow control? More interested in the Tx side (Arduino sends data, while the ...
4
votes
2answers
161 views

a mega 2650 power supply mystery

Something happened to my mega2650 as I was experimenting the other day. It no longer turned on when powering from the 2.1mm jack or from Vin, regardless of the voltage applied. A plastic bubble had ...
4
votes
1answer
253 views

How can I indicate that I am using ATmega2560 so that Arduino libraries understand it?

I am developing AVR microcontollers in Atmle Studio and sometimes I am using Arduino libraries(such as LiquidCrystal). When I initialize LiquidCrystal lcd(12, 11, 5, 4, 3, 2); I don't think Arduino ...
4
votes
1answer
131 views

Selling a product using Arduino microcontroller or bootloader [closed]

I was wondering if I am legally allowed to sell an Arduino based product. I also want to know if it is easy for people to retrieve code from an Arduino based circuit (reverse engineer it) or upload ...
4
votes
1answer
192 views

Advanced Arduino Project Help

So, I am an Engineer working on a very time tight project. I want to create a system capable of collecting data from a Photodiode and compiling it in a way that will separate data into four columns ...
4
votes
4answers
8k views

Simulation of Arduino Mega 2560 with GSM Module using Proteus

I have really been suffering with my simulation! Tried connecting my arduino mega 2560 to COMPIM (used as GSM Module) in my circuit and also loaded sample code but damn! In vain! I wanted to view the ...