text:
15x15x15 LED cube with thermal sensors
I'm trying to wrap my head around a public art project that I've recently received funding for, and I'm hoping that someone here can help me with a bit of guidance.
The concept I'm working on is a kind of 'digital campfire' that builds and falls in intensity as people approach and depart.
The way I imagine it working is with a 15x15x15 RGB LED cube that plays fire-like animations of varying intensities in response to the presence of nearby people - detected by a 360 degree array of thermal sensors (probably something like Omron D6T sensors, rather than IR movement sensors).
Full disclosure: I'm an Arduino noob. I've tinkered with LEDs and soldering, but even the thought of building a non-responsive 4x4x4 LED cube hurts my brain. That said, I have a couple of months up my sleeve, a bit of cash, and a willingness to forge new neural pathways to get this done.
My main questions at this point are:

Can an Arduino even handle the processing power required to run a thermal activated 15x15x15 LED cube, even with multiplexing?
I'm considering 15-cubed because I want the object to have a fairly large physical presence, and have a relatively high definition. Is there any game-changing reason I should seriously consider something smaller? I anticipate being able to connect to a 240v power outlet (I'm in Australia), but running off battery would be ideal.
How difficult would it be to build a 360 degree thermal sensor array consisting of, say, 8 separate thermal sensors? The programming is clearly beyond me, and I expect to out-source this...

Any help or suggestions would be hugely appreciated. And don't be gentle – if my expectations need to be 're-aligned' to something closer to reality, I'd rather that happen sooner than later.
Cheers,
Adam

That sounds like a fun project. However... you're talking about 3375 LEDs there. That's a helluva lot of LEDs. Even with charlieplexing you'd need 59 IO pins just for the LEDs, and the wiring would be a nightmare. I'd be inclined to think about making it modular. Having it 16x16x16 would be more logical than 15x15x15 since it's a power of 2. Maybe make small modules of 2x2x16 (PCB at the bottom with 4 strings upwards) with a separate controller for each block. Get them to communicate - spread the load.

The answer to "Can an Arduino even handle the processing power" is probably No, but no one can really answer because you have not specified the problem.
Just for starters you have >3k LEDS, if you want to control RGB that means ~10k devices.
To operate at moderate brightness (10mA per LED) you will need at least a 35A power supply. This will require external high power circuitry to switch/control.
Do you need to individually control each LED? To control 10k devices you will need serious external circuitry.
Do you need to control brightness or just switch individual devices on/off?
You could probably achieve a solution, but 15 modules each controlling 15*15 LEDS may be achievable, 32 or 64 is probably more realistic.
Either way soldering by hand would be impractical, you need to design a board for each module.
You could use an Arduino on each module, but a ATMega chip would achieve the same end, without the unnecessary peripheral circuitry.

firstly we need a bit more detail, I'm assuming by saying a 15x15x15 cube you actually mean a cube with a 15x15 array of LEDs on each face, so you would have a total of 1350 LEDs. we also need to know if you intend to have just single colour LEDs of whether you want multi colour or even RGB with full control (like a monitor)
assuming you only want single colour with on/off control then look into the MAX7219 or MAX7221 IC's, these can be bought with LED matrix's already fitted, and each IC can drive an 8x8 matrix of LEDs, so you would need 4 ICs to do each side (these can be daisy chained) and so a total of 24 ICs for the whole cube.
but note that that would allow for 16x16 on each side.
the arduino can easily drive this many, what you need to consider is how often you want the LEDs to "update" i.e. the frame rate. the more you try and drive the slower you can drive it, however from experience i believe the arduino could easily drive that many LEDs in this arrangement.
on the subject of current the MAX72xx ICs work by multiplexing the output for you, so at most only 8 out of each 64 LEDs are on at any one time, so if you drive each at 10mA your maximum current would be 1.7A, probably a bit much for batteries (unless you use something big, AA's or a 9V won't cut it.) but still reasonable.
if you wanted individual brightness control things get more complicated, and the rate at which you could update the outputs would sharply drop off. I still think it would be feasibly for this many LEDs but you may find your update rate is only 10-20 times a second so any motion may not appear very smooth.
but this way will require a lot more wiring, and will be a lot more complex to program.
if you want full RGB control then the amount of connections and components required would grow to ridiculous proportions, you would need 3 connections plus power to each LED so about 4000 connections between your control circuitry and your LEDs, and your current requirements would go through the roof due to so many LEDs being on at the same time.
and if I read wrong and you actually want 3375 LEDs on each face, for a total of 20250 LEDs then this becomes extremely impractical, even with output multiplexing (mentioned above in the MAX72xx bit) the current requirements would be insane. not to mention the time taken to update all those LEDs would drastically slow down how quickly you could update them. even at a max data rate of 30MHz (SPI) you will probably only be able to update your LEDs at around 1-2 times a second, and there would not be enough RAM in the arduino to remember the previous output states when you are calculating your next ones.
a raspberry pi may be more suitable from that point of view, but the current and the update rate would still be a problem.


text:
Serial port - ESP8288 (TCP/IP) - WiFi - "Virtual serial port on my linux/windows PC" [Solved]
Is there an way to transport a serial port via TCP/IP to a PC.
The goal is to have a ESP8266 dongle that I connect to a router, switch or other device with a serial port for configuring.
I have found RFC 2217 that is suitable for the goal. Is there a arduino implementation ? Or any other way to get to the goal?

You mean besides the example that comes with the ESP8266 boards package that does just what you want?

Now I have to take a look at the examples.
A FB friend pointed me to https://github.com/jeelabs/esp-link/ that looks like it will do the work as well. Thx

There's one called (I think) WiFiSerial. I took that and built on it to add RFC2217 support a while back. Never got round to testing it since I don't have an RFC2217 client, but I have used it for programming boards remotely.

Majenko, could you share the code?

If I can find it, sure.

Here you go - make of it what you will.  If you fancy pushing any changes and fixes back as a PR in Github that'd be great. https://github.com/MajenkoProjects/WiFiSerialDTR

source: Stack Exchange

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

sort: votes


text:
serial data gets spoiled
I use this small program on my Raspberry Pi to recieve a string sent by my arduino.
import time
import serial

ser = serial.Serial('/dev/ttyACM0', 9600)

def check_for_command():
    bytestoread = ser.inWaiting()
    if bytestoread != 0:
        temp = ser.read(bytestoread)
        print(temp)

while 1:
    check_for_command()
    time.sleep(0.1)

the code on the arduino is rather simple:
void setup(){
Serial.begin(9600);
}

void loop(){
Serial.println(“Hello Pi”);
delay(2000);

the annoying part is. I recieve this:

b'Hello Pi\r\n'

instead of the clean

Hello Pi

How do I get rid of those extra bits without using a list for each character.
Thank in advance!

The python code does not need to be anywhere near this complicated.  Once you open the device to the handle ser, then all you need is --
linenin=ser.readline() --- and it is good that you are using -- Serial.println -- on the Arduino that sends the \n character at the end of the string so it will work just fine.  Then all you need in Python is --  print linein -- to see what you have received.  Nothing complicated is required.  Just treat it like a file, and remember that ser.readline() is a blocking function.  It will stop everything and wait for input.

The b prefix in Python 3 just means that it is a bytes literal. It's not part of the output, that's just telling you the type.
The \r\n is a common Carriage-Return and Newline line-ending characters. You can remove that from your string by calling strip().
Since these are floating-point numbers being returned, I'm guessing you're going to want to use them in some way after they are read, too:
import serial

ser = serial.Serial('/dev/ttyACM0', 9600)
while True:
   value = float(ser.readline().strip())
   print('New value is {0:0.2f}'.format(value))

See also:

What does the 'b' character do in front of a string literal?

trying to use your lines it gives me a format error on the last line. just before the .format

Can you copy and paste the exact error?

fixed that error found a new one that sometimes occurs, the first problem was: I am using python 3 so print needs brackets. :)      the other error is when by accident serial chains two numbers:  ValueError: could not convert string to float: b'21.020.5'

I have updated my code to include python 3 style prints.

and now you suggest a try and catch to avoid the ValueError?

The ValueError occurs only when serial chains two numbers, right? In that case you could either use a try and catch or increase the delay in Arduino's loop.

if I would like to send a string instead of a float and want to get rid off the b prefix? changing float into string doesnt work.

What is the exact error message?

Use this line
temp = ser.readline(bytestoread).decode('ascii')

instead of
temp = ser.read(bytestoread)

As the bytes sent by Raspbian is encoded in UTF-8, use the following line in order to avoid a strip() at a later-on stage:
temp = ser.read(bytestoread).decode('utf-8')

Well, it's not the Raspi sending but the Arduino. And decode() does not strip the '\r\n' from the decoded string.

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

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


text:
How to create a String with Temperature Value From An int Value
The following code is for a temperature controlled relay which turns a DC fan on and off when the temp threshold is breached. I'm using a DS1820 Temperature sensor and the code for this has several variables including WholeDegrees & FractDegrees Which are the whole number of degrees and the fractional number of degrees. I'm wanting to be able to set the threshold to lets say 23.25 Degrees so that when the temp rises above that then the fan comes on.
I'm trying to do this by using a two condition if statement howeveer, the FractDegrees are causing me a problem because if condition 1 is true and and the WholeDegrees is greater than 22 but the second condition the FractDegrees is lower than 25 then the relay turns the fan off again. So I get the fan turning on for a split second and then off, then on & off again which isn't a problem when the temperature sensor is at roughly the temp I want to set the threshold at but when it's at say 40 Degrees The fan cuts in and out whilst cooling until the sensor is roughly at the threshold value again.
I have kinda had a go already but failed which you might see in the //'d out code but is there a way that I can put these two values WholeDegrees & FractDegrees into a string so that I could have a string with the temp value and then use a single condition if statement to turn the fan on and off by checking the strings value instead?? I'd want the string to be "WholeDegrees.FractDegrees" So that I could just use the if statement to ask if the temp was greater than 23.25 degrees.
The code I tried returned a value of "0.0" which obviously wasn't the temperature value but I couldn't understand why......
#include <OneWire.h>
int inPin = 10; // define D10 as input pin connecting to DS18S20 S pin
OneWire ds(inPin);
int relay1 = 8; // define relay Signal Pin to Digital Output 8
//String stringOne, stringTwo, stringThree;

void setup(void) {
  Serial.begin(115200);
  pinMode(relay1, OUTPUT);

}

