text:
Arduino max power supply limit
What is the maximum current that can be supplied to an Arduino Mega board before frying/breaking?
Basically i have several components connected to my board which draw a total current of 1.6A (which i calculated through a table), and thinking of using a 9V 2A power supply. I know that the arduino voltage limit is 7-12V but just wondering about the current as I can't find it on the datasheets?
Thanks in advance!

I think you mean "supplied from"; you can supply infinite amps to it. If you components can use vin, then you're not really limited, other than to the pins/traces.

yes sorry i meant i will have an external 9V 2A power supply to power the arduino and my components. as i will be connecting this through the japan socket, the max current input limit would be 1A as suggested by @CrossRoads? Or is this also infinite? Thanks!

1A coming in thru the barrel jack connecor, then you risk blowing the 1A rated reverse polarity protection diode. The 5V regulator will overheat at high currents above 7.5V. The chip itself can have 800mA put thru if if properly cooled and the IO limits of current per port are respected.
So 1.6A, no way.

thanks for the info! so im assuming the max current that can be provided through the japan jack is 1A?

Thru the barrel jack, yes ,1A.  Thru the USB jack, 0.5A.

From the ATmega328P datasheet.

One should specify that these are the limits of the MCU unit. But the current does not have to go through the MCU. For a 5V pin the limit comes from the power supply, 500 mA for USB and 1000 mA for the linear voltage regulator (barrel jack). In both cases one must subtract the power consumption of the board. Also note that USB power is disconnected as soon as you put voltage through the regulator: they have no chance to work concurrently.

Your question isn't clear. Are you talking about drawing regulated 5V from the Arduino power supply? I believe the built-in regulator has a hard limit if 1A total output, but how much you can draw from it will depend on various factors (mostly how much waste heat it generates. If you drive it from 9V it will generate quite a bit of heat, since a linear regulator simply dissipates the excess voltage as heat. Better to use a 7V supply)
You won't be able to draw 1.6A of 5V from the Arduino. You should probably get a separate 2A 5V regulated power supply for your external components. Again though, your question isn't very clear so I'm not sure I'm answering what you're asking.

Thanks for your reply. So the idea is to have an external power supply to power the arduino board along with its components. I re-did my calculations, and the total current and power dissipated by the components and arduino board would be 3.8W and 0.6A. Do you reckon this power supply would be enough https://www.amazon.co.uk/gp/product/B00HG9PT4K/ref=ox_sc_act_title_1?smid=A337BOQBCQBMQG&psc=1 ? It's rated at 9V/650mA and says its for the arduino. The alternative solution would be to have a 9V/2A if this is pushing on the limit

Is that what your external components need? 9V? Most solid state components need regulated 5V.  If your external components need 9V then you might get away with driving them from the 9V supply and also powering the Arduino into it's barrel connector using the same 9V supply. The Arduino regulator should handle fluctuations in input voltage as long as you don't draw so much current from the 9V supply that its voltage drops below 7V or so.

I have 2 8V stepper motors, a 3V LED  light and HC05 bluetooth module

You should not cut it that close. A 2A supply would be a much better choice. You'd be better off using a separate low power 5V regulated supply for the Arduino. Keeping the power supplies separate will avoid big swings in voltage as your power components (motor and bluetooth module) turn on and off.


text:
if/else on digitalRead not executing on 'else' portion
I am a beginner with C++ but used to be good with BASIC (2 decades ago lol). I'm building a peristaltic metered doser that allows you to input desired mL on a 4x4 keypad and then when 'fill' button is pressed it doses the desired mLs through the peristaltic.
I'm still drafting/printing the peristaltic housing and all of that but in the meantime I want to get as much of the coding done as possible. It's still incomplete, but one of the functions I want the doser to have is a 'PRIME/FLUSH' button.
Originally I wanted the button to run the pump as long as the button is held down to prime the tubing with solution or flush the tubing with DI water. But I haven't had luck figuring out how to use a 4x4 button in momentary switch mode.
A workaround I had was to have the button be an on/off button. So press it once, pump turns on, press it again, pump turns off. Since the pump isn't printed yet I've been using the onboard LED as a tester for the coding (hence the LED_BUILTIN).
The issue, from my research I figured what I would need was an if/else statement. When the button is pressed (in this case the 'a' button), it reads the LED_BUILTIN status and if its HIGH it turns it off and if its LOW it turns it on.
But the 'if' part is working, it turns it on, but the 'else' part is not. When the LED is already on and the 'a' button is pressed, it stays on and doesn't rewrite to LOW.
Code below, any advice?
#include <KeypadShield.h>

KeypadShield keypad;

#include <LiquidCrystal_I2C.h>
#include <Wire.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

char Data[15];
byte data_count = 0;

int x;

char customKey;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);

  keypad.begin();
  lcd.begin(20,4);
    lcd.setCursor(4,0);
    lcd.print("Let's Fill!");
    lcd.setCursor(4,1);
    lcd.print("Designed by");
    lcd.setCursor(4,2);
    lcd.print("JP");
    lcd.setCursor(5,3);
    lcd.print("2019 v1.0");

    delay (2000);

    lcd.clear();

    lcd.setCursor(1,0);
    lcd.print("Enter volume in mL");
    lcd.setCursor(3,1);
    lcd.print("on keypad then");
    lcd.setCursor(5,2);
    lcd.print("press DONE");
    lcd.setCursor(0,3);
    lcd.print("mL:");
}

void softReset()
{
asm volatile ("  jmp 0");
}

void loop()
{
    customKey = keypad.getNextKeypress();

    if (customKey)
    {
      if (customKey == 'a')
      {
        if (digitalRead(LED_BUILTIN == LOW))
        {
          digitalWrite(LED_BUILTIN, HIGH);
          lcd.clear();
          lcd.setCursor(5,1);
          lcd.print("FLUSHING");
        }
        else
        {
          digitalWrite(LED_BUILTIN, LOW);
          lcd.clear();
          lcd.setCursor(1,0);
          lcd.print("Enter volume in mL");
          lcd.setCursor(3,1);
          lcd.print("on keypad then");
          lcd.setCursor(5,2);
          lcd.print("press DONE");
          lcd.setCursor(0,3);
          lcd.print("mL:");
        }
      }

      if (customKey == 'd')
      {
       softReset();
      }

      if (customKey != 'p' && customKey != 'a' && customKey != 'b' && customKey != 'c' && customKey != 'd' && customKey != 's')
      {
        Data[data_count] = customKey; // store char into data array
        lcd.setCursor(data_count+3,4); // move cursor to show each new char
        lcd.print(Data[data_count]); // print char at said cursor
        data_count++; // increment data array by 1 to store new char, also keep track of the number of chars entered
        x = atoi (Data); //convert string to integer 'x' for use in equations
      }

     if (customKey == 'p')
      {
       lcd.clear();
       lcd.setCursor(7,0);
        lcd.print(x);
        lcd.setCursor(Data[data_count]+13,0);
        lcd.print("mL");
        lcd.setCursor(0,1);
        lcd.print("FILL --> fill");
        lcd.setCursor(0,2);
        lcd.print("RESET --> change mL");
        lcd.setCursor(0,3);
        lcd.print("FLUSH --> finish");

      }
    }
};

digitalRead(LED_BUILTIN) == LOW move the ). (you read a LED?)

Holy crow... thanks Juraj. Brain fart right there... that fixed the issue! And yes, the LED right now is just a placeholder for my peristaltic pump (once I finish drafting and printing the housing). I'm just using it to make sure everything works. Thanks again!

the pump can be read?

@Juraj I was thinking I could read whether or not the pump was on or off, or some variation of the concept

by accident on Uno you will read the pin state last set, but better have a state variable

You may remove the ';' at the very end of the sketch. If you do not know all the consequences of a soft reset, then you should not use it. We don't use it, for a good reason. When the microcontroller of the arduino uno is powered on, everything is in a off-state. That means that no internal parts (timers, bus controllers, and so on) needs to be initialized. That's why it is so easy to use for small projects and for an arduino board. With a soft reset, you continue at the beginning of the code. If something was wrong and in a wrong state, then the soft reset might make it worse.