void loop(void) {
  int HighByte, LowByte, TReading, SignBit, Tc_100, WholeDegrees, FractDegrees;
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  //stringOne = String(WholeDegrees);
  //stringTwo = String(".");
  //stringThree = String(FractDegrees);

  if ( !ds.search(addr)) {
    ds.reset_search();
    return;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44, 1);

  delay(250);

  present = ds.reset();
  ds.select(addr);
  ds.write(0xBE);

  for ( i = 0; i < 9; i++) {
    data[i] = ds.read();
  }
  Serial.print("Temperature: ");
  LowByte = data[0];
  HighByte = data[1];
  TReading = (HighByte << 8) + LowByte;
  SignBit = TReading & 0x8000;
  if (SignBit)
  {
    TReading = (TReading ^ 0xffff) + 1;
  }
  Tc_100 = (6 * TReading) + TReading / 4;
  WholeDegrees = Tc_100 / 100;
  FractDegrees = Tc_100 % 100;
  if (SignBit)
  {
    Serial.print("-");
  }
  Serial.print(WholeDegrees);
  Serial.print(".");
  if (FractDegrees < 10)
  {
    Serial.print("0");
  }
  Serial.print(FractDegrees);
  Serial.print(" C\n");
  //int tempthresh;
  //tempthresh = (stringOne&&stringTwo&&stringThree);
  //stringOne += stringTwo;
  //stringOne += stringThree;
  //Serial.println(stringOne); // RETURNS VALUE OF 0.0 When I want Temperature Value to be returned
  //Change The Figure "22" To Adjust The Temperature Threshold To Turn Fan On.
  //Currently Set to Keep Temperature At Or Below 23.25 Degrees
  if ((WholeDegrees > 22)&&(FractDegrees >= 25)) digitalWrite(relay1, HIGH);
  else digitalWrite (relay1, LOW);
  delay(250);

}

For your application, a 1°C resolution is good enough. Even in a near boiling pot you will find temp. differences up to 3°C in the water. There is no one "room temp".

In the Arduino IDE, in the Library Manager, are the OneWire library (by a lot of people including Paul Stoffregen) and the DallasTemperature library (by Miles Burton and others). You need both.
The DallasTemperature makes using the DS18B20 easier. Especially when there is more than one DS18B20 sensor connected. It can get the temperature by index or with the unique ID number that each DS18B20 has.
Start with the examples of the DallasTemperature that appear in the Arduino IDE menu, for example the "simple" example.
Then you have the temperature as a float, and you can compare it with 23.25.
Even the OneWire library comes with the DS18x20_Temperature example that shows how to calculate the temperature as a float.

Thank you I'll have a look at that. I never thought to check the examples in the libraries themselves.

As has been pointed out looking for a temperature to that level of accuracy on a sensor that is only accurate to 1 degrees in an application which only needs accuracies of a few degrees is just adding extra complications for no real world benefit. In this situation just looking at the whole number part is good enough.
But ignoring the final application this is still a programming question which should be answered.
Using strings to compare numerical values is a very very bad idea. Even ignoring the wasted memory and CPU time involved converting things to a string performing a string to string comparison to evaluate the value is often problematic at best. Normally you'd do it by converting the string to a float.
Which brings us to the easiest solution, as Jot indicated, use a float:
float temp = WholeDegrees + FractDegrees/100.0;
if (temp >= 23.25) { ... }

That's by far the clearest and easiest way to perform the calculation but floats are CPU intensive. There are other, faster ways to do it.
You could do everything in 100ths of a degree, this is a better because ints are a lot quicker to work with and take up less memory than floats. But unless you add comments it's not quite as clear as the float version.
int temp = WholeDegrees*100 + FractDegrees;
if (temp >= 2325) { ... }

Or finally you could do something like your original attempt but fixing the logic. This would probably be the fastest and lowest memory of the lot since it only involved 8 bit calculations which on an 8 bit processor is a big benefit. But of the 3 it's also the least obvious what is happening.
if ( (WholeDegrees > 23) || ( (WholeDegrees == 23) && (FractDegrees >= 25)) ) { ... }

This code goes to some lengths to separate the temperature into whole- and fractional-degrees, and to do it in floating point. Unless there is more to the job that isn't shown in this code and requires either of those representations, you can do the whole job with integers, much more simply.
The DS18x20 series return temperatures as fixed-point integers. The "DS1820" that you referred to has only 1/2 degC resolution so testing to 0.25 degrees won't be useful. It delivers the result with 1 fraction-bit (binary point to the left of bit-0). This is equivalent to the number of 1/2-degreesC:
DS1820
+---------------+---------------+---------------+---------------+
|   |   |   |   |   |   |   |   |   |etc|16 | 8 | 4 | 2 | 1 |.5 |
+---------------+---------------+---------------+-----------^---+

                                                 binary point

If you're using the DS18b20 or DS18s20, the result is delivered with 4 fraction bits, binary point to the left of bit-3, or the number of 1/16-degreesC:
DS18x20
+---------------+---------------+---------------+---------------+
|   |   |   |   |   |   |etc|16 | 8 | 4 | 2 | 1 |.5 |.25|   |   |
+---------------+---------------+---------------^---------------+
                                     binary point       .125 .0625

To detect a temperature threshold you only need to compare that single 16 bit number to the equivalent 16-bit representation of the threshold value.
Using your threshold of 22.25 degC, you'd compare to "44" for a DS1820: (2 * 22.25). The remaining fraction, .5, gets truncated off. Or compare to "356" for one of the DS18x20 types: (22.25 * 16).
This function to converts a 4-place fixed point number to an ASCII decimal string for printing:
/*
 * Name:          q12p4toa
 *
 * Function:      Converts a q12p4 binary number to ASCII decimal
 *
 * Description:   Convert a 4 binary-places signed fixed point number (Q12.4) to
 *                an ASCII string as: sdddd.dddd
 *                Up to 3 left zeroes are replaced with spaces; 4 decimal places
 *        are always generated.
 *
 * Parameters:    pbuf            - -> array of at least 10+1 bytes
 *            q12p4         - A fixed-point number to 4 binary places
 *
 * Returns:       pbuf
 *
 */

char *q12p4toa(char *pbuf, int16_t fixp)
{
   // If neg, write the sign and negate the number
   *pbuf++ = ' ';      // don't use this leading space if sending to Blynk
   if( fixp < 0 ){
      *pbuf++ = '-';
      fixp = -fixp;
   }
   // Handle the rest as an unsigned int
   (void)snprintf(pbuf, 9+1, "%d.%04d",
          fixp >> 4, (uint16_t)(10000L/16 * (fixp & 0xF)));
   return(pbuf);
}


text:
Can I use an ESP8266 as a replacement for an original Arduino?
I want to learn Arduino, but I'd like to use the ESP8266 as it has built in wifi. I understand that I can use the Arduino IDE for this board.
However, what about books and resources out there? Are these two boards so similar that I can follow original Arduino examples? I'm primarily thinking in terms of connectivity to, say, sensors.
I'm a beginner at this and will not be able to figure out how to bridge compatibility gaps.

Neither "ESP8266" nor "Arduino" is a board.

Ah, pardon my ignorance - I should have been more specific, although I did mention that I am a beginner. Would you care to enlighten me about the right terms?

Well, no, because there are dozens of boards that use the ESP8266 microcontroller and fall under the Arduino brand. You can't just mix-and-match between them.

So when you select ESP8266 in the Arduino IDE, this only goes for a few specific boards?

No, it works with a wide range of boards that use the ESP8266, but they vary wildly with respect to the number and placement of external connections.

Which "original Arduino" do you have in mind? There are a lot of Arduino types (boards).

Firstly, there are no ESP8266 "boards" that fall under the "Arduino brand" that I'm aware of - secondly, most common ESP8266 have 11 available GPIO's, far less than most common Arduino boards (some as few as 4) - depending on how many and what type of sensors you wish to use at any one time is a major factor in your decision making

@JaromandaX - Sorry but all ESP8266 processors have the same number of GPIO connections.  The boards that use ESP8266 processors have varying numbers of those GPIO connections taken to the edge.

In my comment. Take esp8266 to mean esp8266 board

Yes, No and Maybe is the best answer :)
Assuming that you want to replace a Arduino Uno board with an ESP8266 based board.  Your best choice at the moment would be a Wemos D1.  It has the same form factor as the UNO, but it has less pins, 9 digital and 1 analog.
If you are not bothered about the form factor, you could also try a Node-LUA, or a Wemos D1 Mini.  If you have steady hands you could try just using the heart of these three boards directly, which is usually called an ESP8266-12E, but it has 1mm pitch and no voltage regulation.
There are a lot of sites around that have tutorials on using ESPs.  They are mostly interchangeable with Arduino boards from a software perspective, they have more memory and a faster clock speed.
The biggest difference between an Arduino based board and an ESP board is most Arduino use 5v and most ESP based boards use 3.3v.  Make sure you read the datasheet before you hook up you sensors.
There is an ESP-32 as well.  This is not interchangeable with an Arduino Uno at the moment.

Thanks - I appreciate your answer even though my question was not all that clear. I'll be looking into the boards you've mentioned. Thanks!

Are these two boards so similar that I can follow original Arduino examples?

for most applications, an mcu is useful not because of its core - which is almost fully transparent to a high level language programmer - but because of its peripherals: timers, serial comms, interrupts, adc/dac, ...
sure, there are applications that don't require those functionalities; or those functionalities could be emulated. but you will find it much easier if the mcu does have those functionalities.
so all it takes is to take a look at the datasheet of your esp and ask yourself if you see those peripherals. after that, the answer is clear.


text:
MIDIUSB - Why is the command put twice?
Consider this function:
void noteOn(uint8_t pitch) {
  midiEventPacket_t noteOn = {0x09, 0x90 | 9, pitch, 127};
  MidiUSB.sendMIDI(noteOn);
}

midiEventPacket_t is defined as:
typedef struct
{
    uint8_t header;
    uint8_t byte1;
    uint8_t byte2;
    uint8_t byte3;
}midiEventPacket_t;

The first nibble of the first byte of a MIDI message is the command: 0x90 ["note on"] and the second nibble is the MIDI channel: 9, so what's sent over the wire should be 0x99 meaning "Note On, channel 9", with the two more bytes representing the pitch and the velocity.
My question is, why do all of the examples start with: {0x09, 0x90 | 9,? I'm not understanding the use of the struct here. Intuitively, I thought I would need: {0x90 | 9, pitch, 127, 0}. Why do all of the examples have that seemingly strange syntax?
EDIT
After getting a great explanation below, here's my new function!
void noteOn(uint8_t pitch) {
  midiEventPacket_t noteOnPacket;
  noteOnPacket.header = USB_CABLE_NUMBER | (MIDI_NOTE_ON >> 4);
  noteOnPacket.byte1 = MIDI_NOTE_ON | CHANNEL;
  noteOnPacket.byte2 = pitch;
  noteOnPacket.byte3 = MIDI_BUTTON_ON_VELOCITY;
  MidiUSB.sendMIDI(noteOnPacket);
}

From the specs:

The first byte in each 32-bit USB-MIDI Event Packet is a Packet Header contains a Cable Number (4 bits)
  followed by a Code Index Number (4 bits). [...]
[...]
The Cable Number (CN) is a value ranging from 0x0 to 0xF indicating the number assignment of the
  Embedded MIDI Jack associated with the endpoint that is transferring the data. The Code Index Number
  (CIN) indicates the classification of the bytes in the MIDI_x fields. The following table summarizes these
  classifications.
CIN | MIDI_x Size | Description
[...]
0x9 | 3 | Note-on
[...]

No rationale is given why the CIN is required if the full message is also included, but it could be used for quicker routing of the event to the routine that will process it.

OH, LIGHTBULB moment. midiEventPacket_t represents the USB packet, not the MIDI packet


text:
is there a timeout for Ethernet.begin?
I'm working on a project, but just for testing, I haven't connected it to the internet yet, even though the code SHOULD be ready to roll out.
When trying to test some of my code with the serial console, I realized my program was locking up and I traced it down to here. Now my arduino uno and ethernet shield isn't currently connected to the internet, so my question is, how could I timeout this function so that I can keep my program running when there's no internet to connect it too.
Here's my code in the setup function
if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }

If anyone has any thoughts or suggestions, I'd definitely appreciate it.

The default timeout is 1 minute for DHCP. There is also a response timeout, and in the library millis is used for timeouts. I don't know if there is a timeout for everything, but I suppose there is.
If it stops working when no ethernet cable is connected, that would be a bug. If something like that is in the library, then you have no way to bypass the Ethernet.begin when it took too long. How long did you wait ?
This is the source code for Ethernet.begin: Ethernet.cpp

Thanks, this is good to know. I don't know for certain how long I gave it, I'm guessing the customary 30 seconds so I'll need to give this another run and double my patience, lol

The code can actually hang up in W5100Class::execCmdSn function. It waits for command to complete by reading a register and waiting for read to return 0. If it returns non-zero for some reason (poor contact, etc.), the function will hang up.


text:
Burn smell from arduino uno
I have did something stupid.. I connected 10K Ohm potentiometer at its maximum value PARALLEL with a LED. The positive long leg of the led to arduino 5v and the negative leg to the GND.
After giving arduino 5v from USB Mobile Charger ( Output: 5V , 1A ) I smelt a burn and quickly removed the charger from the outlet.
I waited a few hours and connected the arduino ( without any components ) to the charger again. and the arduino worked. I then connected it to the PC and uploaded the blink sketch of the on-board led and it worked !
Then I uploaded a sktech for blinking led on other pins and it worked also !
My question is:
1) What is damaged on the board ?
The smell is near the regulator but I'm not sure if it's from the regulator itself or just a component near it.
2) Can it be safe to still using the arduino board on USB Power or Battery Power without any problems ?

One can only speculate, especially with regard to the current condition, but it's likely that either F1 was activating or T1 was getting hot.   Excessive current consumption can be a result from past damage, however it is also quite possible that the reset behavior you see with a 9v battery has nothing to do with this incident, and everything to do with the fact that 9v batteries are very weak and a poor choice for powering an Arduino.

I think it probably did not damage any components, and the smell probably came from the plastic that started to burn because of the high current, but for sure if you left a little more, something could have been damaged. To be sure only by testing component one by one.

@ChrisStratton
I didn't understand what F1 and T1 are ?
I don't use batteries for powering my arduino but just wanted to test the external power. You may be right about the 9v battery, but what about the burn smell ?

@AndrewPaes
What plastic part do you mean ? on the board ?
I don't know how can I test component. I don't even have voltmeter and such measuring tools. :(
But the smell is from the regulator or just something near it. I can't determine.

Could it be that the reverse polarity diode failed closed with high resistance?

What is "the reverse polarity diode" ?

That burn is likely the smell of the potentiometer, not the arduino. I would check the arduino with a multimeter set to resistance to make sure that the Vin trace resistance is nominal.

No. the smell isn't from the potentiometer.
the smell was from the LED and the board itself.
I can smell it when I get near to the regulator but not sure if it's from the regulator itself or something near it.

@Youssef13 what voltage are you feeding the arduino?

I used a mobile charger that outputs [ 5V - 1A ] into the USB port ( the same port is used to connect arduino to PC for programming )
If that has nothing to do with the regulator then the smell is just near it.
It's away from the microcontroller the the pins

@Youssef13 do you have a multimeter?

Unfortunately, I don't have one :(

@youssef13 i highly recommend you pick one up when you are able to. For a basic meter, you can get for 20$ https://www.amazon.com/dp/B000EVYGZA/ref=cm_sw_r_cp_apa_1XqBzb4SXP6GD


text:
Feasability question
I have some experience with Arduino, but not (yet) with other AVRs or Raspberry/Orange.
I want to make a project with some slave devices (mostly Arduino Unos, one Arduino Mega). These all need to communicate with a controller.
This controller has about the following requirements: - It need to respond every 5 ms to some messages from the devices, within the next 5 ms. - It needs about 128 KB RAM space, but more would be more comfortable (although 1 GB is enough). - I need quite some 'programming' space (like FLASH) - The program that needs to run on it will be reasonable complex, so using a nice programming language would be convenient (Python/Java/C++) - SD or other nonvolatile storage is mandatory - nRF24LR01+ 2.4 GHz RF Transceiver - Like upto 8 LEDs for status showing - WIFI would be nice - Using an adapter (12V/2A?) would be good, no intention to run it on batteries
I think I can do it with a Teensy or Due, but those are reasonable expensive. Another option is an STM32 kind of AVR.
However, I an noticed Orange Pi Zero, which are very cheap. But I wonder if I get myself in trouble? I know Linux commands, never installed it on a computer though. Someone made a remark in another related question to go for a stronger AVR, but afaik an Orange should be suited very well for this (seeing the limited electronics involved).
Or would it be better to go for a Teensy or STM32?

first off, the due only has 96k RAM, you're not going to get much further on integrated chips.

Initially my plan was to add a 128KB 23LC1024 SRAM IC, but it makes programming much less convenient (since I cannot store directly/use variables/lists/arrays).

A Pi gives you lots of CPU power but I'm not sure how good it would to on the tight timing requirements.
It doesn't have everything you ask for but something like the NUCLEO-F746ZG may be an option. That gives you a 200+ MHz Arm M7 with floating point, 2 MB of flash and 512 kB of RAM. It has USB and Ethernet built in and has arduino compatible headers for connecting shields to give you things like an SD socket or a radio link.Plus you get 8 UARTs, (no more software serial :-)) and 6 SPI busses (obviously not all on the arduino headers)
You can program it either natively or in c++ using the mBed framework & online compiler.
It is around $20. There are cheaper variants with less processing power / memory available for a little less.

A RPi will be fine if you work on the bare metal. Note that you won't get any help with any peripherals so don't walk in expecting to whip something up on a e.g. RPi Zero W in a few hours.

@IgnacioVazquez-Abrams True, I was assuming the Pi would be running linux and possibly programmed in python. The CPU is more than capable enough, it's accessing that power without adding latency that gets tricky.

Can you give me a link where you can get it for $20 ... I mostly get my items from Aliexpress and there is is about $35-$40 ... in the Netherlands it's not for sale, only the discovery box for 50 euro (excl. shipping).

I checked for a NUCLEO-F446RE or NUCLEO-F411RE ... these are also quite acceptable for my needs.

http://nl.farnell.com have it for 22.5 euro.

@Andrew: Thank you very much ... strange I didn't found it before. I first buy the cheapest one from China go get a feel for Nucleo's (never tried one nor an STM32), and than the one you proposed sounds like the way to go!

Personally I use the mbed library and build system rather than the STM32 one. Mainly because it makes it easy to switch between lots of different Arm based systems depending on what I need at the time. Unfortunately it's not the best documented thing out there and while there is a support community it's no where near as active as the arduino one.

@Andrew: I now realize that the F746ZG is indeed one of the best options ... 128 KB is too small (since I also need space for the program stack/heap), and have 512 KB is than more than enough for future updates. ... I would have to check mbed library ... I heard of it but that's it. I will check into it, thanks (and hopefully I don't run into too many problems, being still an Arduino starter).


text:
Simulate 9-pin joystick output

I have built this little setup, which is supposed to record and replay input from a classic 9-pin Joystick. I connected the 9 pin connectors to the Arduino, read the input on the left side from the Joystick, and then passed it to the right side by setting the corresponding pins to HIGH.
It does work, and I can play games on the Commodore 64, however, I noticed that with this setup current is passed to the Commodore 64, which is very likely harming the machine a lot (I stopped immediately after noticing).
So my question is: how do I need to modify this setup so that no current is going from the Arduino to the Commodore 64 anymore?
Picture of the setup:

I would isolate the two devices using opto-isolators.

simulate this circuit – Schematic created using CircuitLab
Turning the output ON will illuminate the infra-red LED in the opto-isolator which turns on the photo-transistor connecting the input to GND. Both devices are then completely galvanically isolated (unless of course you take power from the C64 for the Arduino).
Another option, if you don't care about galvanic isolation, is to just use a simple transistor (small signal NPN or logic level N-channel MOSFET) to make an Open Drain output:

simulate this circuit
Again, set the output HIGH and the transistor will turn on connecting the C64 input to ground.

Thank you (again, I guess, as you pop up with solutions for every single question I ask ;) ) Majenko. I will look into both options, that was very helpful.

@Majenko can it be transistor 2N2222?

@MichałStępień Yes, that is an ideal and common transistor.

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


text:
How do i power recycle on SD card
I am working on my home made project where i am using SD card to log GPS data into it,As well as i have to access that data from the SD card on my computer while all the system is connected to battery power, so i also have a USB to SD chip USB2240 from Microchip, this SD controller suits best to my application, Because USB2240 has a card detect pin connected to one of the pin of Arduino, from which i can control interface of SD card between Arduino for logging and the computer for the USB..
But I have to Recycle power to the SD card whenever SD Card is interfaced with the USB controller USB2240.
So for an Example : when the device is powered 'ON' , The SD card is interfaced with the Arduino - which logs data to the card, But when i connected the system to my computer to get the logged file on my computer, Then it's not working, Here i have to disconnect power to SD card and Reconnect it...
How do i achieve Power recycle all on it's own when i connected to the USB OR to the Arduino.
Thanks