(Heh... before even seeing the code I guessed you'd done this...)
You are comparing a pin number, not the results of digitalRead(), and then passing the results of that comparison to digitalRead():
if (digitalRead(LED_BUILTIN == LOW))

It should read:
if (digitalRead(LED_BUILTIN) == LOW)

Note the order of the brackets:  LED_BUILTIN is passed to digitalRead(), and then the result of calling that function is compared to the value LOW.

Thanks Majenko! Major brain fart on my part... but that solved the issue. haha. Spend so much time looking for the big problems that the little ones just stay right under your nose...

@Jay Absolutely. It's called "Code Blindness".

source: Stack Exchange

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

sort: votes


text:
Dual power supply using Arduino uno and nano
I had a very vague thought. I was wondering if I could I create a dual power supply using an Arduino uno and a nano. Can the  ground terminals of both the boards be shorted and the 5 volt terminals be used as +5v and -5v . Is this possible? Would it damage the board??

No, because both 5V terminals are +5V.
If both boards are powered by completely isolated power supplies then you could connect the +5V of one to GND on the other. One will then have all its signals and logic negative to your ground level, but normal compared to its own ground level. Managing it though and keeping things separate (no shared ground between two sets of peripherals, etc), would be tricky. And the moment you plug one into your computer the whole lot could go up in smoke.

I didn't quite understand. So are you saying that it is possible  for me to get negative signals if I  have  somehow connect both the Arduino boards on different  power supply and then connect the 5v pin of one board onto the ground pin of the other board and vice versa??

Kind of. The ground of one will be 5v lower than the ground of the other. And the power supplies must be isolated. That is vitally important.

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


text:
How do I grab data from my Arduino device using a Python program?
We are currently creating a system which can log student attendance using RFIDs. Currently, we have the RFID Scanner set up (MFRC522 reader and Arduino UNO microcontroller). The database for the student's info and time-logging is also already set up. We are; however, having problems with accessing the data the Arduino is sending. We want the Arduino device to send us the Tag IDs via a USB Connection and have set it up to send the relevant data through the Serial Port. However, we cannot access this data using a Python program with this code.
import serial

x = 1
while(x == 1 ):
    ser = serial.Serial("COM3", baudrate = 9600, timeout = 0)
    if(ser.is_open):
       print("Serial Port in Use")
    else:
       print("Card ID: " + ser.read)

We are attempting to read from Port COM3 (the SP the Arduino uses). If the serial port is in use, the program outputs the "Serial Port in Use" (for testing purposes only, to be removed in final code) and if not, it will output the Card ID. However, through this, we run into the problem of being unable to use the same serial port with the Arduino (we are running on Windows). We tried using a serial port splitter but replacing the "COM3" with the name of the virtual port does not work.
We would prefer not to use Processing and would be open to simply avoiding the use of a serial port completely.

How do I grab data from my Arduino device using a Python program? ...... use the serial port to transport the data ..... i think that you answered your own question

use the serial monitor in the Arduino IDE to verify the presence of valid data before you proceed with python code development

It isn't a good idea to open serial in a loop. It can be opened once at the start (or you can retry once per few seconds, if it fails).
Also the method is_open should return true if the serial was successfully opened so you can use it.
Maybe some working example would be a good way to start.

We are completely sure the Arduino is working properly, as checking the Serial Monitor reveals the device is reading properly. The real problem arises whenever we run the above code while the Arduino is plugged in and on. On running the code, an error occurs at Line 5 (opening the Serial Port). The error says, among other things "Cannot Open Port: Access Denied"

@o0V0o I'm not questioning Arduino side. I'm just pointing on condition that seems to be wrong, and port opening logic in python code.


text:
Reading and sending data from a micro SD card using Micro SD card adapter without using buffer
Actually,  I am trying to get data that appears in a .wav file, but I got the problem that it is not as fast as I need because, looking around the SD library I found that most of the bits are saved into the buffer and when the buffer is filled its information is sent.
However, I do not want it to happen. I just need the bits to get readed and next to be sent as soon as possible witout saving in the buffer.
Do you know if is it actually possible, to modify the SD library to change the transmition's parameters because As I wrote previously I do not want the buffer to be used.

To my knowledge, it's a feature of SD cards. Data can only be read in sectors (512 byte). Of course it's possible to modify Arduino libraries, and e.g. combine reading and playing the music. I fear you will learn a lot but won't become happy.

buffering would not slow it down very much. if it's not fast enough, unless just barely, it's for a different reason.


text:
Limitations of connecting to many Arduinos via Ethernet?
I'm planning a project where I need to control a lot of Arduino Unos from a single PC. I'll need to send commands to the Arduinos and receive responses, as well as have the ability to update each Arduino from the PC, preferably without Arduino IDE at some point. Connecting via USB is out of the question, as I have already tried this and got miserable results, in part because of the number of Arduinos I need to control. So now I'm considering connecting the PC to an ethernet switch and then from there connect each Arduino with an ethernet shield.
Which brings me to my questions. Are there any limitations I should be aware of, if I want to pursue this setup? Will controllings tens, or even a hundred, Arduinos at the same time be a problem? How about stuff like updating a specific Arduino on the network?
My current working prototype uses a Windows PC that connects to one of multiple Raspberry Pis, which then in turn communicates with a number of Arduinos via I2C, and updates them via USB. But if I'm able to do all this directly from the main PC to the Arduinos via Ethernet, that would be fantastic.
Thanks for reading, looking forward to any answers.

One Arduino, or a million Arduinos, it makes no difference.

With a lot of devices on the ethernet, you may want to consider a private wire that is dedicated to those devices.  That is, a second ethernet port or a VLAN off a capable switch.
As the number of devices increases, and the number of simultaneous talkers increases, you will start getting contention.  Chances are a modern switch can handle this to some extent, but you were not clear on how much traffic you are planning on sending, or how often each device talks, or if it is centrally coordinated (aka "polled") or just speaking whenever.


text:
What Version of the Sketch did I leave on there?
Is there a way to "ask" the Arduino what sketch was compiled on it?
There are several versions of the sketch and I need to see which version the Arduino has been running.

No, but if you really want to there might be a way. First of all, you should add a version number (text or a number) into your sketch. When there is output to the serial monitor or a display, then show the name and the version. Next, make a header and write in comments which version of the arduino ide is used. About your problem: with avrdude you can retrieve the binary code. When you also know which version of the arduino ide was used to compile the sketch, then you can compare the binary versions of the sketch, until you find the right one.

First, you have to store the desired information in your sketch.
#define VERSION F("0.01 4-Apr-2019")

void setup() {
   Serial.begin(9600);
   Serial.print(F("Test Sketch V"));
   Serial.println(VERSION);
}

void loop() {
}

Of course any other way might work as well:

Only print it, if at reset a test button is pressed
Check for a Serial command and respond the version info.
Don't print it, but use avrdude and a programmer to read the FLASH memory and search it for the version string. (Similar to jot's comment above)

If you have not set the flash protection bits you can read back the contents of the program memory. See https://www.evilmadscientist.com/2011/avr-basics-reading-and-writing-flash-contents/
By reading back the first pages you can then compare with the different versions of the sketch (hex file) and determine which version is on the device. The first pages are the different ISR vectors and should be unique for the sketches.
Cheers!


text:
Unable to read data more than once via Modbus RTU
I'm a newbie to this forum so kindly excuse me for any errors.
I'm using an Arduino Uno and Max485 (RS-485 to TTL) to communicate with a Power meter, but I'm able to receive the data from the Power Meter only once and then it prints "Error" continuously. I need to reopen the Serial Monitor to get the new reading but again the issue persists thereafter. Reading parameter is voltage.
I am using ModbusMaster library. Please refer to the code below.
#include <ModbusMaster.h>

uint16_t vl1, v11;
uint8_t result1;
float v1;

ModbusMaster  node;
#define MAX485_DE      2
#define MAX485_RE_NEG  3

void preTransmission()
{
  digitalWrite(MAX485_RE_NEG, 1);
  digitalWrite(MAX485_DE, 1);
}

void postTransmission()
{
  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);
}

void setup()
{
  // Open serial communications and wait for port to open:

  pinMode(MAX485_RE_NEG, OUTPUT);
  pinMode(MAX485_DE, OUTPUT);

  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);

  Serial.begin(9600);

  node.begin(1, Serial);

  node.preTransmission(preTransmission);
  node.postTransmission(postTransmission);

}

void loop()
{
  result1 = node.readInputRegisters(0x0001, 5);

  delay(1000);

  if (result1 == node.ku8MBSuccess)
  {
    //Retrieiving data from energy meter via modbus

    vl1 = node.getResponseBuffer(0x01);
    v11 = node.getResponseBuffer(0x00);
    uint16_t data[2] = {va11, val1};
    memcpy(&v1, data, 4);
    Serial.println("Voltage:);
    Serial.print(v1);
  }

  else
  {
    Serial.println("Error");
  }
}

This is the output I get from the Serial Monitor
Voltage:221.21
Error
Error
Error

FYI, Meter communication details as follows:

Baud Rate: 9600, Parity: None, Stop bits: 1, Slave ID: 1

I'm unable to figure out the issue therefore I'm looking forward in seeking your assistance. Thank you!

Please, confirm you're using this ModBus library.
Let us also know if you cut&pasted code from somewhere or if you really wrote it as... I'm a bit skeptical about the "delay(1000)" you added right after the readInputRegisters call. Why you used it?
As a final note, please consider that based on official documentation here the readInputRegisters function returns..."0 on success; exception number on failure". As it's failing, please print its value as well.

I used the "half duplex" example from the Modbus Master library and modified the program according to my need. If I print instead of error value, it repeats the same voltage value.

Any solution found on this ?


text:
HD44780 display incorrectly black-on-blue instead of white-on-blue
I have a generic HD44780 compatible 16x2 LCD display, with an already soldered on PCF8574 module. Its backlight is blue, and the characters are supposed to be white (on blue).
It is connected to a generic "Lolin" ESP8266 module which is working fine and is not related to the problem, I hope.
Using the LiquidCrystal_I2C library available at https://github.com/lucasmaziero/LiquidCrystal_I2C, I uploaded the simple "Hello, World" sketch provided, and it works. Used the most current libraries and Arduino IDE as of 2019-03-20.
However, the text displayed is a very dim black-on-blue instead of a bright white-on-blue.
I do not have any clue on why it happens and how to fix it (and that's my question).
What I know is that if I somehow "glitch" the display (for example by disconnecting and reconnecting the power lead) it will sometimes display gibberish, but in a very clear white-on-blue, so I know the LCD hardware is not defective per se.
I also tried a few other libraries to the same effect: LiquidCrystal_PCF8574 and LiquidCrystal_I2C (the version available directly from the Arduino IDE, source at https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library)
Below, the example sketch used to generate the problem. Be aware it is for the first LiquidCrystal_I2C library I referred above, but with changes, works with the others I tried.
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
  // initialize the LCD
  lcd.begin(); // Init with pin default ESP8266 or ARDUINO
  // lcd.begin(0, 2); //ESP8266-01 I2C with pin 0-SDA 2-SCL
  // Turn on the blacklight and print a message.
  lcd.backlight();
  lcd.setCursor(0, 0);

#if defined(ESP8266)
  lcd.print("ESP8266");
#else
  lcd.print("ARDUINO");
#endif

  lcd.setCursor(0, 1);
  lcd.print("Hello, world!");
}

void loop()
{
  // Do nothing here...
}

And a photo of the anomalous display. Turning the constrast potentiometer does not help.

what's the operating voltage on that device? How have you connected the power on it?

Operatin voltage seems to be 3.3V. If I connect the VCC line of the display to the Vin of the ESP8266 (5V in my case), nothing works, nothing is displayed.

Just tried connecting the i2c interface via a level converter (display side 5V, ESP8266 3.3V) and it doesn't power up. However if I power both sides of the level converter on the 3.3V rail it works "wrong" (So, no bad converter or wrong connections).

I had a similar problem.In my case it was contrast settings. Some of these displays require negative voltage to drive contrast pin (especially when powered from 3.3V). Because this pin doesn't draw much of current, a simple 2 diode and 2 capacitors fed with square wave (can be generated from your Arduino, or 555) will be sufficient.

@smajli, care to provide some details on how you achieved that? Free GPIOs on my project are at a premium, but it is worth the try!

There is a chance that this LCD would need a negative voltage on contrast PIN. Below there is a simple schematic. You would need to provide pulses on the 'Pulse in' branch. Use Negative voltage branch and potentiometer to feed your contrast pin.

It's so simple that's worth a try. Will post the result as soon as possible.

It worked nicely. However, not very practical. Why? Because the I2C module is soldered onto the LCD module, and to apply the negative voltage to the contrast pin I would need to cut its connection to the PCF8574 board and then solder an external connection to the negative voltage generator. Anyway, problem was solved, thank you very much.

This answer is just to complement @smajli's answers posted (and accepted) before.
The problem lies in that the contrast pin has to be fed negative voltages when the module is powerered via a 3.3V supply to be able to show text in the correct white-on-blue setting and not on the faint black-on-blue.
@smajli correctly showed how the negative voltage may be generated from the normal positive supply and a pulse generator. However, in my scenario, the pulse generator was connected to the +3.3V rail instead of +5V and the pulses where generated via the ESP8266's PWM feature. Using a duty cycle of 50% it generates about -2V. I'll not reproduce his schematic here, though, but below is a photo of it assembled and in action.

The updated code is exactly the same, with only the PWM generation added inside the setup() function:
  pinMode(D8, OUTPUT);
  analogWrite(D8, 512);   // 10-bit!

Finally, the photo below illustrates the final result.

Again, thanks again to @smajli for the previous insights and answer.
P.S.: Keen readers will notice the module used now is NOT the same used when I asked the question originally. It is another generic HD44870 module, but without the I2C interface, working in 4-bit mode. However, the exact same problem (black-on-blue text) occurs when the contrast pin is set to anywhere between +3.3V and GND and is promptly solved when using negative voltage.

Good to see your explanation. Good effort and nice effect.

I have a similar LCD display (I assume it's virtually identical, hard to confirm).  In my case, driving the display VCC (and SCK and SDA) at 3.3v produced the same behaviour you described (dim black text on blue background), but setting VCC to 5v gave me the correct white-on-blue display (even with SCK and SDA still driven at 3.3v, since those are the outputs of the MCU I was using).
It's curious that setting the VCC to 5v did not work in your case.


text:
How to connect 2 Arduino Unos when one has a TFT LCD display attached to it?
I have to make a school project involving an Arduino Uno with a 2.8" TFT LCD touch screen display. in my project, i have to connect it such that the display is linked to a LED push button that receive inputs and react accordingly, as well as a speaker. However, my TFT LCD display fits perfectly into my Arduino Uno meaning i have no more input slots to connect to my push buttons nor my speaker. initially i found a different TFT display that came with an Arduino Shield that made life simplier however those products were not being shipped to my country:(
i am unable to use an Arduino Mega either since the SD socker in my TFT LCD display does not support the Arduino Mega. i understand in order to have my tft lcd display and my LED buttons and speaker to work i can have 2 Arduino Unos and have them work in Master-Slave however i would still need to have a common ground for both arduinos first and connect them which i am unable to do so since there's simply no way i can fit a jumper cable in there once i place my tft lcd display on the arduino uno. Please help guys:(

Please add a link or additional information about the LCD touch screen shield you are using. There might be pins that are not used by the shield and that may be accesses through jumpers, etc.

If your TFT shield does not expose unused pins and general pins like 5V, Ground, etc, you have to expose them yourself. You can solder directly to the board, but the cleanest way would be to use another layer (for example a prototyping shield) between Arduino and TFT shield. Some of them have the pins in such a configuration, that you can simply stack the TFT shield on top of it (e.g. it exposes all the pins to further shields, that might be stacked on the prototyping shield).

this is my LCD touch screen! https://www.sgbotic.com/index.php?dispatch=products.view&product_id=2756

i am hesitant about getting a protoshield as i understand you have to soldering alrdy and then configure it? please correct me if i am wrong!!

The screw shield I mention in my answer requires no soldering. Just a small screwdriver to tighten the screws to hold your wires that go to the other board.

You can put a screw shield between the TFT shield and the Arduino to make access to the unused pins easier.  You can see an example of a board I offer at www.crossroadsfencing.com/BobuinoRev17/ We have been able to ship to any country to date.

This answer is spam, an advertisement for a product. @CrossRoads please read: https://arduino.stackexchange.com/help/promotion

How else is one to post a picture of a suggested solution?  "Don't tell - show! The best way to avoid being seen as a snake-oil salesman is to demonstrate a solution rather than simply asserting the problem can be solved"  "Always solve the asker's problem. A good answer should at minimum allow the person whose question you're answering to solve their problem."

The relevant thing from that link is: "you must disclose your affiliation in your answers.".

This is not spam. If you have a product that is a solution to the OPs problem there is nothing wrong with suggesting it (provided you disclose your affiliation). I do it often :P Spam is where you try and suggest that Viagra is the solution to the OP's question (which it may be, but that's another issue entirely...) or where you intentionally make it look like you're suggesting someone else's product.

It was spam until the answer was edited and changed to disclose CrossRoad's affiliation with the product for sale.


text:
Powering Arduino and LED strips from one adapter
My project has my Arduino controlling 10 led strips. I'm going with a plan by @gre_gor that is posted here: Setting 10 RGB Strips Independently from Single Arduino
...where each strip is controlled by an STM32 driver.
I'm packing all electronics into a tight space and will need to have the power adapter external with just the cable coming in.
I need power both to the arduino and directly to the stm32's.
Question: can I simply split the 12V power cable to send power to both the led strips and the arduino? Or is there something I should worry about?

Powering an Arduino and LED strips is no different to powering your TV, satellite receiver, DVD player, etc all from one socket in the wall.
Connect all the grounds (-) together, and connect all the powers (+) together.
All you need to worry about is that the total current draw of all the devices combined doesn't exceed the amount of current that the power supply can provide (oh, and that they all operate at the same voltage, of course).


text:
ESP8266 compilation error: "previous declaration of 'HTTPMethod HTTP_HEAD'"
I have an ESP8266 program that used to work but is now failing to compile with this error:
C:\...\Arduino\libraries\WiFiManager/WiFiManager.h:25:24: note: in expansion of macro 'PROGMEM'

 const char HTTP_HEAD[] PROGMEM            = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/><title>{v}</title>";

                        ^

In file included from C:\...\MyEsp.ino:14:0:

C:\...AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WebServer\src/ESP8266WebServer.h:33:39: error: previous declaration of 'HTTPMethod HTTP_HEAD'

 enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
                                   ^

I don't recall changing anything, except maybe updating some libraries. Any ideas what could be causing this?  Here are my includes from the ESP8266 program:
#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>

#include <DNSServer.h>            //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h>     //Local WebServer used to serve the configuration portal
#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager WiFi Configuration Magic

#define SERIAL_BUFFER_SIZE 256

You need a newer version of the WiFiManager.h library. This issue was fixed August last year.

Strange. WiFiManager.h didn't show up in my 'Updateable' libraries but you're right.


text:
How to copy IPAddress class into character buffer? Getting error: "inet_ntop' was not declared in this scope"
I am using the WiFi library and trying to store the IP address in a character buffer so that I can print it out to an lcd that only accepts character buffers. My code for doing this:
 char * IPAD = new char[40
 IPAddress ip = WiFi.localIP();
 Serial.println(ip);
 char * bufIP = new char[40]();
 sprintf(bufIP, "%s", inet_ntop(ip));
 lcd.string(ip);

But when I compile this I get the error:
"inet_ntop' was not declared in this scope"

Help?

try lcd.print(ip); lcd libraries use to implement Print and IPAddress implements Printable

My LCD library only accepts char* elements :(

then use numbers ip[0], ip[1], ip[2], ip[3]

Which arduino are you using?

An IPAddress is a class. You can't use it like a number (although in certain circumstances you can assign it to a uint32_t and it gives you the numeric representation).
Also, the inet_* functions are only really relevant on a POSIX system with a full network stack - i.e., a computer, not a little Arduino without a proper networking stack.
You can, though, easily access the individual bytes of the IP address through the [] operator and place them into a char array with the right format:
sprintf(bufIP, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);


text:
RGB Matrix flickering every ~5 seconds when paired with SoftwareSerial
I'm running an RGB matrix through an Uno and trying to run it alongside SoftwareSerial so that I can integrate an ESP8266 into things. The trouble is, when I start introducing the SoftwareSerial into things, the screen flickers every few seconds, consistently. For example, with this function, it flickers exactly every 10 seconds. Any ideas what might be causing this or how to fix it?
Below is the arduino code. The RGB matrix is configured like this.
#include <RGBmatrixPanel.h>
#include <SoftwareSerial.h>

#define CLK  8   // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc.
//#define CLK A4 // USE THIS ON METRO M4 (not M0)
//#define CLK 11 // USE THIS ON ARDUINO MEGA
#define OE   9
#define LAT 10
#define A   A0
#define B   A1
#define C   A2
#define setDelay 500

RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);

SoftwareSerial mySerial(11, 12); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("Start Serial!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");

  matrix.begin();
}

void loop() {

  // draw a pixel in white
  matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
  delay(setDelay);

  // fix the screen with green
  matrix.fillRect(0, 0, 32, 16, matrix.Color333(0, 7, 0));
  delay(setDelay);

  // draw a box in yellow
  matrix.drawRect(0, 0, 32, 16, matrix.Color333(7, 7, 0));
  delay(setDelay);

  // draw an 'X' in red
  matrix.drawLine(0, 0, 31, 15, matrix.Color333(7, 0, 0));
  matrix.drawLine(31, 0, 0, 15, matrix.Color333(7, 0, 0));
  delay(setDelay);

  // draw a blue circle
  matrix.drawCircle(7, 7, 7, matrix.Color333(0, 0, 7));
  delay(setDelay);

  // fill a violet circle
  matrix.fillCircle(23, 7, 7, matrix.Color333(7, 0, 7));
  delay(setDelay);

  // fill the screen with black
  matrix.fillScreen(matrix.Color333(0, 0, 0));

  // draw some text!
  matrix.setCursor(1, 0);  // start at top left, with one pixel of spacing
  matrix.setTextSize(1);   // size 1 == 8 pixels high

  // print each letter with a rainbow color
  matrix.setTextColor(matrix.Color333(7,0,0));
  matrix.print('1');
  matrix.setTextColor(matrix.Color333(7,4,0));
  matrix.print('6');
  matrix.setTextColor(matrix.Color333(7,7,0));
  matrix.print('x');
  matrix.setTextColor(matrix.Color333(4,7,0));
  matrix.print('3');
  matrix.setTextColor(matrix.Color333(0,7,0));
  matrix.print('2');

  matrix.setCursor(1, 9);  // next line
  matrix.setTextColor(matrix.Color333(0,7,7));
  matrix.print('*');
  matrix.setTextColor(matrix.Color333(0,4,7));
  matrix.print('R');
  matrix.setTextColor(matrix.Color333(0,0,7));
  matrix.print('G');
  matrix.setTextColor(matrix.Color333(4,0,7));
  matrix.print("B");
  matrix.setTextColor(matrix.Color333(7,0,4));
  matrix.print("*");
  }

Does it coincide with when data arrives on the software serial pins?

Oh come to think of it, it sure does!

Welcome to the world of SoftwareSerial. Nothing (and I mean nothing) else can happen when data is being either sent or received.

This should be a fairly easy fix, though. I wonder if there's a way to sync the ESP8266 clock with the Uno receiving so I can basically say "do this every 10 seconds, but not when the ESP8266 is sending!"

It all depends on what the ESP8266 is doing. If you have your own firmware on there you could make it call-and-response so it never sends anything unless asked to by the Arduino.

That makes sense. But in that short period where the Uno asked for something from the ESP8266 and the ESP8266 returned it, the Uno still wouldn't be able to display anything to the matrix without flickering, right? Would this be a problem if I were using the hardware serial? I would go that route but it seems like it makes debugging a lot harder!

Hardware serial will do way better. Then only the processing of the received data needs time, not the receiving itself. Also you can ditch the delays and use millis() like in the BlinkWithoutDelay example, so that you can do other things (for example serial), while waiting for the time to pass.


text:
ESP8266 Huzzah error: "Failed to connect to ESP8266: Timed out waiting for packet header"
I am trying to follow this tutorial but when I get to the step...
"Once the ESP board is in bootload mode, upload the sketch via the IDE"
..I get the following error in Arduino IDE:
File "[path]/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool\esptool.py", line 468, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

Any ideas about how to fix this?

it is not in bootload mode


text:
MKR1000 disconnecting when hooked up to RGB 16x32 LED Matrix
This tutorial is from 2012, before the MKR1000 existed. The tutorial says the 16x32 LED Matrix panel is compatible with the Arduino Zero, which the MKR1000 is supposedly related to, so I'm thinking I should be able to upload the same program. However, the board keeps disconnecting every time I try to upload a simple sketch, so I am worried that perhaps they are not compatible. I am using the same wiring as the Arduino Uno (using pins 2-10, A0, A1, A2, GND on the MKR1000) that you can see in this tutorial

without anything wired to pins is it OK with upload?

Yes, for example I am able to upload the "Blink" program just fine.


text:
Can I connect this LED Matrix to a ESP8266 Huzzah directly?
This tutorial for the 16x32 LED Matrix makes it sound like you have to use an Arduino Uno or Mega, but the tutorial was also written a few years ago.  I have a Huzzah ESP8266 (my project is about displaying information from the internet on the LED matrix) but I can't seem to get the  library to work with the Huzzah.
I am wondering if it would be possible to somehow hook up the LED matrix directly to the Huzzah. Can anyone make suggestions on this front?
Or do I have to basically make the Uno a slave to the Huzzah ESP8266? Need to figure out how to do that.
Thank you.

The library does not support ESPs, but in general you should be able to drive it with ESP if you have enough free pins. You might need a level shifter

So I would not be able to use the library, and would have to figure out another way to output to the matrix? I don't know where to start with that...might just make the Uno a slave if I can figure out how to do that

The Huzzah is a great board but I don't think it is capable of driving a large led matrix by itself.  Adafruit also makes a led matrix feather wing which could enable the huzzah : https://www.adafruit.com/product/3090


text:
TinyDuino radio connection
I am currently running a project with 2 TinyDuinos and 2 TinyShields 433MHz Radio (SI4432) in order to pass 3 axes (x , y ,z) from one to the other from long distance.
I have tried

to concat the axes as one string and send the string,
to send an array like string axes = { x , y , z } to the
receiver (of course the variables are already defined),
send only one string. In this case I have only the first 2 letters of the string. For example if the string was string first = "456" , I would get "45" on the receiver

The Radio shield's examples uses uint8_t type and arrays to send and receive the data, I have already tried to cast the string to char* and then to uint8_t and nothing different happens. Maybe I am missing something.
Below there are my code screen shots. I will put 2 links for the examples of the transmitter and the receiver I got some code from
Similar Project : https://tinycircuits.com/blogs/learn/121634375-football-play-calling-watch-tutorial
Radio Shield Page: https://tinycircuits.com/products/433mhz-long-range-radio-tinyshield
TinyDuino Main Shield : https://tinycircuits.com/collections/all/products/tinyduino-processor-board
Code Screenshots

Please add the code in your question, don't use images/screenshots.  This allows easier editing by others and more crucially helps the search engines.

For this kind of thing you need to craft a packet to contain your data. The best method is to use a struct.
struct coords {
    int x;
    int y;
    int z;
};

Then you can define a variable from it:
struct coords myCoords;

And set individual values:
myCoords.x = 23;
myCoords.y = 180;
myCoords.z = -3817;

Now you can cast it to whatever type you need for sending:
manager.sendtoWait((uint8_t *)&myCoords, sizeof(struct coords), SERVER_ADDRESS);

Receiving is done in much the same way:
struct coords recCoords;
uint8_t len = sizeof(struct coords);
uint8_t from;

if (manager.recvfromAck((uint8_t *)&recCoords, &len, &from)) {
    Serial.print("X = ");
    Serial.println(recCoords.x);
    Serial.print("Y = ");
    Serial.println(recCoords.y);
    Serial.print("Z = ");
    Serial.println(recCoords.z);
}

In future please post your actual code, not pictures of your code. It makes it a real pain having to keep scrolling up and manually typing in bits of your code rather than being able to copy-and-paste a couple of lines.


text:
TinyDuino RadioHead compile error with TinyZero
I have a stack of TinyDuino boards including
TinyZero and 433MHZ Long Range Radio TinyShield.
I previously has this processor and had no problem compiling the sketch
and uploading it.
With the TinyZero now I get the following error.
RadioHead.h:463:29: error: RHutil/atomic.h: No such file or directory
   #include <RHutil/atomic.h>

Obviously there is a file missing, when I tried to copy the file from the web
I got another error saying:
    sketch/RHHardwareSPI.cpp: In member function 'virtual void RHHardwareSPI::begin()':
RHHardwareSPI.cpp:99:58: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'BitOrder' [-fpermissive]
     _settings = SPISettings(frequency32, bOrder, dataMode);
                                                          ^
In file included from sketch/RHGenericSPI.h:13:0,
                 from sketch/RHHardwareSPI.h:10,
                 from sketch/RHHardwareSPI.cpp:7:
/home/ktsirakos/.arduino15/packages/TinyCircuits/hardware/samd/1.0.8/libraries/SPI/SPI.h:50:3: error:   initializing argument 2 of 'SPISettings::SPISettings(uint32_t, BitOrder, uint8_t)' [-fpermissive]
   SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) {
   ^

What the board does is to get Accelerometer values and send it to a receiver with the same RadioHead board.
I think it is because of the ARM of the TinyZero processor because the RadioHead.h header file includes these lines of code.
    // This is an attempt to make a portable atomic block
#if (RH_PLATFORM == RH_PLATFORM_ARDUINO)
#if defined(__arm__)
  #include "atomic.h"
 #else
  #include <util/atomic.h>
 #endif
 #define ATOMIC_BLOCK_START     ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
 #define ATOMIC_BLOCK_END }
#elif (RH_PLATFORM == RH_PLATFORM_UNO32)
 #include <peripheral/int.h>
 #define ATOMIC_BLOCK_START unsigned int __status = INTDisableInterrupts(); {
 #define ATOMIC_BLOCK_END } INTRestoreInterrupts(__status);
#else
 // TO BE DONE:
 #define ATOMIC_BLOCK_START
 #define ATOMIC_BLOCK_END
#endif

Any suggestion if it is possible to run these 2 together? (TinyZero and RadioHead)?
Thank you very much in advance.

When using the newest RadioHead and a new official arduino Zero with a new bootloader from arduino.cc, it should work according to the RadioHead page: https://www.airspayce.com/mikem/arduino/RadioHead/ How old is the core software for the TinyZero?

Helly @Jot , the software has been build to run on this processor: https://tinycircuits.com/products/tinyduino-processor-board?variant=14479557959

Konstantinos Tsirakos, that is with the atmega328p microcontroller, the same as in the arduino uno, nano, pro mini and so on. That is very compatible. The arduino zero and clones with samd21 processors are not so compatible. There are even a few different official arduino boards with the samd21 (arduino M0, arduino zero, arduino mkr). I think they build a new core environment for the TinyZero which is somehow going in its own direction or is too old.

The problem was with the drivers, I updated them from the site you send to me and everything worked ok with that. :)