I just read the
USB2240 Part listing
and it looks really handy for interfacing a PC to the flash.
However, I believe you are taking the wrong approach by trying to power recycle it yourself.
To address your question about how to power recycle it:  If you are physically moving the connection cable then that should power recycle it automatically.
If not, then you have some other problem with your software not tolerating the disappearance then reappearance of the SD card.  In other works, it is likely a software problem.  The SD card should always remain connected so the software does not get confused and require a reset.
It is like how you need to eject USB devices in Linux.  If you don't, then you can get file corruption because the buffers may not be fully flushed.  Back in the day we used sync; sync; sync to ensure buffers were written out to storage devices, even just to do a normal shutdown.  Fortunately, modern Linux takes care of that, with the exception of USB flash memory.  With that you need to actually go through the eject process to avoid damage or system confusion.
But a much better approach would be to just leave it on one or the other.
Then use some sort of communications (it doesn't have to be USB) between the two computers for memory access.


text:
Powering on the PC
I located the two pins that are responsible for powering up the PC. They are connected to the Power On button and one pin has an output of 5 V while the other is the ground.
So far so good, the problem is when I connect the 5 V one to the Arduino VIN and a ground cable from the PC power source to the Arduino GND, instead of powering my board, the PC starts and then promptly stops, as if I pressed the power button and did not release it.
It seems that electricity passes through the Arduino without powering it. I tested the VIN and GND pins with a normal breadboard power source and they are not broken, as the board starts up with no problem.
Why is the computer starting up instead of powering the Arduino? How can I use my Arduino to start up the PC?
My plan was to power the Arduino with the 5 V pin and send a digitalWrite(somePin, HIGH) for a short amount of time to the ground pin from the PC that would normally be connected to the power button, thus "closing" the circuit like the normal case button would.

Please edit your post (click "edit") and add context and a question.  You have listed some things you have done but have not said what you want to do or what your question is.

Also asked at http://forum.arduino.cc/index.php?topic=489895

I located the two pins that are responsible for powering up the PC - where did you locate them?

and send a digitalWrite(somePin, HIGH) for a short amount of time to the ground pin - you want to send 5V to ground? Why?

@NickGammon by checking the wire that goes from the ON button to the motherboard.

I think this is actually a valid question - while it takes some knowledge of the PC power supply to understand it, editing that into the question for clarity to unfamiliar readers would come pretty close to putting the answer into the question.  One could, however argue that it is off-topic as it is about the PC power supply, not really about Arduino.

The two pins aren't +5V power and ground.
One of them will be what you think, the other will be a signal wire with a pull up/down.
So if the ground wire really is ground then the other wire is the button input and is pulled up with a resistor, probably in the 10k region.
You can't power an arduino with a ~10k resistor in series with the power, it's just not going to work. But it will pull enough current to make it look like the button is pressed all the time.
What you need to do is:
1) Find out which pin is the signal pin. The easiest way to do this is find some other ground point on the computer (e.g. from one of the HDD power connectors) and measure the voltage from that to the button wires when the button is pressed. If both wires go to 0V then it's the wire that's normally +5 that is the signal, if they go to +5 then it's the wire normally at 0V that's the signal.
2) Fine a real power source. Most PC power supplies have an always on supply that will be at 5V when the PC is off. Use that to power the arduino.
3) Now you know which wire is the signal wire and have a usable power source you can connect the signal wire to one of the arduino pins and drive it to the correct state. Ideally you'd do this via an open collector type interface so that you don't get two different things pulling to very slightly different idle levels.

The signal you found is called PS_ON and it is an active_low input which should be momentarily grounded by a switch to toggle the PC power supply's on/off state.
Trying to use this instead as a power source for the Arduino loads it, causing it to drop, the Arduino to brown out and release it, and then the process repeats.
As @Andrew mentioned, you need to find the 5v standby power supply output, and use that as the Arduino's power source instead.  This is called VSB.  Since it is already regulated to 5V, you can't pass it through the Arduino's Vin as it will not meet the regulator's dropout voltage needs.  Instead you should route it in as an external 5v source, much as done with the USB power input.
To activate the signal, you'll then want to use a digitalWrite() to briefly set the output low (not high).
However, when you are not driving it low, rather than driving it high (to a voltage potentially higher than the power supply pulls it up to), what you should do is simulate an open collector output by changing the pin mode to an input, without pullup.

I suspect that you plan won't work.  The Arduino's digital pins only support 20-40mA.  I think you would be better using the Arduino to control a transistor or relay and interfacing that with the switch.


text:
Arduino UNO only works with Monitor Serial opened
My Arduino Uno will not work without the Serial Monitor opened. I have a PHP script to send data to the board. When I send the data, the TX and L LEDs light up, but the action is not executed. It is only executed when the Serial Monitor is opened. Can you please help me?
Code in Arduino:
int const RED = 2;

int status = 0, temp =0;

void setup() {
  pinMode(RED, OUTPUT);
  Serial.begin(9600);
}

void loop() {

  if(Serial.available() > 0) {
    temp = Serial.read();
    if(temp != -1)
      status = temp - '0';

    Serial.print("status: ");
    Serial.println(status);

    if(status == 1)
      digitalWrite(RED, HIGH);
    else
      digitalWrite(RED, LOW);

    delay(1000);
  }

}

PHP script:
<!DOCTYPE html>
<html>
    <head>
        <title>Alarme</title>
    </head>
    <body>
        <form action="#" method="post">
            <input type="submit" name="alarme" value="ON">
        </form>

        <form action="#" method="post">
            <input type="submit" name="alarme" value="OFF">
        </form>
    </body>
</html>

<?php

$port = fopen("/dev/ttyUSB0", "w");
fwrite($port, ($_POST['alarme'] == 'ON') ? 1 : 0);
fclose($port);

My circuit is simple, it only consists of one LED and a 220 ohm resistor.

Hello and welcome to Arduino SE! I'm going to close this question because it lacks a clear example of the problem (code and any applicable circuit) that we need to help you fix your issue. Once you have a clear, minimal example of the problem's code and wiring, feel free to edit your question and it may be reopened. Thanks!

@AnonymousPenguin I added details

On many (most ?) systems, you can't open the port and immediately write to it, as that will result in a time consuming auto-reset.  You need to hold the port open and configured in general, and write when you need something.

I fixed, see my answer

The problem was the auto-reset of the Arduino, I disabled it.
To disable, I connected a 10uf capacitor on the GND and RES. As in the image below:

Interesting!  I have a few sketches I remember have failed until I open the Serial Monitor.  I had a heck of a time with one writing between a rpi and a bluno nano, so Ill go check that out later.  But more recently, I have a sketch that writes data from the bluno nano to an iOS app and sometimes Ill plug in the bluno nano to a usb battery and open up the iOS app BlunoTerminal and Ill get (null) (null) (null)...I plug the bluno nano into the laptop and check BlunoTerminal and still (null) (null) (null)...but I open up the Serial Monitor and voila, values start pouring in!

Signed in to thank you very much. After tons of frustration this made my day! Had the same problem as described, and diagnosing it was incredibly hard.


text:
Creating a file in an SD card
I have an Arduino Mega connected to an SD card reader (Catalex branded), that at least detects the card as it displays the info of the card. But when I try to create a file, it does not create it. I am using the following code:
if (SD.exists("data.txt")) {
  Serial.println("data.txt exists.");
} else {
  Serial.println("data.txt doesn't exist.");
}
File root=SD.open("data.txt", FILE_WRITE); //open of the File for writting
if (SD.exists("data.txt")) {
  Serial.println("data.txt exists.");
} else {
  Serial.println("data.txt doesn't exist.");
}

I also tried with this code:
File root2 = SD.open("file.txt", O_RDWR | O_APPEND);
    if (!root2) {
       // It failed, so try and make a new file.
        root2 = SD.open("file.txt", O_RDWR | O_CREAT);
        if (!root2) {
          // It failed too, so give up.
        Serial.println("Failed to open file.txt");
         }
    }

[Update]
I also tried with this easier code and it does not work either:
#include <SD.h>

const int chipSelect = 10;
Sd2Card card;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  Serial.print("Initializing SD card...");
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}

void loop() {
  File myFile = SD.open("Data.txt", FILE_WRITE);
  if (myFile) {
    for (int i = 0; i < 101; i++) {
      myFile.print(i);
      myFile.print(" multiplied by two is ");
      myFile.println(i * 2, DEC);
    }
    Serial.println("Finished");
    myFile.close();
  } else {
    Serial.println("Error opening Data.txt");
  }
  //do nothing else
  do { } while(1);
}

I don't think it should matter, but can you try to close the file after opening and before the exists call?

@MichelKeijzers Yes i tried it and it neither work