That's very nice. I try to keep up with the newest software/firmware/bootloaders. For me, a arduino clone is no problem, as long as I can use the arduino software. I stay away from other "compatible" boards that have their own core.


text:
How to use -F option while Burn bootloader for ATtiny 85 using Arduino IDE
I'm very new to Arduino. I tried programming Attiny 85 module using Arduino as ISP. It worked fine few times. after that i'm getting below error.
Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.

I understand that i can override this step using -F option. But really cannot figure out how to use -F option in Arduino IDE. Please Help!

don't use -F. solve the problem with wiring

i tried checking and changing jumpers multiple times. no luck.

For what I know there is no easy way to pass custom options to avrdude via the Arduino IDE, but Sloeber (to which I'm a contributor) does.
Beware though, the -F option of avrdude command doesn't solve the problem, just forces to skip the device signature verification, but if your Attiny is returning such signature something else is wrong and you'll end up with a failed firmware upload anyway.
If the device was working and suddenly stopped it's more than probably a wiring issue, as already suggested in the comments. The second most probable cause, in my experience, would be a hardware issue: you might have accumulated some static charge and then touched the Attiny or any wire connected to it, destroying one of the ISP pins...
My bet is on the former: my experience with the latter is you get changing signatures in the form of 0xFFFF00, 0x0000FF and 0xFFFFFF but, luckily for me, this didn't occur so often to accumulate a true knowledge.

Are you aware the Sloeber site is down (3pm EST 2018-12-28). There’s also a bad cert on the site


text:
Speed controller for Ceiling Fan 220V AC 100W
I would like to use ESP32 to speed control my AC ceiling fan which is 220V AC 100 W.
Will the below AC dimmer work with ESP32 to speed control the ceiling fan which is 220V AC 100 W?
If not, kindly suggest a commonly used PWN dimmer that works with ESP32 to speed control ceiling fan with 220V 100W?
This is the link to Speed controller available on Amazon.

here a sample sketch https://robotdyn.com/pub/media/0G-00005677==Mod-Dimmer-5A-1L/DOCS/Glow.ino

Hi, I follow the attached code very well !
What I would like to know if the model of dimmer okay to take speed control and is okay to take the load of 220v 100W ceiling fan?

it is for 2 A (5 A peek), so yes, it is good for 230V/100 W motor. the information about current is on the photo of the backside of the module. and it supports 3.3V logic for esp32

Thank you very much.
I appreciate your help.

I used robotdyn code it works well with esp8266 but I want to use it for esp32. But few libraries of timer.h not supportable with esp32. Anyone tried with esp32. Please help me.

In theory, it should work to control the speed of fan. The manufactures description mentions "fan regulator". One of the pictures shows on the backside of the module that it is for 2 A (5 A peek). This should be good for 230 V / 100 W motor.
The module gives you a basic circuit to control AC. It reports zero-crossing and has an optocoupler switch to turn AC on and off. The dimming does your sketch, by cutting parts of the AC wave out in precise timing.
The example sketch is not good. It has delay in interrupt. With this implementation the sketch will not be able to do much else.
EDIT: I tested it and it works with fan too. The delay in interrupt is to create a short pulse to turn on the triac. The triac then turns self off on next zero-crossing. And Robotdyn changed the specs to 10 A.

I want to use this dimmer in blynk along with other IoT devices. The code you metioned has delays, can you suggest a code without delay function?

sorry. no. perhaps a second interrupt to turn AC back on after some microseconds. at 50 Hz one oscillation takes 20 miliseconds. a half wave takes 10 millisecs. you turn AC off at zero-crossing at turn it back after time between 0 and 10000 microseconds. longer time - less electricity - slower motor. other method, perhaps better for motor, is to take out entire half oscillations (this is described on the manufacturers page for the module)


text:
Is Arduino Keyboard in Single User Mode Possible?
Has anyone had success using the keyboard functionality of any arduino in single user mode of mac computers? I would like to inject keystrokes in single user mode, and have been unsuccessful with the atmega32u4.

Does it work in normal user mode? Are you using a Leonardo?

Yes, it works in single use mode. It is a Micro/Leonardo clone.

It works in Single user mode? I thought that it was in Single user mode that you were having problems. Now I am confused

I have found the solution to my problem. The issue is that the presence of both the usb device and serial port causes issue in single user mode. For the keyboard to work properly, the serial port must be disabled. This means that reflashing the micro requires pulling the reset pin low twice quickly for the port to show up again. Here is an example of how to remove the serial port:
https://github.com/gdsports/usb-metamorph/tree/master/USBSerPassThruLine

OS X requires a "Boot Interface" compatible HID profile for a keyboard to work in single user mode (it has only loaded very rudimentary drivers by that point).  The Arduino doesn't provide that interface, so can only work with the more advanced drivers the OS provides once booted.
You can try setting the "boot interface" flag to 1 in the interface subclass (here, I think, changing HID_SUBCLASS_NONE to HID_SUBCLASS_BOOT_INTERFACE) though I have no clue what the actual effect of that will be given that it's a composite device that may or may not conform to the boot interface standard.

Thanks for the suggestion. I tried this and saw no difference in behavior.

Ah well - then the answer is probably "no"...

Do you think it has to do with the board I'm using or the fact that I'm trying to do it on a mac?

It's a combination of the two. The Mac has specific requirements (the same requirements as a PC when in the BIOS), and the Arduino's USB software doesn't meet those requirements. There may be a better board for the job that has a better USB stack, but I don't know of one off hand.


text:
Running ESP8266 at 3.78V to work with ATMEGA328P at 16 MHz
I have a project that is powered by 2x 18650 battery and feeds it to a step down switching voltage regulator that is configured to give a steady output of 3.78V to both esp8266 and atmega328p.
The esp8266 only sends an HTTP post request to an API every 30 mins and on standby mode whenever it does not do anything.
I have tested it for 1 hour and the esp8266 seems to work fine and does not warm. I intend to use the esp8266 in an airconditioned office 24/7 or until the battery runs out. I know it is not safe to give 3.78V because its supposed to have only a maximum of 3.6V but I am asking if anyone has ever had the same application and did not experience any problems?

Whether or not it works reliably over time is a gamble.   The 3.78V output of your regulator will vary by 10's (or 100's) of millivolts as loads change.  Why not simply use a 5V step down DC-DC buck converter for the 328P and a cheap 5V to 3.3V linear regulator for the ESP8266?

connect VCC with a big diode instead of a wire; it should drop about half a volt, and while the "transconductance" will vary with load, it should keep the voltage around 3.2v, give or take a few 100mv, which is within spec. A 470u cap would help keep it stable if you run into issues, and isn't a bad move even without the added "jank" of a rectifier diode

@JeffWahaus Yes, it is the original plan but the 3.3v linear regulator is unavailable in our area.

@dandavis Thanks for the suggestion. The circuit is already on PCB so I do not think this would be an option now.

Other possibilities include:

Running the Atmega328p at 8MHz and powering at 3.3v. Both devices would be operating within spec.
Running the whole system at 3.3v but without changing the clock on the '328. The advantage here is you'll get the full throughput from the '328, assuming you need it. The disadvantage (assuming a 16MHz Atmega328p) is that it will be running out of spec (overclocked) but they seem to be conservatively enough speced that most chips do fine. I have built two boards this way for the same reason: to put both a 328p and an ESP8226-01 on one board. I ran some rather rudimentary tests on the Atmega chips I put on those boards to find out if they would work at that voltage. I didn't see any issues and I haven't discovered any since.

Update:

Would it be possible to run the ATmega at 8 MHz using a 16 MHz
  external oscillator by simply uploading a new sketch?

It may be possible to use its internal resonator and ignore the connected crystal; I haven't tried this. Could you clip off the external crystal if you needed to?
This article talks about setting the fuses that control the clock frequency. One thing to keep in mind is you'll need to replace the bootloader with one appropriate for the new clock frequency. You may find an 8Mz bootloader ready to upload, or recompile it yourself from source. Optiboot is a good choice: open source, has a small footprint, and you can set its upload baud-rate. You can upload a new bootloader using another Arduino as an ISP programmer - there are lots of articles about doing this and the code for the Arduino-as-programmer is one of the Arduino IDE example-programs.

There appears to be quite a few reports of people successfully running a 328p at 3.3V running at 16MHz.  If you split the difference between the two chips at about 3.6v you should have a good chance at success.

Would it be possible to run the ATmega at 8 MHz using a 16 MHz external oscillator by simply uploading a new sketch? I have tried running at 3.3V with the 16 MHz and it does not work properly. So, I might switch at 8 MHz but my problem is the 16 MHz external osc is already soldered.


text:
Button state changes despite not being connected?
I have written some code to test buttons that I want to use
const int buttonPin1 = 1;
const int buttonPin2 = 2;
const int buttonPin3 = 3;
const int buttonPin4 = 4;
const int buttonPin5 = 5;
const int buttonPin6 = 6;

int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;

void setup() {
  Serial.begin(9600);
  pinMode(buttonPin1, INPUT_PULLUP);
  pinMode(buttonPin2, INPUT_PULLUP);
  pinMode(buttonPin3, INPUT_PULLUP);
  pinMode(buttonPin4, INPUT_PULLUP);
  pinMode(buttonPin5, INPUT_PULLUP);
  pinMode(buttonPin6, INPUT_PULLUP);
}

void loop() {
  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
  buttonState5 = digitalRead(buttonPin5);
  buttonState6 = digitalRead(buttonPin6);

  if (buttonState1 == HIGH) {
    Serial.println("button1 press");
  }
  if (buttonState2 == HIGH){
    Serial.println("button2 press");
  }
  else if (buttonState3 == HIGH){
    Serial.println("button3 press");
  }
  else if (buttonState4 == HIGH){
    Serial.println("button4 press");
  }
  else if (buttonState5 == HIGH){
    Serial.println("button5 press");
  }
  else if (buttonState6 == HIGH){
    Serial.println("button6 press");
  }
  else{

  }
}

I have tried with the buttonPins being A0-A5 as well, and whenever I try to run the code, it always spams out that button 5 and button 2 are being pressed, despite me not pressing them, as well as when I remove the buttons entirely, and pull out all the wires from it, it still prints it out. Even when I re-run the code. How can I fix this?

Yes? That's to be expected. The clue is in the pin mode.... INPUT_PULLUP - and you check to see if it's HIGH. See the correlation?

how did you wire the buttons?

@Majenko oh, I see, so it's when I release it? That explains it.

You are setting button pins with INPUT_PULLUP mode, which activates internal resistor connected to supply voltage. In this way, your input pins are in state HIGH if disconnected or if button is not pressed.
To fix this, you need to compare your button state with LOW. Also, make sure that one side of your buttons is connected to ground. Then, pressing the button will connect the button to ground and will bring your button pin to LOW.


text:
Eclipse Arduino Leonardo Pro Micro ATMega32U4 Programming Issue
Help Needed as I am little bit lost. I've procured a Pro Micro Board from sparkfun. Great little board and it work like clock work when using the standard Arduino Programming IDE.
Well Copied the code thru to the Eclipse Project, Hit compile and all seems well. But Trying to write the code to the device the following happens.

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch
     System wide configuration file is "C:/Users/vente/.arduinocdt/packages/arduino/tools/avrdude/6.3.0-arduino14/etc/avrdude.conf"

     Using Port                    : COM5
     Using Programmer              : avr109
     Overriding Baud Rate          : 57600
     AVR Part                      : ATmega32U4
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : butterfly
     Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = "F"; type = @
    Software Version = �.u; Hardware Version = �.
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader
avrdude done.  Thank you.