You can try to format the card in a different format (I don't know which formats are supported by the library), also you can check if the file really is created (on a PC) or that the exists fails.

@MichelKeijzers i do not why i open a new code file and copy the code and it worked. thanks for the help

Glad you can continue now

// open a new file and immediately close it:

Serial.println("Creating example.txt...");
myFile = SD.open("example.txt", FILE_WRITE);
myFile.close();

This is what you missed (I guess..).
Please see the link and check the steps followed:
https://www.arduino.cc/en/Tutorial/Files

If you want to make it sure it will not have problem with SD card format then format it to FAT it's most compatible format type.


text:
Delay only some function
I have code which control thermometer, OLED and nanoservo via MQTT. I want to refresh temperature every 10s. It works but my servo receive command only when temperature is refreshed. How can I configure my loop so my servo can receive MQTT command anytime I send it?
Here in my code (I combined several example codes...):
    #include <ESP8266WiFi.h>
    #include <Servo.h>
    #include <PubSubClient.h>

    #include <OneWire.h>
    #include <DallasTemperature.h>

    #include <Wire.h>
    #include "SH1106.h"
    #include "thermometer.h"

    // Data wire is plugged into pin 2 on the Arduino
    #define ONE_WIRE_BUS 14 // je D5 was 2 (D4)

    // Setup a oneWire instance to communicate with any OneWire devices
    // (not just Maxim/Dallas temperature ICs)
    OneWire oneWire(ONE_WIRE_BUS);

    // Pass our oneWire reference to Dallas Temperature.
    DallasTemperature sensors(&oneWire);

    SH1106 display(0x3c, D1, D2);
    #define DEMO_DURATION 3000
    typedef void (*Demo)(void);

    int demoMode = 0;
    int counter = 1;

    // Update these with values suitable for your network.

    const char* ssid = "******";
    const char* password = "******";
    const char* mqtt_server = "192.168.100.220";     /// MQTT  Broker
    const char* topic_state = "/blinds/state";
    const char* topic_command = "/blinds/command";

    IPAddress my_ip (192, 168, 100, 224);
    IPAddress my_gateway (192,168, 100, 1);
    IPAddress my_subnet (255, 255, 255, 0);

    WiFiClient espClient;
    PubSubClient client(espClient);
    long lastMsg = 0;
    char msg[50];
    int value = 0;

    Servo myservo;
    int state = 0;
    int prevstate = 0;
    int dirc = 0;
    int spintime = 0;
    int servoPin = D4; //CHANGE TO WHATEVETR PIN YOUR USING

    void reconnect();
    void callback(char* topic, byte* payload, unsigned int length);

    void setup() {
      Serial.begin(115200);
      setup_wifi();
      client.setServer(mqtt_server, 1883);
      client.setCallback(callback);

    // Start up the library
      sensors.begin();

    // Initialising the UI will init the display too.
      display.init();
      display.flipScreenVertically();
      display.setFont(ArialMT_Plain_10);

    }

    void servo_move() {
      Serial.println("State Change. Rotating Servo");
      if ( dirc == 180) {
        client.publish(topic_state,"open");
      }
      else if (dirc == 0) {
        client.publish(topic_state,"close");
    }
      myservo.attach(servoPin);
      myservo.write(dirc);
      delay(spintime);
      myservo.detach();

      Serial.println("Returning to main loop");
      return;
    }

    void setup_wifi() {

      delay(10);
      // We start by connecting to a WiFi network
      Serial.println();
      Serial.print("Connecting to ");
      Serial.println(ssid);

      WiFi.setPhyMode(WIFI_PHY_MODE_11N);
      WiFi.config(my_ip, my_gateway, my_subnet);
      WiFi.mode(WIFI_STA);
      WiFi.begin(ssid, password);

      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
      }

      Serial.println("");
      Serial.println("WiFi connected");
      Serial.println("IP address: ");
      Serial.println(WiFi.localIP());
    }

    void callback(char* topic, byte* payload, unsigned int length) {
      Serial.print("Message arrived [");
      Serial.print(topic);
      Serial.print("] ");
      for (int i = 0; i < length; i++) {
        Serial.print((char)payload[i]);
      }
      Serial.println();
      char *blindcommand = (char *) payload; // convert mqtt byte array into char array
      blindcommand[length] ='\0';            // Must delimit with 0

      Serial.print(blindcommand);
      if (strcmp(blindcommand,"open") == 0) {
        Serial.println(" 433MHZ OPEN COMMAND RECEIVED");
        dirc = 180; // direction for servo to run
        spintime = 50; // << CHANGE TO WHATEVER TIME YOU NEED TO OPEN YOUR BLINDS
        state = 1; //sets current state
      }
      else if (strcmp(blindcommand,"close") == 0) {
        Serial.println(" 433MHZ CLOSE COMMAND RECEIVED");
        dirc = 0;
        spintime = 150; // << CHANGE TO WHATEVER TIME YOU NEED TO CLOSE YOUR BLINDS
        state = 2; //sets current state
      }
      if (state != prevstate) {
        Serial.println("State change!");
        servo_move();
      }
      prevstate = state;

    }
    char temperatureVonku[15];
    String tempUnit = " °C";

    void temperature(){
      float temperatureFloat;
      sensors.requestTemperatures();
      temperatureFloat = sensors.getTempCByIndex(0);

      dtostrf(temperatureFloat, 7, 1, temperatureVonku);

       client.publish("temp/outside", temperatureVonku);    /// send char
       delay(10000);
    }

    void dispTempVonku() {
        display.drawRect(1, 1, DISPLAY_WIDTH -1, DISPLAY_HEIGHT -1);
        // Font Demo1
        // create more fonts at http://oleddisplay.squix.ch/
        display.setTextAlignment(TEXT_ALIGN_LEFT);
        display.setFont(Roboto_Bold_12);
        display.drawString(5, 5, "Temp: ");

        display.drawXbm(7, 24, Img_width, Img_height, thermometer);
        display.setTextAlignment(TEXT_ALIGN_CENTER);
        display.setFont(Roboto_Bold_28);
        display.drawString(64, 22, temperatureVonku + tempUnit);
    }
    void dispTempVnutri() {
        display.drawRect(1, 1, DISPLAY_WIDTH -1, DISPLAY_HEIGHT -1);
        display.setTextAlignment(TEXT_ALIGN_CENTER);
        display.setFont(ArialMT_Plain_16);
        display.drawString(64, 22, "Hello World");
    }

    Demo demos[] = {dispTempVonku, dispTempVnutri};
    int demoLength = (sizeof(demos) / sizeof(Demo));
    long timeSinceLastModeSwitch = 0;

    void reconnect() {
      // Loop until we're reconnected
      while (!client.connected()) {
        Serial.print("Attempting MQTT connection...");
        // Attempt to connect
        if (client.connect("ESP8266Client", "******", "******")) {

          Serial.println("connected");
          client.subscribe(topic_command);
        } else {
          Serial.print("failed, rc=");
          Serial.print(client.state());
          Serial.println(" try again in 5 seconds");
          // Wait 5 seconds before retrying
          delay(5000);
        }
      }
    }
    void loop() {

     temperature();

      if (!client.connected()) {
        reconnect();

      }
      client.loop();
      // clear the display
      display.clear();
      // draw the current demo method
      demos[demoMode]();

      display.setTextAlignment(TEXT_ALIGN_RIGHT);
      display.drawString(10, 128, String(millis()));
      // write the buffer to the display
      display.display();

      if (millis() - timeSinceLastModeSwitch > DEMO_DURATION) {
        demoMode = (demoMode + 1)  % demoLength;
        timeSinceLastModeSwitch = millis();
      }
      counter++;

     //delay(10000);

    }

Thank you.

please follow the below links, might be useful: https://stackoverflow.com/questions/5452394/best-way-to-perform-an-action-periodically-while-an-app-is-running-handler https://stackoverflow.com/questions/14397973/how-to-read-continuous-data-and-display-it

MQTT does not guarantee delivery times. Delays between publishing and receiving can reach 2-3 seconds in a local configuration. If you are using an Internet broker, it's worse.

I assume your servo only receives data when you keep the delay(10000).
The problem is that with a delay, the Arduino does kind of nothing during that time, so it cannot control your servo.
What you want is to call every 10 s the temperature update, but keep the servo control always running.
So keep a last-time-called variable (type unsigned long) that keeps the time of the last call to update the temperature. When 10 s have passed (you can check somewhere in the loop), you call it, and update the last time to the current time.


text:
Start I2C communication at an external event
I'm working on a Arduino Uno and a ADC ADS1115. Devices communicate by I2C where Arduino is the master.
I would like to use the ADC to the maximum of his possibility.
So i configure the ADC to set a pin when a conversion finish and use this pin as an external interrupt.
But i can't read the data because I2C interrupt can't work in a external interrupt handler.
I think to use a timer to have a fixed sampling rate too, but it's the same issue.
There is my code below, and if you have any idea of how i can doing my goal let's share it ;)
#include <QueueArray.h>
#include <ADS1115_Vibratec.h>

  Adafruit_ADS1115 ads;

  QueueArray <uint16_t> fifo;

  int i=0;

void setup() {

 Wire.begin();

 Serial.begin(115200);

 ads.Config( ADS1115_REG_CONFIG_OS_NOEFFECT,
          ADS1115_REG_CONFIG_MUX_DIFF_0_1,
          ADS1115_REG_CONFIG_PGA_6_144V,
          ADS1115_REG_CONFIG_MODE_CONTIN,
          ADS1115_REG_CONFIG_DR_860SPS,
          ADS1115_REG_CONFIG_CMODE_TRAD,
          ADS1115_REG_CONFIG_CPOL_ACTVLOW,
          ADS1115_REG_CONFIG_CLAT_NONLAT,
          ADS1115_REG_CONFIG_CQUE_1CONV);

 ads.Set_ConvReady_function();

 attachInterrupt(0,interrupt,RISING); //INT0 -> pin 2, fonction interrupt,    front montant

  }

  void loop() {

   while (!fifo.isEmpty ())
   {
      Serial.write(fifo.dequeue());
      Serial.println();

   }

  }
  void interrupt()
  {
    fifo.enqueue(ads.ReadConvert());
  }

You could set a 'volatile' flag in the interrupt routine. In the loop() you can check if the flag is set. That is how the i2dev uses the interrupt for the MPU-6050. See the MPU6050_DMP6.ino example.
First thing to do is set the I2C clock to 400 kHz. Keep the wires short and pullup resistors low.
Wire.begin();
Wire.setClock(400000L);   // 400 kHz I2C clock speed

You can let the MultiSpeed I2C Scanner run for a while to see if it is stable.
The ADS1115 has also I2C High-Speed Mode up to 3.4MHz. The Arduino can not do that. The Arduino has a fast SPI mode, but the ADS1115 has no SPI bus.
Using an interrupt adds extra overhead. A fixed software timer with millis might be just as fast.
Do you want the maximum of 860 Samples per second? The Arduino Uno or Mega or Leonardo are too slow for that. Do you want to continuously read data or just a burst and store it in ram ?

Thanks for your help. I would like to continuously read data. Are you sure that Arduino is too slow for 860 sps?

The Arduino Uno is too slow. It probably can not handle all that data with the normal Arduino functions. The Arduino Leonardo or Micro is a little better, because they can transmit data via the USB at higher rates. I think you need a Due or Zero or M0. Use the Arduino Uno to run tests and develop code, you will found out soon enough what datarate it can do.


text:
Arduino as Slave | SPI | Answers too late
I hope you can help me :)
I am communicating between Raspberry Pi 3 and Arduino Uno with SPI. I am using the Arduino as slave and it works pretty fine. The only problem that i have, is the following:
For receiving data from the Arduino, my Raspi sends a byte. But i always have to send 2 bytes for the correct response. Is it even possible for the Arduino to response on the first byte?
Sorry for my english

Can you please post the full code you're using?

Because of the way SPI works, the slave cannot respond to the first byte in a meaningful way. It can send something (eg. 0x00) but not a response.
See my page about SPI. During an SPI transfer each bit is sent, and a bit received, simultaneously, as in this graphic:

You can see that as the first bit is received by the slave, it also has to send a response. There is no way that this response can react to the 8 bits, 7 of which haven't been received yet, by the time it has to send the first bit of response.

But i always have to send 2 bytes for the correct response.

You don't have to send 2 bytes all the time. For example, you can send one byte (eg. "send me the temperature") and then send zeroes after that, while you read back a (say) 4-byte temperature. So in this case you send 5 bytes to get a 4-byte response.

The only way you can respond on the first byte is if the Arduino already knows, and is primed, what to send on that byte before it begins to be clocked into the Arduino.
It is normal to have to send at least 2 bytes - the first is often used as either a register address, or a "read register" command.

Is it even possible for the Arduino to response on the first byte?

Yeah. There is nothing preventing your slave to respind on the first byte, so long as your code allows it.


text:
Weird issue with software serial?
Hi i am trying to write a library to communicate between the arduino and the esp 8266. I wrote a command that that sends an AT command to the esp chip. So far I have tested these commands : AT, AT+GMR, AT+CIFSR, AT+CIPMUX=1 etc. with no issue the communication seem robust.
When I tried to send the AT+CIPSERVER=1 command the function did not work. After some attempts to debug the program I manage to get it working but I do not understand why. And this is my issue, I though it was working because of the extra delay that was occurring in my code but after some testing that was not the reason.
Could anyone please explain to me what is happening ? I will continue to work on the code until I figure it out.
The code :
Header file
#ifndef _ESPLIB_h
#define _ESPLIB_h

#if defined(ARDUINO) && ARDUINO >= 100
    #include "Arduino.h"
#else
    #include "WProgram.h"
#endif

#include <SoftwareSerial.h>