I've setup the Programming interface a as a Leonardo Board. AVR ISP.
For some reason It seems as if and it might be me that the usb does not reset? and go into programming mode.
Please Help

I am not familiar with that programming environment, but to enter the bootloader on those boards you have to open the serial port at 1200 baud then close it again. Normally the Arduino IDE does that for you. Does this system? Possibly not.

I assume you use Eclipse Sloeber plugin for Arduino. For serial upload over USB using bootloader choose programmer Default. All other programmers are for flashing over ICSP.

Okay I have installed version 2018-09 (4.9). The Toolset loaded is Arduino C++ Tools 9.5.3.201809121146. It was loaded with the help of the Yatta Plug-in interface. Under the Board  Configuration I Do not have the option to Select DEFAULT

So you don't use Sloeber Arduino Eclipse plugin

Just Re-installed  my Eclipse and found Mutiple Issues.The Path was to long under windows and this caused Sloeber not to install. I moved it and all seems to be fine now. Thanks

@MarthinusVenter, now I don't know. did my answer help or the problem was something else?


text:
GPRS Based OTA to the NODEMCU
I need the OTA firmware update. I have the only option in my hand GSM(GPRS SIM800), with the help of this is it possible OTA, plz help me for this how I Do OTA via GPRS, FYI, I completed OTA Via WIFI.

Download the bin file over GPRS and then use the Update singleton object. It is declared in Update.h. Example is ArduinoOTAClass::_runUpdate() in ArduinoOTA.cpp or ESP8266HTTPUpdate::runUpdate() in ESP8266httpUpdate.cpp


text:
Measure movement distance - not sure what sensor?
I want to measure the length of a step / stride -not sure what sensor to use.
I am trying to get several people to march a pattern for a band.  I am thinking a Arduino to beep when step is too short or too small.  Thinking the Arduino will be tied to their shoe laces.  IR or Ultrasonic do not seem to be the correct sensor to use.
Ideas?

Maybe just go lowtech and simply use rope? Tie person ankles together to train muscle memory when walking. Doing precise measurements quickly and in uncontrolled enviroment is a nightmare to sensors.

Or, to pick up Filip Franiks idea, use a small rope on a coil, that will roll itself up automatically. A step would roll some rope of the coil and you can measure the amount by measuring the rotation of the coil (for example with a rotary encoder).

The sensor to use is an accelerometer. The principle is easy: measure the acceleration, perform a double integration and you have the distance (after the first integration you have the velocity).
The problem is that, because of the double integration, small errors in the acceleration signal lead to big errors in the calculated distance. For example: an error e in the acceleration leads to an error e.t2 in the distance (where t stands for time). For this reason al sorts of filters are used often in combination with gyroscopes and/or gravity sensors. The signals from the gyroscopes and/or gravity sensors are used for the low frequency signals (long term) and te signals from the accelerometer(s) for the high frequency signals (short variations). That's why you find these sensors often combined in one package (for example the BNO055 form Robot Electronics https://robot-electronics.co.uk/bno055.html).
It is a complicated and highly mathematical area of science. In fact you want to do the same thing as fitness trackers do (and I think you are striving to a higher accuracy than they) - and there are not many that do really well.
P.S. Robot Electronics also sell a tilt compensated compass board with this BNO055 chip: the CMPS12 (https://robot-electronics.co.uk/cmps12-tilt-compensated-magnetic-compass.html). With this board you can read out absolute and relative positions straight away without any calculations.


text:
Arduino powering to control sensors
I would like to know if it's possible to power up arduino by VIN pin (say 9v) and use 5v output pin to connect to a sensor.
Many thanks

Yes. It is. That's why it's called VIN. Voltage INput.

depends on how much current is required by the sensor to function correctly

Hello. Thanks for the replay! The sensor works with 5V but the manufacture says "External power supply (7~12V) is necessary to supply the microcontroller board when you using this CO2 sensor module."


text:
Is it possible to connect many (20+) SPI sensors to an Arduino Mega?
I am making a system for measuring whether or not there is vacuum present in big steel containers. They are located up to 100 meters from the control cabinet.
The question is, how many SPI sensors can I successfully use at the same time with an Arduino Mega?
I have two main concerns, and there are probably more things I didn't think about.
Signal strength
The shared lines for CLK, MOSI and MISO will need to be split up at several junction boxes and led to the different sensors. Since the voltage out from the Arduino is fixed, I'm fearing instability because the signal is weaker for some sensors, has someone done something similar? What is the greatest acceptable voltage loss for these lines to an ordinary sensor?
Processing
Will the SPI library be fine coping with this many sensors?
The refresh rate can be set to extremely low, thinking 0.3Hz.
The alternative to all this is to go for 4-20mA sensors and have a 0-5V converter circuit for each sensor, near the controller.
Any inputs would be greatly appreciated!

The spi bus is ment to be used on the same board, or else for a very short distance. The i2c bus is also for short distances (because of its weak pullup signals). The rs485 is for longer distances. Which board to you use? The arduino mega 2560 is not the same as the esp8266. The 4-20mA sensors will work but when such long cables are connected to the arduino, that might damage the arduino. Do you use shielded cables? Perhaps there is a module for multiple 4-20mA isolated inputs and with a digital interface to the arduino.

I'm thinking of using the Arduino Mega 2560 to receive and convert all signals, and then transmit data lines to an ESP8266 ESP07, which sends all data via MQTT over Wifi. I haven't bought the cables yet, but I was thinking to use individually shielded cables, yes. The supplier says the 4-20mA sensors will be fine for 100m. The arduino is the digital interface here really, if there's something else better suited, let me know. I'd like to use the Arduino IDE to program in, because I know it well already.

the user has declared that he is no longer interested in the question and did not upvote any of the answers.   it is a noteworthy subject which should get community attention regardless.

You need to drive SCK, MOSI, and 20 chip select lines long distance, and then receive MISO back long distance.
The number 20 for slaves is not a problem.
Long distance and maintaining signal integrity will be a problem.
I would suggest a bussed newtwork and send serial data to/from 20 slaves (like ProMini) and let the slaves do the SPI data gathering and then pass that data back to the Master Mega in a polled fashion: #1 send your data, #1 here it is. #2 send your data, #2 here it is. Etc.
Then you just need to connect up a 3 wire bus  (RS485+, RS485-, Gnd) from device to device to device with termination resistors at the end of the run. Power each device seperately vs running power to all of them.
Maxim has some nice tutorials on connecting up RS485.

Hi and thank you for your reply, however this was half a year ago, and I've since completed the project using 4-20mA sensors with separate wires. It turned out to be a flexible and rugged way of doing it, despite using many cables.

You can control as many SPI devices as you can set the CS line for. You can even control all the CS lines from a SPI device. A SIPO register will help a lot there.
However you are probably better off using a proxy board to actually connect to the sensors and then connecting the mega to the proxy to communicate the measurements using a connection that is more robust over long distances.

Since the Arduino Mega 2560 has a lot of DI/DO, that's why I wanted it to control many CS lines. I'm new to SIPO, is that a good solution for communicating over several cables? A proxy board can be a solution, wires need to be run anyway... but I would of course want to keep the complexity as low as possible. What kind of board would be suitable for that, another arduino, and which cable between them?

Relevant suggestion, UPVOTED.  :)

I would recommend using multiplexer(s) for the task.

Originally from this tutorial.

Or this tutorial by Sparkfun


text:
Reading a simple sensor with Modbus RTU on Arduino Uno
I'm integrating a wind direction- and speed sensor with an Arduino. It communicates over RS485 Modbus RTU, which I don't have any experience with.
The documentation is very short, and it just says:
9600bps, 8 bit, stop bit: 1, check bit: no
Slave address is FFH.
Host Scan Order( slave address 0xFF)
FF 03 00 00 00 02 D1D5
Slave Response
FF 03 04 00 09 00 3A 0401
The bold parts are fixed, the last two bytes are for checksum.  So the data of the response is direction in the two first bytes (00 09), and then speed in the two after that.
So basically I gotta send that exact byte sequence to the sensor, and then decode what I get. I'm not gonna need to do anything more advanced with this, and so I'm trying to figure out what the most easy way to do this is.
There are different modes, like single, mutliple registry, discrete values, coils, I don't know which one I'm supposed to pick, would be grateful if someone could take the time to explain to me how to do it.

the 03 is Read Holding Registers

Thanks, Juraj! That helps. Do you know what the 04 is, is it some kind of address?

04 is length of data. 4 bytes

https://en.wikipedia.org/wiki/Modbus


text:
Can ESP8266 send AT commands to self?
I'm having some problems with my ESP8266 stopping transmission of MQTT messages after a while.
Therefore I'm writing some error handling messages, and I want to publish some AT data to MQTT.
It's probably a simple solution, but how can I, though the code, send AT messages from my 'own' device?
Also, does AT messages get parsed at a higher level than any other user input, so it can't get stuck in any user made input loop?
Many thanks!

How do I send the message to myself, though, can I write to the input buffer that belongs to the serial connection?

I'm gonna have a loop in my Arduino code, so that if the unit doesn't transmit any sensor  data for 2000ms, it will try to transmit diagnostic data provided by AP commands, so I need to read them as a c string. If I could read AP commands by mqtt subscription, that would also be quite interesting.

The AT command set for the ESP8266 is implemented through custom firmware which has to be flashed to the chip to use.
If you've written your own software which is running on the ESP8266 then that's what's flashed to it - the AT command set will not be available because you've overwritten it with your own software. So there's no way to send AT commands to yourself because if you've written software that could do that, then it's present and the AT command-interpreting software is not.
In that case you should look deeper into the Arduino core for the ESP8266 to find the equivalents to the AT commands you wanted to use. This is the code that calls setup() and loop() and implements Arduino-compatible functions like pinMode(). It also provides libraries like ESP8266WiFi. There are many un- and under-documented functions in the code. You can almost certainly find the equivalents to anything that you can do with an AT command in here.

Thanks, that's pretty much what I was confused about! I'm sure I can do without..


text:
Can you use an Arduino to control the output current and voltage of a DC/DC converter?
I am using an arduino to create a device that outputs a specific current and voltage. I was wondering if there are any devices out there such as dc/dc buck boost converters that can be controlled by arduino to output desired powers. I am looking for something rated for at least 50 watts  that can carry at least 3 amps of current.
Thank you all in advance!