// Definitions
#define DEBUG       1
#define BUFFSIZE    64
#define TCPORT      23050
#define ESPTIMEOUT  10000
enum espResponse {
    ok,
    error,
    other
};

// AT Commands
#define CRLF    "\r\n"
#define Q       "=?"
#define AT      "AT"
#define GMR     "+GMR"
#define RST     "+RST"
#define CMUX    "+CIPMUX=1"
#define CWMOD   "+CWMODE"
#define CSERV   "+CIPSERVER=1"
#define CFSR    "+CIFSR"
#define CSEND   "+CIPSEND"

class espdevice
{
    public:
        // Functions
        espdevice(int rx, int tx, int baud);
        void serialEnable(void);
        //boolean tcpServerInit(void);

        #if DEBUG
            void serialDebug(void);
        #endif

    private:

        // Variables
        // Serial Setup parameters
        int _rx;
        int _tx;
        int _baud;

        // Software Serial
        int _espSerialIndex = 0;
        char _espSerialBuffer[BUFFSIZE];
        SoftwareSerial *_espSerial;

        // private functions
        //espResponse _sendEspCommand(const char* cmd);
        boolean _sendEspCommand(const char* cmd);
        espResponse _espCommandOK(void);
        boolean _espSerialAvailable(void);

        // Debug mode
        #if DEBUG

        // variables
        int _serialIndex = 0;
        char _serialBuffer[BUFFSIZE];

        // functions
        void _serialDebug(int select);
        int _arduinofreeRam(void);
        boolean _serialAvailable(void);

        #endif

};

#endif

What I am executing
        _sendEspCommand("AT+CIPMUX=1\r\n");
        _sendEspCommand("AT+CIPSERVER=1,23050\r\n");
        _sendEspCommand("AT+CIFSR\r\n");

Now the function definition
boolean espdevice::_sendEspCommand(const char* cmd)
{
    // variables
    int count = 0;
    boolean flag = false;
    espResponse status = other;

    // sending the command to the ESP
    _espSerial->write(cmd);
    #if DEBUG
        Serial.print("command echo : ");
        Serial.write(cmd);
        Serial.println();
    #endif

    //while (!(status==ok||status==error) || count < 1000) **<- why this thing works  ??????????????**
    //while (status == other && count < ESPTIMEOUT) <- does not work
    while ((status == other) || (count < ESPTIMEOUT)) <- THIS works too
    //while(count < ESPTIMEOUT) <- does not work
    {
        //while (!_espSerial->available()) {};
        if (_espSerialAvailable())
        {
            Serial.println ("Data Are available");
            status = _espCommandOK();
            #if DEBUG
                Serial.print("Data Received from ESP : ");
                Serial.print(_espSerialBuffer);
                Serial.println("");
                Serial.println(status);
            #endif
            /* //code used with the not working part
            if (status == ok)
            {
                flag = true;
                break;
            }
            else if (status == error)
            {
                flag = false;
                break;
            }
            else
            {
            }
            */
        }
        count++;
    }
    Serial.println(count);
    return flag;
}

And the two other functions that are called
_espSerialAvailable()
boolean espdevice::_espSerialAvailable(void)
{
    boolean stringFound = false;
    // Read the serial buffer if data are available
    while (_espSerial->available() > 0)
    {
        char charBuffer = _espSerial->read();

        if (charBuffer == '\n')
        {
            _espSerialBuffer[_espSerialIndex] = 0; // terminate the string
            stringFound = (_espSerialIndex > 0); // only good if we sent more than an empty line
            _espSerialIndex = 0; // reset for next line of data
        }
        else if (charBuffer == '\r')
        {
            // ignoring carriage retun
        }
        else if (_espSerialIndex < BUFFSIZE && stringFound == false)
        {
            _espSerialBuffer[_espSerialIndex++] = charBuffer; // auto increment index
        }
    }

    return stringFound;

}

_espCommandOK()
espResponse espdevice::_espCommandOK(void)
{
    if (strcmp(_espSerialBuffer, "OK") == 0)
    {
        return ok;
    }
    else if (strcmp(_espSerialBuffer, "ERROR") == 0)
    {
        return error;
    }
    else
    {
        return other;
    }
}

The output from the serial ports for each case
working
creating an new tcp server
command echo : AT+CIPMUX=1

Data Are available
Data Received from ESP : AT+CIPMUX=1
2
Data Are available
Data Received from ESP : OK
0
10000
command echo : AT+CIPSERVER=1,23050

Data Are available
Data Received from ESP : AT+CIPSERVER=1,23050
2
Data Are available
Data Received from ESP : no change
2
Data Are available
Data Received from ESP : OK
0
10000
command echo : AT+CIFSR

Data Are available
Data Received from ESP : AT+CIFSR
2
Data Are available
Data Received from ESP : +CIFSR:STAIP,"192.168.1.16"
2
Data Are available
Data Received from ESP : +CIFSR:STAMAC,"5c:cf:7f:fd:ce:14"
2
Data Are available
Data Received from ESP : OK
0
10000

not working
creating an new tcp server
command echo : AT+CIPMUX=1

Data Are available
Data Received from ESP : AT+CIPMUX=1
2
Data Are available
Data Received from ESP : OK
0
98
command echo : AT+CIPSERVER=1,23050

10000
command echo : AT+CIFSR

Data Are available
Data Received from ESP : AT+CIFSR
2
Data Are available
Data Received from ESP : +CIFSR:STAIP,"192.168.1.16"
2
Data Are available
Data Received from ESP : +CIFSR:STAMAC,"5c:cf:7f:fd:ce:14"
2
Data Are available
Data Received from ESP : OK
0
224

I will leave this here in case anyone is interested. So i am communicating with the esp module at 9600 baud rate. After I send a command to the ESP I was waiting for its response before sending the next command without any delay.
What I found out is that for some reason although I was sending the command to the ESP the esp was not executing the command. So i added a delay(100) to see if the RX of the ESP was disabled during that time and i think i was correct since the commands were executed correctly.
I manage to get the delay down to delay(5). it Breaks after that.
I am using an Arduino micro and an ESP-01.

Accept your own answer to close this question. Nobody has a better one.

This may not be the answer you need if you are using it for something else, but if you are using a Micro, I would use the hardware serial Serial1 instead of SoftwareSerial. I've done many projects using a Leonardo (same processor) with ESP8266 as it gives me an extra hardware serial port which isn't connected to the Serial Monitor serial port.
I haven't tried the SoftwareSerial library for a few years, but I remember at the time that it doesn't handle duplex or high baud rates well.
What baud rate are you using? I couldn't see any begin in the code.
EDIT: You might also want to add the 'ATE0' command to turn off command echo.  The serial receiver is probably getting swamped with data.


text:
Arduino Uno wont power up when GND is plugged in Logic Converter
Good day.
I am trying to use an ESP8266 12e Wifi Module that requires 3.3V
I used a Logic Converter to reduce the 5v to 3.3v
My problem is when I plug the GND from the arduino to the GND on the Logic Converter, the Power On Led dies slowly on the arduino and no power at all.
When I plug the 5v only the power is back.

I have tried both the USB power from the laptop and a 9V 250mA power adapter but still the same result.
Any advice would really save me.

Is that soldering really as terrible as it looks?

yes. I really have no knowledge in soldering but i did my best to bind them :(

It looks like one huge blob of so solder shortcircuiting everything out.

I think you'll need an external power supply to make both of them works. ESPs need more current than arduinos.

I think you need to practice your soldering a little more. It's hard to make out, but I would say all that solder is just one huge short circuit linking the power and ground pins and risking melting your Arduino.

thank you for the enlightenment everyone. I recall that my arduino ticked and smoked a little when i plugged it using an external power source and immediately I unplugged it. It seems like my messy soldering is the culprit. I have planned to use an ESP8266 ESP-01 + adapter so i wont need to do some horrible soldering again...


text:
Updating Array Values Incrementally Overwrites The Existing Values, Why?
I have a global array. I'd like to update the array while the program running.
But, I've found that my program below doesn't work as I expected.
Please checkout the program source:
#define RespLength 10
char* response[] = {"0","0","0","0","0","0","0","0","0","0"};
int idxUpd  = 0;

void setup() {
    // put your setup code here, to run once:
    Serial.begin(115200);
    Serial.println("Start");
}

void loop() {
  // put your main code here, to run repeatedly:
    char assign[5];
    int wkt = random(10, 99);
    dtostrf(wkt, 4, 1, assign);

    response[idxUpd]  = assign;

    Serial.print("Iteration "+String(idxUpd)+" : ");
    for (int i=0;i<RespLength;i++){
        Serial.print(response[i]);Serial.print(",");
    }
    Serial.println();
    delay(500);

    idxUpd++;
    idxUpd = idxUpd >= 10 ? 0 : idxUpd;
}

Expected output: please concern to the patern
Iteration 0 : 12.2,0,0,0,0,0,0,0,0,0,
Iteration 1 : 12.2,23.7,0,0,0,0,0,0,0,0,
Iteration 2 : 12.2,23.7,65.3,0,0,0,0,0,0,0,
Iteration 3 : 12.2,23.7,65.3,0,0,0,0,0,0,0,
Iteration 4 : 12.2,23.7,65.3,15.9,0,0,0,0,0,0,
Iteration 5 : 12.2,23.7,65.3,15.9,10.1,0,0,0,0,0,
Iteration 6 : 12.2,23.7,65.3,15.9,10.1,11.6,0,0,0,0,
Iteration 7 : 12.2,23.7,65.3,15.9,10.1,11.6,78.9,0,0,0,
Iteration 8 : 12.2,23.7,65.3,15.9,10.1,11.6,78.9,98.2,0,0,
Iteration 9 : 12.2,23.7,65.3,15.9,10.1,11.6,78.9,98.2,68.6,90.1,

Current output:
Iteration 0 : 85.0,0,0,0,0,0,0,0,0,0,
Iteration 1 : 28.0,28.0,0,0,0,0,0,0,0,0,
Iteration 2 : 36.0,36.0,36.0,0,0,0,0,0,0,0,
Iteration 3 : 70.0,70.0,70.0,70.0,0,0,0,0,0,0,
Iteration 4 : 56.0,56.0,56.0,56.0,56.0,0,0,0,0,0,
Iteration 5 : 74.0,74.0,74.0,74.0,74.0,74.0,0,0,0,0,
Iteration 6 : 94.0,94.0,94.0,94.0,94.0,94.0,94.0,0,0,0,
Iteration 7 : 94.0,94.0,94.0,94.0,94.0,94.0,94.0,94.0,0,0,
Iteration 8 : 26.0,26.0,26.0,26.0,26.0,26.0,26.0,26.0,26.0,0,
Iteration 9 : 71.0,71.0,71.0,71.0,71.0,71.0,71.0,71.0,71.0,71.0,

From the result above, I can conclude that if I update the array value incrementally, it just overwrites the other element in the array.
So, How can I have my expected output?

You are using a char pointer (char*) instead of a char.
When you say;
response[idxUpd]  = assign;

you are assigning not the value but a pointer to that value. That points to assign for every element in response[]. Every response[] get the same pointer value, every response[] get the same value.
Use this:
#define RespLength 10
int response[] = {0,0,0,0,0,0,0,0,0,0};
int idxUpd  = 0;

void setup() {
    // put your setup code here, to run once:
    Serial.begin(115200);
    Serial.println("Start");
}

void loop() {
  // put your main code here, to run repeatedly:
    int wkt = random(10, 99);
    response[idxUpd]  = wkt;

    Serial.print("Iteration "); Serial.print(idxUpd); Serial.print(" : ");
    for (int i=0;i<RespLength;i++){
        Serial.print(response[i] );Serial.print(",");
    }
    Serial.println();
    delay(500);

    idxUpd++;
    idxUpd = idxUpd >= 10 ? 0 : idxUpd;
}

I don't understand why you are converting a int to a float. That value doesn't change, so I omitted the dtostr() call.

I'm sorry I didn't tell the story. So, I'm using char* because the response will be passed into Wire.write(). That function needs the parameter to be char*. I've tried to make the response as int or float, but it is not working well when passed to Wire.write() like this Wire.write(String(response[idxResp]).c)str());

@Oki. You can use Wire.write(value), where value is a byte. An unsigned byte can take values from 0-255. You can send int and float if you send them byte by byte. It's better keep you data as binary and convert it to string as needed. Study pointers and you will be a Master.

I did read about pointers and etc some times ago. But my bad, I forget it because I'm not used to this programming style and language. I accept your suggestion. I changed the  char* response[] to String response[] instead of float response[],  I do this to minimize the conversion process.

C/C++ Arrays don't work the way you are used from scripting languages.
Your
char* response[] = {"0","0","0","0","0","0","0","0","0","0"};

allocates a consecutive space in memory with the lenght of 20 bytes.
So you have 10 pointers that point to static memory.
In your loop you have a array of char assign[5] that gets assigned to every single of those pointers with response[idxUpd]  = assign;. You copy pointers and not values here. So the only value you really have is that in your assign variable. So as you update the pointes of the array, you get the results you see.

I thought the pointer is char *response not char* response :D. Now I know why sizeof(response) returns 20.

@Oki. A pointer in Arduino takes 2 bytes. You have a 10 elements (pointers) array, then 20 bytes. sizeof gives you the size in bytes of the argument.


text:
Void value not ignored as it ought to be
im trying to build an rc plane using arduino nano and nrf24l01 as receiver but im having some issues in the code
it has error on the line
done = radio.read(joystick,sizeof(joystick)); which says that void value not ignored as it ought to be
the whole code is below
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h>
#include<Servo.h>

Servo Throttle,Rudder,Elevator,LeftAileron,RightAileron ;

const uint64_t pipe = 0xE8E8F0F0E1LL;
RF24 radio(9,10);
int joystick[5];

void setup()
{
  /*Serial.begin(9600);
  delay(1000);
  Serial.println("Starting Rx");*/ //Enable serial for debugging

  attachMotors();

  calibrateMotors();

  radio.begin();

  detachMotors();

  radio.setPALevel(RF24_PA_MAX);
  radio.setPayloadSize(10);
  radio.setDataRate(RF24_250KBPS);
  radio.setRetries(15,15);

  radio.openReadingPipe(1,pipe);
  radio.startListening();;
}

void loop()
{
  detachMotors();

  if(radio.available())
  {
    bool done=false;
    while(!done)
    {
      done=radio.read(joystick,sizeof(joystick));
    }

  attachMotors();

  int a=joystick[0];
  int b= joystick[1]; //stores values from tx
  int c=joystick[2];
  int d=joystick[3];
  int e=joystick[4];

  //Serial.println(a);
  //Serial.println(b);
  //Serial.println(c);
  //Serial.println(d);
  //Serial.println(e);
 // Serial.println(f);

  delay(20);
  Throttle.writeMicroseconds(a);   //write values to motor
  Rudder.write(b);
  Elevator.write(180-c);

  if(d== LOW)
  {
  LeftAileron.write(180); ////to activate right aileron
  RightAileron.write(180);
  delay(15);
  }

  else if(e == LOW)
  {
    LeftAileron.write(0);  //to activate left aileron
    RightAileron.write(0);
    delay(15);
  }
  else
  {
    LeftAileron.write(100);
    RightAileron.write(110); //Ailerons at neutral pos
    delay(15);
  }
    }
  else
  {
    calibrateMotors();
    delay(15);

  }
  }

void attachMotors()
{
  Throttle.attach(3);
  Rudder.attach(4);
  Elevator.attach(5);
  LeftAileron.attach(6);
  RightAileron.attach(7);
}

void calibrateMotors()
{
  Rudder.write(90);
  Elevator.write(90);
  LeftAileron.write(100);
  RightAileron.write(110); //centering servo shafts
}

void detachMotors()
{
  Throttle.detach();
  Rudder.detach();
  Elevator.detach();
  LeftAileron.detach();
  RightAileron.detach();
}

"Void value" basically means "nothing", that the function doesn't return anything you can to store. If you want to check if packets are available use the .available() and read() if you want to store that data somewhere (after you've made sure there is something in the buffer).

I think this examples could help you but this isn't the same library you seem to be using: https://github.com/nRF24/RF24/blob/master/examples/GettingStarted/GettingStarted.ino . (Disclaimer: I am one of the maintainers of the library linked here)