I've seen I²C controlled digital potentiometers. I know you can set the output voltage of some power supplies with a pot. If you can also control the current, you could control both properties with a pair of digital pots.

What is the desired input voltage?

@RobertoLoGiacco I currently have a power suppy input voltage of 12V.

Yes, and it's actually far simpler than most realize. I've tried digitpots, but they are quite un-linear and only handle 5v, unless you spend $$$. Early on, i had soldered an LDR in parallel to a buck converter's adjustment pot, and fed that PWM. It worked to somewhat adjust the vout, but had a lot of ripple and was not linear. I had gotten an MCU-controlled linear PSU going, that wasn't too hard, but i always wanted a buck. Just recently, i've found an awesome method and built several MCU-controlled SMPSs.  You don't have to have any special parts or de-solder anything!
Basically, you:

use a buck/boost (or dual) with a built-in V-adj potentiometer.
use a lowpass to convert the MCU's PWM output into a 0-vcc signal.
feed smoothed PWM voltage to a unity gain opamp to buffer available current.
create a common ground between MCU and SMPS.
feed the buffered 0-vcc control through a resistor into the pot's wiper, ~200-1k.
the amount of "injected" voltage will be inversely proportional to the SMPS's output voltage.

Since most SMPS's feedback is in the area of 1-2.5v, the 0-3.3/5v output of the MCU works well to provide or take away feedback from the regulator. The best part about this scheme is that output voltage regulation is maintained by the SMPS's hardware, the MCU just sets an offest. In short, you can set it to 10v via the MCU, attach a big load, and the voltage stays at 10v!
I've used this technique on the xl4005 and the xl4015, but i would imagine it would work for just about any common driver package.

This is a voltage regulator, the OP asked for a voltage AND current control circuit

@RobertoLoGiacco If you can control the voltage, you can control the current as well. The simplest would be to use the MCU, which probably suffices for loads like motors and heaters. For LEDs or instrumentation, you probably want hardware control. There's many "current limiting" circuits one could place in-line as well, simplest likely being a current shunt with op-amp amplifier driving an NPN darlington in a series-pass regulator or using the opamp to invert and amplify and supplement the SPMS feedback like described above for voltage. If OP wants, I can sketch something out...

@dandavis Sorry if it´s an old topic, but if you´ve got an MCU with a DAC output, like the ESP32, can the DAC output be connected directly to the resistor that connects to the wiper pin, and don´t use the opamp to buffer current?

@Rodrigo: a few thoughts. The 32 only has 256 DAC levels, so I would much prefer to smooth PWM with a cap and resistor instead of the DAC. The relatively low-impedance opamp buffer's output "pushes" a lot harder than the DAC or a smoothed PWM signal, and that may be required to steer the SMPS, depending on the R values of it's feedback circuit. In short, I imagine a DAC-only setup would give you partial range control over the SMPS output, and if only codes 64-196 work, the result could be a rather crude/jumpy control circuit. That might still be acceptable for some applications though...


text:
Looking for a cheap small arduino ish board
I'm looking for a cheap and small bluetooth board for a project.
I found this one, but I find this one too expensive, are there cheaper alternatives, in similar size?
Thank you!

An ESP32 module?

preferably an all in one, for the project I currently use a wemos d1 mini, which works fine, but wifi isn't the best way of controlling it. that's why I'm looking into bluetooth

And that's why I suggested ESP32.

Oh sorry, I was confused by something else, this was indeed what I was looking for, thank you!

I guessed you'd confused it with the ESP8266, which is WiFi only. The ESP32 is WiFi and BLE combined in one chip.

I'd suggest investigating the ESP32.
It's not only a far more powerful chip than any normal Arduino, but it has both WiFI and Bluetooth Low Energy, all on the one chip.
It's available as surface mount modules, similar to the ESP8266, and there are a number of small development boards that have been created around it as well.


text:
CC1101 sniffing 868Mhz Protocol from thermostat
Hello i buyed a cc1101 because I want to sniff thermostat protocol which works with 868 Mhz.
I found this repo https://github.com/veonik/arduino-cc1101.
I tried to download the repo and include the zip file as libary.
First error was cc1101.h not found. So I moved the files from .src folder one level up.
Then I get error SPI.h no file directroy. So I imported this libary.
Now I have no errors and uploaded it to arduino mega.
Then I have no serial output. I have a cc1101 with 868 mhz. And I want to log the informations from a MAX! thermostat. Somebody can help me?
Here is photo from my wiring.

SPI on Mega is not on pins 11 to 13, but on 50 to 52. 50 is SO, 51 is SI. 53 is the usual CS as it is the SS if Mega is slave. why do you wire over breadboard? use black wire for ground, red for VCC. didn't you get a pin header with the module?

Ok thank you. No pin header. Should I change the programm?

no changes in sketch. change the wiring and wire the additional pin CC1101_GDO0 to 19

So I moved the files from .src folder one level up. -- Sounds like you're on Linux, and you installed Arduino from the Debian APT repository. Uninstall it and download a version from this decade from Arduino.cc

I changed the wiring. Now I get only CC1101_PARTNUM 0
CC1101_VERSION 20
CC1101_MARCSTATE 13
CC1101 radio initialized.
showed in serial monitor


text:
Program Upload Loading problem
Please help me about this program uploading problem.
 Arduino: 1.6.13 (Windows 10), Board: "Arduino Nano, ATmega328P"
Sketch uses 930 bytes (3%) of program storage space. Maximum is 30,720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can't open device "\.\COM1": The system cannot find the file specified.
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

did you select the right port in Tools menu?

It can have many options, the main reason is it cannot communicate with the Nano.
I try to create a list with options:

Hardware issues

Nano is broken (solution: change Nano)
USB cable is broken (solution: change cable)
USB port is broken (solution: change USB port)

Software issues

USB port 'corrupt' (solution: use another USB port)
USB connection incorrect (solution: reconnect USB cable)
IDE is corrupt (solution: reinstall IDE)
Nano in illegal state (solution: reset/reconnect power of Nano)
Serial communication is used (remove RX/TX wires)


text:
How to modify current driver files in USB_Host_Shield2.0 on github for Arduino Mega ADK USB driver for Epson LQ-310 printer?
At the moment, I am engaged in a project in which I have to drive Epson LQ-310 printer with Arduino Mega ADK (USB Host). There is already a library  USB_Host_Shield_2.0 on Github which includes usb drivers for keyboard, flash drive etc. but not for a printer.
I am thinking to modify the current header files (adk.h and adk.cpp) based on Android drivers to suit for a printer. Do the things workout in this way?
Could anyone of you please suggest me the things to modify to achieve the required functionality?
Thank You

start here https://www.usb.org/sites/default/files/usbprint11a021811.pdf

and you will need this http://gimp-print.sourceforge.net/reference-html/c463.html#AEN474


text:
How to safely remove arduino nano from breadboard?
I did some prototyping with arduino nano in breadboard. And then after i done with the design, I was gonna implement it in a printed pcb so i need to remove the nano from breadboard. And this is when the disaster happened.
The board is kinda hard to pull by hand, so i use a long-thin screwdriver in the gutter to pull the nano up (just like i did many times to dip ICs with no problem). And successfully detached the nano from breadboard and also broke the tantalum under the nano in the process. So the question is:

How do you usually remove the nano board from breadboard safely? And
The tantalum i broke is 4.7uF smd. I can't find any 4.7uF tantalum in nearby shops, but i have electrolyte caps rated 4.7uF 16v. Can i use it for replacement?

Use long and wide screwdriver. put the tip under the board. Do not pull! Gently twist the screwdriver. After few millimeters do the same from the other side. After several such operations nano will be free with no pins bent, and no hardware damaged. For additional safety substitute screwdriver with something plastic.

What you really want is one of the long black plastic spudgers. Metal screwdrivers are asking for trouble. Plastic will flex more than the components.

How do you usually remove the nano board from breadboard safely? And

If you can't remove it by hand (grip it lengthwise and ease up each end with your finger / thumb levering against the breadboard) then you need a lever. The best is a plastic spudger, such as this:

The plastic will flex rather than damage the Arduino. Using a screwdriver can, as you have noticed, damage the Arduino.

The tantalum i broke is 4.7uF smd. I can't find any 4.7uF tantalum in nearby shops, but i have electrolyte caps rated 4.7uF 16v. Can i use it for replacement?

Sure. All that is, is a reservoir capacitor on the USB input. The value isn't super-critical, as long as the voltage is above 5V. It's not, strictly speaking, even needed. You can just remove it completely and clean up the pads to ensure there's no shorts. The board should still work fine.

I also had the same problem but what I had done was, I pressed the breadboard with my leg and used my all fingers to grip the nano and pulled it with my full force and then it is done. And no parts were damaged and id you lost any part you can search on https://octopart.com/ .

And if you just broken the whole you need to buy a new one. Or if not follow my answer.


text:
Teensy 2.0 usb xinput device
So I came across a library that lets you turn your TeensyLC/3.X into an xinput device. I only have a 2.0 on hand. I spend the past few hours messing around with the LC example to see if I could hack it over to work on a 2.0 board. Admittedly, it will take much more time analyzing everything before I can make a more educated attempt. I saw another project that is able to use the 2.0 as xinput devices but the firmware is only available in its hex form.
So I'm wondering what would be the best way to go here... all of the xinput code is in the /core/teensy3 directory. It has many spidering dependencies which will take a lot of time to go through and try and port(would that even work?). Is there a super "lite" version of the core that lets you fill out device descriptors/handshake/etc? If there is, the xinput just becomes a task of emulating the xinput packets.
Anyway, as this is my first usb input project, any suggestions would be greatly appreciated. Again, I already have the 2.0 and I know its possible so just getting a LC/3.X I'd like to avoid. I'm more just looking for direction on the best way to get started.

Teensy 2.0 has 8-bit Atmega 328p MCU. It doesn't have native USB port.
Teensy LC is a small Teensy 3.x. It has a 32 bit SAMD MCU with native USB port.

@Juraj the Teensy 2.0 has a Mega32u4 which does support native usb.

then it is like Arduino Micro. https://github.com/bootsector/XInputPadMicro

google GIMX firmware source and you will get this https://github.com/matlo/GIMX-firmwares/releases