Something changed while you were looking away. This is the updated description of read(). As you can see, it not longer returns a bool.
Use available to determine if packets are available:
/**
   * Read the available payload
   *
   * The size of data read is the fixed payload size, see getPayloadSize()
   *
   * @note I specifically chose 'void*' as a data type to make it easier
   * for beginners to use.  No casting needed.
   *
   * @note No longer boolean. Use available to determine if packets are
   * available. Interrupt flags are now cleared during reads instead of
   * when calling available().
   *
   * @param buf Pointer to a buffer where the data should be written
   * @param len Maximum number of bytes to read into the buffer
   *
   * @code
   * if(radio.available()){
   *   radio.read(&data,sizeof(data));
   * }
void read( void* buf, uint8_t len );

Can you please fix the code for me because i recently started on the arduino platform and dont know much. I copy pasted this code from somewhere else :(

Best way to learn is to do it yourself, this answer also has a small code snippet that shows how to read data from the nRF24L01(+), have you tried it? The examples in the examples folder also show you how to use the library if you still can't figure it out.

Give a man a fish ...

ok ill try to understand the examples


text:
Arduino I2C via USB Serial cable?
An Arduino UNO is given.
I want to establish an I2C communication channel between Arduino UNO and a Linux Machine which have only USB ports available to communicate with peripherals.
Currently I can communicate with Arduino board via USB Serial cable (TXD and RXD which are on pins D0 and D1).
My question is: is there any way to use those pins as SCL/SDA to communicate via I2C with Arduino Board?
I am thinking that the only way to accomplish this is to buy an USB to I2C Adapter and connect to A4 (SDA) and A5 (SCL); but maybe I'm wrong.
I have also seen that way: https://gist.github.com/kraftb/8c0bbcc35a9778608d74. Basically to use an intermediate Arduino board.

Why? I wonder ...

@LookAlterno Because it's faster?

The speed grades for I2C are: standard mode: 100 kbit/s; full speed: 400 kbit/s; fast mode: 1 mbit/s; high speed: 3,2 Mbit/s. USB 2.0 Hi-Speed is 480 Mbit/s (~57 MB/s). USB is faster.

What about Serial port speed? USB speed is not limited by Serial speed from Arduino UNO?

Because the Uno uses an actual UART between its main and USB chips, you'll only get high data rates over USB if you find a high baud rate that works for both.  On an actual Uno they are both closely related ATmegas running from comparable clock sources, so divider inaccuracies at least won't be an issue.

This seems like it might be an XY problem - do you really want I2C, or do you just want to move data faster?

I'm voting to close this abandoned question because it arises from a misconception

With SoftwareI2CLibrary you can specify other pins, I haven't tested it with RX and TX.
I would recommend the USB serial interface is fast (2M baud) in perspective to that we are discussing a Arduino with a speed of 16MHz.

The Arduino contains a USB to UART adaptor (made from an ATMega16U2) which then connects to the UART pins 0/1. If you want a different protocol you will need a different adaptor that works with your desired protocol.

This may somewhat miss the point - even if you reprogram both chips on the Uno, you'd have to bit-bang I2C between them, which is certainly slower than using their hardware UARTs.  Now if you could do some surgery to connect their I2C pins it might be a different story.  But theoretically their UARTs can run faster than I2C's faster mode.

@ChrisStratton Personally I would use a direct USB connection to a suitable microcontroller. Especially as I now have my own modular USB stack for my favourite PIC32 microcontrollers...

This is a bit miss leading, an Arduino can have different USB to Serial IC chip.

A genuine Arduino made within the past few years has an ATMega16U2. If it doesn't then it isn't an Arduino. It's a clone, or a counterfeit device.

If you change your answer to a "Arduino UNO", then you are correct. And counterfeit? It is open hardware and the reality is that there is a lot of different "Arduino" USB-serial solutions out there.

Arduino is a brand. It is trademarked. While it is open source hardware the name isn't. Arduino Uno, Arduino Mega 2560, etc, are all made by Arduino and Arduino only. Or they have been counterfeited.

@Majenko, I have old Arduino originals with other USB-serial IC than the ATMega16U2!

Yes, old ones. Current ones have the ATMega16U2. I too have Uno R2 that has the 8U2. But the current version, the R3, that has been out years, uses the 16U2.

In case you hadn't noticed, the question specifically talks about Arduino UNO. Ergo the answer must be about the Arduino UNO. There are three classifications of "Arduino" device: Genuine (e.g., the Arduino UNO made in Italy), clones (devices based on the Arduino hardware but crucially not called Arduino) and counterfeit (devices that claim to be an Arduino UNO but aren't made by Arduino). The latter infringes the Arduino trademark and are actually illegal. Also they are usually of very inferior quality.


text:
arduino on battery for long time use
I have a small project with arduino UNO R3 + RTC clock DS3231, that control through a relay a electrovalve (12V).
I would like to use the entire circuit on battery.
The electrovalve (a small motor) has a consumption of 500mA and will be active 4 times a day for 15 second.
I have a 7Ah battery, and I had calculated that my system will work only around 34 hours with it... is there any way to optimize circuit consumption ?
Thanks for any suggestion !

You don't write what kind of Arduino, I think there you also can gain something (using a stripped IC plus the minimum needed), or use sleep mode if you want to keep the (complete) Arduino.

Can you paste you calculations here? The time seems pretty short to me. I come up with 500mA * 15s = 0,5A * 1/240h = 0,002 Ah. So your Battery will last for 3500 cycles = 875 days = about two years. What are the characteristics of your arduino setup? In sleep mode an Arduino can go as low as 0.2µA.

@MichelKeijzers  I edit my post it's an arduino uno.

@Kwasmich what do you mean by sleep mode ? you mean 200mA ?

No, I really mean 200 nano Amperes. 200nA = 0.2µA.

You can turn off the entire Arduino and let it wake by your RTC. That way you can conserve a lot of power. (link)
Also you will have losses from the power regulator when powering the Arduino from 12V. You might consider using a Arduino Pro mini with 3.3V powered by two AA batteries. That should last for years.

That's very interesting, but it's not clear how my RTC can awake arduino, because in my program arduino just read permanently the time send by the RTC...

Some (not all) RTCs have an interrupt timer. Depending on the module it is either INT or SQW. You can set a time and go to sleep then RTC will wake the arduino that is configured to wake up on that interrupt. Then you can read the data, set a new timer and go sleeping again. See here and here

Thanks, it's seems to be what I'm looking for, do you know any library that allow easily to make this configuration ? I read a lot about but didn't understand how to set the RTC DS3231, to send message four time a day.


text:
SD card fail of initializing
I have an Arduino Mega and a catalex card reader which yesterday worked, but today I tried another time and the sd card where not detected, I am using the example code from Arduino website for the card info. I have tried conecting the reader to the SPI ports in the middle of the board and it was not solved. Anyone has another idea of what can be failing?

#include <SPI.h>
#include <SD.h>

// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;

// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
// MKRZero SD: SDCARD_SS_PIN
const int chipSelect = 10;

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

  Serial.print("\nInitializing SD card...");

  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card inserted?");
    Serial.println("* is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
    Serial.println("Wiring is correct and a card is present.");
  }

  // print the type of card
  Serial.print("\nCard type: ");
  switch (card.type()) {
    case SD_CARD_TYPE_SD1:
      Serial.println("SD1");
      break;
    case SD_CARD_TYPE_SD2:
      Serial.println("SD2");
      break;
    case SD_CARD_TYPE_SDHC:
      Serial.println("SDHC");
      break;
    default:
      Serial.println("Unknown");
  }

  // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    return;
  }

  // print the type and size of the first FAT-type volume
  uint32_t volumesize;
  Serial.print("\nVolume type is FAT");
  Serial.println(volume.fatType(), DEC);
  Serial.println();

  volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
  volumesize *= volume.clusterCount();       // we'll have a lot of clusters
  volumesize *= 512;                            // SD card blocks are always 512 bytes
  Serial.print("Volume size (bytes): ");
  Serial.println(volumesize);
  Serial.print("Volume size (Kbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);
  Serial.print("Volume size (Mbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);

  Serial.println("\nFiles found on the card (name, date and size in bytes): ");
  root.openRoot(volume);

  // list all files in the card with date and size
  root.ls(LS_R | LS_DATE | LS_SIZE);
}

void loop(void) {

}

When you tried you tried the same SD card you tried it yesterday ?

Add these Two Lines for better initialization of SD card:
void setup{
    pinMode(10, OUTPUT); // change this to 53 on a mega(don't follow this!!)
    digitalWrite(10, HIGH); // Add this line
}

Check this link, may be useful to your current problem.


text:
Python - Arduino communication not reliable
I'm trying to establish basic communication between python and my arduino due. I have managed to get a message sent to the arduino and sent back, but the code that achieves this task does not give consistent results. I'm running python 3.5 with pyserial 3.3.
My Arduino Code:
String incoming;

void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incoming = Serial.readStringUntil('\n');

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incoming);
        }
}

My Python Code
import serial

arduinoSerialData = serial.Serial("COM5",9600,timeout=1)

print("Initial in waiting:")
print(arduinoSerialData.in_waiting)
print("Initial out waiting:")
print(arduinoSerialData.out_waiting)

while (arduinoSerialData.in_waiting>0):
    garbage = arduinoSerialData.readline()
    print(garbage)

nummessages =0

while (nummessages<5):
    if (arduinoSerialData.in_waiting>0):
        myData = arduinoSerialData.readline()
        myData = myData.decode('utf-8')
        myData = myData.strip()
        print("The Arduino says:")
        print(myData)
        nummessages=nummessages+1
    elif(arduinoSerialData.out_waiting>0):
        pass
    else:
        arduinoSerialData.write(b'Hello Arduino!\n')

while (arduinoSerialData.in_waiting>0):
    garbage = arduinoSerialData.readline()
    print(garbage)

print("In Waiting: ")
print(arduinoSerialData.in_waiting)
print("Out Waiting: ")
print(arduinoSerialData.out_waiting)
arduinoSerialData.close()

These print statements are largely my failed attempt to diagnose the problem. The "garbage" loops were my attempt to make sure conditions were as identical as possible when the python code starts up. If I start the arduino program running and then call this python program from my command line I get inconsistent results. Sometimes my first call to the python "works" and then others won't, sometime it works several times in a row, and that first line out output where it says "The Arduino Says: I" will have a varying amounts of the "I Received: Hello Arduino" message the arduino was supposed to send. Any Ideas what could be causing this lack of consistency? If I try starting the python code first, the arduino can't even start up.

Why are you trying to utf-8 decode the data?  Life will probably be simplest if you throw away or substitute anything that isn't an ASCII character and then print what you have.

I mostly just tried that because similar examples used that as a translation tool. If I comment out the decode() and strip() lines then the program seems to always function, except that the first line is erratic. The number of characters varies, and it sometimes has \xff at the end. I'm assuming these cases are the ones that broke the decoder in the original question. I can look for a different way to go from b'text\r\n' to 'text' to try deal with this. I'll try to add a picture in the main question for clarity.

Please don't use pictures.

Likely this should be a Stackoverflow question (or search for existing answers) on how to pull the printable characters out of a buffer containing (mostly but not entirely) legacy ASCII.

In case other people run into similar issues, I'll lay out what I've found today.
-The inconsistent output was due to the fact that when you open a serial connection with python, it resets the Arduino and so python can send signals without the arduino having finished its setup() function. If I put in a 1 second delay on the python side, inconsistency stops and I no longer run into byte errors at all. I'm looking into alternative means of preventing this reset since the time delay is a deal-breaker for me.
UPDATE:
Replacing
arduinoSerialData("COM5",9600,timeout=1)

with
arduinoSerialData = serial.Serial()
arduinoSerialData.port = "COM5"
arduinoSerialData.baudrate = 9600
arduinoSerialData.timeout = 1
arduinoSerialData.setDTR(False)
#arduinoSerialData.setRTS(False)
arduinoSerialData.open()

seems to bypass the reset. I included both the setDTR and SetRTS functions here because although setDTR works for DUE, it seems some other Arduino boards need setRTS instead.
-The decode() function has a keyword argument called errors, which can be set to "ignore" if you want the code to just ignore things that can't be interpreted in your desired format. With just this keyword setup, I never got errors but output was inconsistent due to reset.

Sounds like the ignore errors option basically gives you the noise filter.  Good call on the reset thing - was just thinking about that in context of another question.

This sis not fix the same issue I had with Duo. The delay did help though.

Problem:
Arduino being a microcontroller ( not a microprocessor ), is not efficient enough. If noticed carefully, messages sent to the Serial monitor gets overlapped if the time interval between 2 messages is less than half a second !! Also, there is an equal possibility of overlapping of data from Arduino resulting in garbage data !!

Solution:
To overcome these, python modules named Arduino_Master and Arduino_Master_Delta are available.
These modules also help you to visualize data in the form of graphs as well as filter data and remove garbage values.
Arduino_Master is used for approximation and easier interface
whereas
Arduino_Master_Delta is used for accurate data representation!

Links:
Links to their documentation is given below :
Arduino_Master
Arduino_Master_Delta

Examples:
The code for all these can be found in Arduino_Master_Delta 's documentation.

I have never noticed an issue of attempting to send distinct messages too quickly causing issues with Python. I was not utilizing the Serial Monitor. The problem I was encountering was definitely caused by the Arduino resetting the program when a Serial connection was opened by Python, as detailed in my self-answer.


text:
What not to do to an Arduino
I may have been working with my Arduino UNO board improperly,
because now it fails to upload sketches (says some programmer is not responding)
and when I press the cute little restart button, the green LED doesn't do its blink anymore. I am aware what that means, but what I really wonder is how should I properly care the board. I probably will have no other chances to buy more arduinos so this information follows to be of a great importance.

As an example I would give, is touching the arduino board with bare hands risky, how much shock-tolerant it is, what if I mistake some pins, are there pins that cannot be mistaken, what will happen if I declare a pin as an output, but use it for input and the contrary, is loading a PWM program onto TFT touch screen shield unhealthy and so forth and briefly - how should I properly care the arduino board.

A lot of things can happen to ruin an Arduino board, although so far I made mistakes and none has broken. However, possible causes can be:

Electrostatic energy, you can prevent it by buying an ESD mat/wristband, or if you don't want to spend money, touch regularly some 'earth' like the central heating
There should not be too much current on a pin ... so don't try to run too many leds or even a motor which is too big from a pin.
Watch out with external power supplies
Don't forget resistors where needed, because of the previous point
Shaking should not matter much, unless you shake so hard that breadboard components are touching each other
Running a program for something else (like PWM on touch screen) might be hard to explain ... it can ruin the device connected, and possibly the Arduino too.

Just some tips:

Whenever you change some hardware/wiring, remove the power
Check very carefully that everything is wired correctly
Keep the Arduino on a solid place (don't let the USB cable let it overthrow/fall on the floor)

I didn't mention about breadboards and it becomes a bit unclear for that reason. Otherwise, very accurate advices, thank you.
I think this is exactly how I broke my Ardu, PWM on a display shied, it was slowly blinking (dimming) back and forth and around that time, this was the last fortunate moment.

It's very hard to predict what happens when a different device is connected (maybe the VCC pin and GND were on different pins).

Yes, this particular tft ts display uses almost all pins and there is not hard to predict every possible combination of wrong placement, but it doesn't matter, I can not revive the board, but I can prevent this happening over again.. on the next 3$ board.

Luckily they are very cheap ... better luck next time

Thanks. Yes, they are affordable. By the way, I was connecting it hundreds of times properly, tested hundreds of programs, but at some point I just got tired, started to be careless and making mistakes. Then it happened.

Happens to me too sometimes ... luckily I just burned not an Arduino, just some LEDs and one 8x8 matrix (one led)

it is okay to use for simple experiments directly. But while you choose to opt for a complex tasks read the details about all the components and their wiring techniques.
specifically try to check soldering is done correctly or not while connecting the wires to any component or to other wire. wrong soldering may damage your parts and arduino as well.
Be careful while using power supply, more when it comes to use multiple sources.
read carefully before you do anything. Dont be afraid just be careful.