The Teensy 2.0 is a completely different MCU from the 3.0 with very different libraries.
USB on the 32U4 on the 2.0 typically uses the LUFA library for USB.
So to answer your question: I doubt it will be possible to port code written for the 3.0 SAMD based teensy to the AVR based 2.0 teensy without basically rewriting it from scratch.
The Arduino Leonardo also uses a 32U4 so you might want to look for examples code written for the Leonardo.
The examples from the LUFA library may be useful but they are not designed to be used with the Arduino IDE.
UPDATE From the comments, there is this project:
https://github.com/bootsector/XInputPadMicro that uses LUFA and targets the Leonardo.


text:
Trying to measure change in light levels over time
I have two LDR's attached to my Arduino Uno and an RGB LED as an output component. The two LDR's are at different offboard heights in order to see the change in light between them. I want to code on Arduino so that if the difference in light between the two LDR's does not change by a large amount over a 1 hour period (i.e stays similar), it will make the RGB  LED flash. I know that I have to use an if and else statement to do this, but does anyone know how I can code it so that I can achieve the above statement?
Thanks

you need to be able to read the values of the LDRs first ....... start by reading the value of one LDR and print the value to the serial port ..... when you are successful, read values of two LDRs and print their values to serial port

The needed algorithm strongly depends on what you really want to detect. Imagine following setup: your sensors are in two dark boxes, and you are putting a flashlight into the first box. After half an hour you take out the flashlight and put it in the second box. Looking each minute at both sensors, you will have the complete hour max. difference. Looking at the whole hour, both sensors have seen the same amount of light. To help you it would be good if you give a little bit more of information what are your use cases.

Break this into pieces. Solve the pieces one at a time.
Write code that reads the 2 photocells and calculates the difference between them. Log that difference to the console.
Then add a global variable to remember the old difference, and a max difference. Each time you take a new set of readings and calculate the difference, compare it to the old difference. If the new difference is greater than the old difference, update the max difference. Then update the "old difference" with the new reading.
Figure out how to use millis() to record a starting time, and monitor the reading difference until an hour has passed. If the reading difference is below your "large amount" threshold, start the light blinking.
Then you need to decide what to do about times greater than an hour. Do you track the max difference over the most recent 60 minutes and flash the light if it is below your threshold? Maybe save a difference reading every 5 minutes into a ring buffer with 12 entries (an hour's worth of entries) and keep checking the ring buffer for a difference value greater than your threshold? (You should be able to Google search "C ring buffer" for sample ring buffer code. It's actually quite simple to implement.
You might also want to calculate a moving average difference reading, and compare each reading to that. I recommend using an Exponential Moving Average (EMA).
I have code in my project that uses EMA to calculate a single brightness value rather than a difference, but the idea is the same. Here is an excerpt from my code:
Define a global:
float   photocellAverage =      0;

#define sampleCountToAverage 100  //The larger the number of samples, the more slowly the average will change with each new reading.

Then
int photocellValue = analogRead(photocellPin);
photocellAverage -= photocellAverage / sampleCountToAverage;
photocellAverage += float(photocellValue)/sampleCountToAverage;

For you, you'd be calculating a difference reading and an EMA of that difference reading:
float   photocellDifferenceAverage =      0;

int photocell1Value = analogRead(photocell1Pin);
int photocell2Value = analogRead(photocell2Pin);
int photocellDifference = photocell1Value - photocell2Value;
photocellDifferenceAverage -= photocellDifferenceAverage / sampleCountToAverage;
photocellDifferenceAverage += float(photocellDifference)/sampleCountToAverage;

I like the way you implemented the EMA. May I suggest for better understandig to change the naming for the difference EMA from ´photocellAverage´ to ´photocellDiffAvarage´. It took me some minutes to puzzle out that the context changed in your second excerpt. I also wonder why you are initialising with 0 instead of initializing with the first sensor value/first difference. Do you have a specific reason for that?

As for not initializing with the first value, it's laziness. I should have. It will settle out to the same value fairly quickly, after all.

Thanks for your answer, I don't whant to be annoying, but could you please  change photocellDifferenceAverage -= photocellAverage / sampleCountToAverage;
to photocellDifferenceAverage -= photocellDifferenceAverage / sampleCountToAverage;? Or I still did not understand your construct ;-)? I tried it in Excel, at the firts glance it looks like a PT1 element, is your EMA a elegant way to implement a PT1 Element or are there differences in mathematics behind?

I fixed the 2nd part of my answer. I must confess I found the code for EMA online, and adapted it to my needs. I don't know enough about the underlying mathematics to compare it to a PT1 Element. (I had to google that to learn what it is.)


text:
Arduino and SIM900 unavailable all the time
I have the a problem with my arduino MEGA 2560 and the SIM900 module.
I want to save the outputs of the AT commands, but I never get a chance. If I print mySerial.available() I only get 0.
Sending SMS works fine on the other hand.
Initializing...
AT+CMGF=1
AT+CNMI=2,2,0,0,0

OK
Done
AT+CMGL="REC UNREAD"

OK
0
0
0
0
0
0
0
0
0
0
0

This is the sketch I use:
#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(11, 10); //SIM900 Tx & Rx is connected to Arduino #7 & #8
String incoming="";
String incoming2="";
String messages="Test";
String auth_num="+49xxxxxxxxx";
char incoming_char=0;

String response = "";

const byte numChars = 32;
char receivedChars[numChars];
boolean newData = false;

int period = 6000;
unsigned long time_now = 0;

void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);

  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);

  Serial.println("Initializing...");
  delay(1000);

  mySerial.println("AT+CMGF=1");
  mySerial.println("AT+CNMI=2,2,0,0,0"); // Decides how newly arrived SMS messages should be handled
  //mySerial.println("ATE0");
  updateSerial();
  Serial.println("Done");

  //sms_versenden("xxxxxxxx", "text");
}

void loop()
{
  updateSerial();
  Serial.println(mySerial.available());
  if(millis() - time_now > period){
    time_now = millis();
    if(sms_erhalten()){
      sms_autorisiert();
    }
  }
}

void updateSerial()
{
  delay(500);
  while (Serial.available())
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available())
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

void sms_versenden(String rufnummer,String text)
{
  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();

  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  if(rufnummer.startsWith("0")){
    rufnummer.remove(0,1);
    mySerial.print("AT+CMGS=\"+49");
    mySerial.print(rufnummer);
    mySerial.println("\"");
  }else if(rufnummer.startsWith("+49")){
    mySerial.print("AT+CMGS=\"");
    mySerial.print(rufnummer);
    mySerial.println("\"");
  }else{
    return;
  }
  updateSerial();
  mySerial.print(text); //text content
  updateSerial();
  mySerial.write(26);
}

boolean sms_erhalten()
{
  mySerial.print("AT+CMGL=\"REC UNREAD\"\r");
  //recvWithEndMarker();
  Serial.println(mySerial.available());
  delay(30);
  while (mySerial.available()){
    String inData = mySerial.readStringUntil('\n');
    Serial.println("Got reponse from SIM900: " + inData);
  }
  /*if(mySerial.available()>0){

    incoming = mySerial.readString();
    Serial.print(incoming);
    delay(10);
  }*/
  updateSerial();
  if(incoming.startsWith("+CMGL:"))
  {
    return true;
  }
  else{
    return false;
  }
}

void recvWithEndMarker() {
    static byte ndx = 0;
    char endMarker = '\n';
    char rc;

    while (mySerial.available() != 0 && newData == false) {
        rc = mySerial.read();
        updateSerial();
        if (rc != endMarker) {
            receivedChars[ndx] = rc;
            ndx++;
            if (ndx >= numChars) {
                ndx = numChars - 1;
            }
        }
        else {
            receivedChars[ndx] = '\0'; // terminate the string
            ndx = 0;
            newData = true;
        }
    }
}

void showNewData() {
    if (newData == true) {
        Serial.print("This just in ... ");
        Serial.println(receivedChars);
        newData = false;
    }
}
String getResponse() {
    while(mySerial.available()>0){
        response += mySerial.read();
    }
    return response;
}

Thanks in advance for every idea.
Bravodelta

if you turn on echo, it doesn't print the commands back? check the wiring

@Juraj The echo is on and as you can see in the first code block I get an answer, but I can't save it in a String.

try mySerial.println("AT+CMGL=\"REC UNREAD\"");

@Juraj Sadly this doesn't work either

Rather than creating your own function used SerialEvent function in arduino. It acts as a serial interrupt in arduino. For example:
String inputString;
void serialEvent() {
      while (Serial.available()) {
        // get the new byte:
        char inChar = (char)Serial.read();
        // add it to the inputString:
        inputString += inChar;
        // if the incoming character is a newline, set a flag so the main loop can
        // do something about it:
        if (inChar == '\n') {
          Serial.Println(inputString);
        }
      }
    }

don't use serialEvent. it has no advantage. it is the same as checking Serial.available() in loop

The serial event system does not act as an interrupt. It is no different to adding if (Serial.available())... in your loop() function.  I wish Arduino had never implemented it - it's a stupid idea.

@Juraj why no for using serialevent function? What harm does it causes?

@Majenko had you tried serialevent function?

@Vaibhav Worse than that - I have had to implement it on a compatible platform, and had to take a shower in sodium hydroxide afterwards to get the taint off my skin...

it gives a false expectation that it will be executed no matter what you do in the loop(): delays, endless loops


text:
Controlling multiple Screens using IR
I'm a software Engineer, and recently I’ve been working on a new Software
Part of this Software is to be able to turn off and on multiple TV screens using timers in the software
First idea came to my mind is using relays with Arduino and connecting in to computer using Bluetooth chip but not all screens turns on once the power cable is plugged in
So, I tried IR CIRCUIT using NODEMCU and IR LEDS. And it worked but not perfectly,
The way I did this is by sending a combination of IR codes to screen to make a sleep timer so it will turn off the screen after some time.
But there was a delay when sending IR codes, and sometimes the code won’t be sent
This is the circuit I used (in addition to more  IR LEDS)

I just want to know why the codes are not sent every time
And if there is any better way to control the screens from computer?

Can you show us the code you have written?

There are ready-made items for this purpose, such as the iTach Flex with (triple) IR emitter. You may consider using something off-the-shelf to save time and to avoid messing around/frustration.