text:
Help solving "collect2.exe: error: ld returned 1 exit status" error in code
I just got an Elegoo UNO starter kit the other day and have been working my way through the little tutorials on all the parts it came with. I am using VSCode with Platform.io plugin and (after getting it set up) it has been working nicely.
The code I am currently struggling with is a sketch that is supposed to use the IR Remote and Receiver the kit came with, I keep getting the error: collect2.exe: error: ld returned 1 exit status
I have done some looking around online but haven't had much luck getting anything to work.
My full code is below:
char foo;

#include <Arduino.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <IR.h>

IRrecv irrecv(RECEIVER);     // create instance of 'irrecv'
decode_results results;      // create instance of 'decode_results'

void setup() {
  Serial.begin(9600);
  Serial.println("IR Receiver Button Decode");
  irrecv.enableIRIn();
}

void loop()
{
  int tmpValue;
  if (irrecv.decode(&results)) // have we received an IR signal?
  {
    for (int i = 0; i < 22; i++)
    {
      if ((keyValue[i] == results.value) && (i<KEY_NUM))
      {
        Serial.println(keyBuf[i]);
        tmpValue = results.value;
      }
      else if(REPEAT==i)
      {
        results.value = tmpValue;
      }
    }
    irrecv.resume(); // receive the next value
  }

//The implementation effect of the above program is
//the same as that of the following, but it is more concise

//    switch(results.value)
//  {
//  case 0xFFA25D: Serial.println("POWER"); break;
//  case 0xFFE21D: Serial.println("FUNC/STOP"); break;
//  case 0xFF629D: Serial.println("VOL+"); break;
//  case 0xFF22DD: Serial.println("FAST BACK");    break;
//  case 0xFF02FD: Serial.println("PAUSE");    break;
//  case 0xFFC23D: Serial.println("FAST FORWARD");   break;
//  case 0xFFE01F: Serial.println("DOWN");    break;
//  case 0xFFA857: Serial.println("VOL-");    break;
//  case 0xFF906F: Serial.println("UP");    break;
//  case 0xFF9867: Serial.println("EQ");    break;
//  case 0xFFB04F: Serial.println("ST/REPT");    break;
//  case 0xFF6897: Serial.println("0");    break;
//  case 0xFF30CF: Serial.println("1");    break;
//  case 0xFF18E7: Serial.println("2");    break;
//  case 0xFF7A85: Serial.println("3");    break;
//  case 0xFF10EF: Serial.println("4");    break;
//  case 0xFF38C7: Serial.println("5");    break;
//  case 0xFF5AA5: Serial.println("6");    break;
//  case 0xFF42BD: Serial.println("7");    break;
//  case 0xFF4AB5: Serial.println("8");    break;
//  case 0xFF52AD: Serial.println("9");    break;
//  case 0xFFFFFFFF: Serial.println(" REPEAT");break;
//  default:
//    Serial.println(" other button   ");

  }// End Case

This is code that was included with the tutorials, but I am not certain it is airtight as I have already had to do some tweaking of the code and header files included with the device.
The error I am getting is the following:
include/IR.h:29:0: warning: "REPEAT" redefined
 #define REPEAT 22
 ^
In file included from src\main.cpp:4:0:
include/IRremote.h:57:0: note: this is the location of the previous definition
 #define REPEAT 0xffffffff
 ^
In file included from src\main.cpp:6:0:
include/IR.h:36:78: warning: initializer-string for array of chars is too long [-fpermissive]
                   "UP","EQ","ST/REPT","0","1","2","3","4","5","6","7","8","9"};
                                                                              ^
Linking .pio\build\uno\firmware.elf
C:\Users\wiley\AppData\Local\Temp\ccDVm6mB.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_main.cpp.o.1820':
<artificial>:(.text.startup+0x60): undefined reference to `IRrecv::IRrecv(int)'
C:\Users\wiley\AppData\Local\Temp\ccDVm6mB.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x160): undefined reference to `IRrecv::enableIRIn()'
<artificial>:(.text.startup+0x16c): undefined reference to `IRrecv::decode(decode_results*)'
<artificial>:(.text.startup+0x1c6): undefined reference to `IRrecv::resume()'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\uno\firmware.elf] Error 1

I don't understand the errors it is telling me are in the IR.h file. It says that REPEAT is redefined but it only defined once in the file. In regards to the undefined reference to IRrecv:: I dont understand, because I have all the encessary files in the 'Include' folder, and when I CTRL click those functions in the editor it takes me to the files and shows me the code... so why can't it find the code when I run it?
IR.h:
#ifndef _IR_H
#define _IR_H

#define RECEIVER 11

#define KEY_POWER (0xFFA25D)
#define KEY_FUNC_STOP (0xFFE21D)
#define KEY_VOL_ADD (0xFF629D)
#define KEY_FAST_BACK (0xFF22DD)
#define KEY_PAUSE (0xFF02FD)
#define KEY_FAST_FORWARD (0xFFC23D)
#define KEY_DOWN (0xFFE01F)
#define KEY_VOL_DE (0xFFA857)
#define KEY_UP (0xFF906F)
#define KEY_EQ (0xFF9867)
#define KEY_ST_REPT (0xFFB04F)
#define KEY_0 (0xFF6897)
#define KEY_1 (0xFF30CF)
#define KEY_2 (0xFF18E7)
#define KEY_3 (0xFF7A85)
#define KEY_4 (0xFF10EF)
#define KEY_5 (0xFF38C7)
#define KEY_6 (0xFF5AA5)
#define KEY_7 (0xFF42BD)
#define KEY_8 (0xFF4AB5)
#define KEY_9 (0xFF52AD)
#define KEY_REPEAT (0xFFFFFFFF)
#define KEY_NUM 21
#define REPEAT 22

unsigned long keyValue[]={KEY_POWER,KEY_FUNC_STOP,KEY_VOL_ADD,KEY_FAST_BACK,KEY_PAUSE,KEY_FAST_FORWARD,
                KEY_DOWN,KEY_VOL_DE,KEY_UP,KEY_EQ,KEY_ST_REPT,KEY_0,KEY_1,KEY_2,KEY_3,KEY_4,KEY_5,
                KEY_6,KEY_7,KEY_8,KEY_9,KEY_REPEAT};

char keyBuf[][10]={"POWER","FUNC/STOP","VOL+","FAST BACK","PAUSE","FAST FORWARD","DOWN","VOL-",
                  "UP","EQ","ST/REPT","0","1","2","3","4","5","6","7","8","9"};
#endif

I have searched online a lot, and this seems to be a common issue with this IR.h library, and none of the fixes proposed have got me anywhere. (I get the same outputs when trying to run this sketch within the Arduino IDE with all a libraries installed)
I have been developing with Java and Python for a while now, but I have almost no experience with C or C++ before the Arduino, so maybe this is a simple error I just don't understand. Super frustrating!! Any help or guidance would be appreciated! Thanks

The "real" error messages are the "undefined reference" lines. The compiler (linker in fact) can't find the code (.cpp) files for one of the libraries (IRremote probably). The Arduino IDE does some magic to take care of that automatically, but I'm not familiar with VSCode or Platform.io. Look for options to include libraries somewhere in your project settings or something like that.

BTW the warning before that is pretty deadly (memory corruption bug). The loop must be adjusted so that it doesn't go over keyValue's bounds.

I have made sure all the .h files and .cpp files I am using are in the "Include" folder of the project, which has worked with the previous header files. It's silly that it says it cant find the code because if I CTRL click on the methods in the editor it takes me right to the .cpp file it is in, inside the "Include" folder, so I dont get why it cannot find it at run time.

Also, I dropped the loop down to 22 and that issue regarding the loop dissapeared, but more appeared regarding the .h files. Will update OP

You don't include .cpp files, you need to compile (and then link) them. Again, I don't know your setup, but the .cpp files shouldn't be in include settings. See if you can add extra source files somewhere in the project settings.

I have figured it out. PlatformIO has a really convenient Library manager that helps with set up. You just select a library and it will automatically add it to the project you choose and make sure the correct dependencies are listed in the .ini file. Thank you for your help!

You can take your comment and post it an answer instead.

I had problem with the Serial library, which caused that problem.

I have figured it out.
The problem was I had not properly set up the project with the proper libraries. I thought I was doing it right manually but I was not. PlatformIO has a really convenient Library manager that helps with set up. You just select a library and it will automatically add it to the project you choose and make sure the correct dependencies are listed in the .ini file. I was trying to manually drop the files I needed into the correct directories, and was not doing the proper adjustments to the .ini file. Thanks for the help @Mat!


text:
can anyone help me debug this code my delay microseconds is not working and my servo write for 180 as well
this is not my code this is what i found on makersguide i tried to use the same but it doesn't work
#include <Servo.h>

// Define Trig and Echo pin:
#define trigPin 10
#define echoPin 9
// Define variables:
long duration;
int distance;
void setup() {
// Define inputs and outputs:
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
}
void loop() {
// Clear the trigPin by setting it LOW:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Read the echoPin, pulseIn() returns the duration (length of the pulse) in
microseconds:
duration = pulseIn(echoPin, HIGH);
// Calculate the distance:
distance = duration * 0.034 / 2;
// Print the distance on the Serial Monitor (Ctrl+Shift+M):
Serial.print("Distance = ");
Serial.print(distance);
Serial.println(" cm");
delay(50);
}

// Include the servo library:
#include <Servo.h>
// Create a new servo object:
Servo myservo;
// Define the servo pin:
#define servoPin 9
// Create a variable to store the servo position:
int angle = 0;
voidsetup() {
// Attach the Servo variable to a pin:
myservo.attach(servoPin);
}
  void loop(){
  myservo.write(90);
  delay(1000);
  myservo.write(180);
  delay(1000);
  myservo.write(0);
  delay(1000);
  // Sweep from 0 to 180 degrees:
  for (angle = 0; angle <= 180; angle += 1) {
  myservo.write(angle);
  delay(0);
  }
  for (angle = 180; angle <= 0; angle -= 1) {
    myservo.write(angle);
    delay(0);

  }
  delay(1000);
 }

"Doesn't work" doesn't tell us much. What happens? Anything? Maybe it's a wiring issue, which we can't tell by reading your question. Maybe it doesn't compile? You seem to have two loop functions, and a voidsetup whatever that is.

it says that my void loop is previously defined

and it also says that ISO C++ forbids declaration of void setup with no type [-fpermissive]  in function of void loop( )

It actually said "warning: ISO C++ forbids declaration of 'voidsetup' with no type [-fpermissive]". Notice that you omitted the space between "void" and "setup". That's why we ask you to copy and paste the error message, not just paraphrase them.

For combining sketches, look at this question. There are also links to similar questions.

Your code has two "loop" functions in it. You cannot have two functions of the same name (and with the same argument list, in your case with no arguments) in the one compilation unit (piece of code).
It looks very much like you have combined two pieces of code you found into one and then tried to compile that. You can't do that. Choose one or the other. In the second "half" you incorrectly have "voidsetup" which should be "void setup".
Next time you post a question, and if the question is about an error message, please copy and paste the error message. We aren't mind readers. You can see what is on your screen, we can't.
See: How do I ask a good question about the Arduino?

source: Stack Exchange

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

sort: votes


text:
NP532 doesn't detect NTAG213 tag
I'm using a PN532 module to read/write NTAG213 tags. They both should be working at 13.56 MHZ, and Adafruit should support these tags in their library.
The Arduino Uno board and the module are connected as follows
PN532 Module  |  Arduino Uno
--------------+-------------
VCC           |  5V
GND           |  GND
SCK           |  D2
MI            |  D5
MO/SDA/TX     |  D3
NSS           |  D4

SPI is enabled on the PN532 module:
SET 0 -> L
SET 1 -> H

Using the ntag2xx_read example provided by the library, I can pick up MIFARE tags, with an error thrown in the Serial Monitor.
This doesn't seem to be an NTAG203 tag (UUID length != 7 bytes)!

So far, so good. But when I try to place one of my NTAG213 tags, nothing happens. I thought maybe I'd need to change the page read to match NTAG213 specs (instead of default NTAG203) but unsurprisingly id didn't change anything.
I'm not sure where to go from there. I don't know whether there's some hardware incompatibility or if I'm missing something in the setup or the code. Any help would be greatly appreciated.
The NTAG213 tags can be read with a smartphone.

The code I'm using is exactly the same as the one linked from the library above (besides page read), I'm pasting it here for future reference
/**************************************************************************/
/*!
    @file     readntag203.pde
    @author   KTOWN (Adafruit Industries)
    @license  BSD (see license.txt)

    This example will wait for any NTAG203 or NTAG213 card or tag,
    and will attempt to read from it.

    This is an example sketch for the Adafruit PN532 NFC/RFID breakout boards
    This library works with the Adafruit NFC breakout
      ----> https://www.adafruit.com/products/364

    Check out the links above for our tutorials and wiring diagrams
    These chips use SPI or I2C to communicate.

    Adafruit invests time and resources providing this open source code,
    please support Adafruit and open-source hardware by purchasing
    products from Adafruit!
*/
/**************************************************************************/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>

// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SCK  (2)
#define PN532_MOSI (3)
#define PN532_SS   (4)
#define PN532_MISO (5)

// If using the breakout or shield with I2C, define just the pins connected
// to the IRQ and reset lines.  Use the values below (2, 3) for the shield!
#define PN532_IRQ   (2)
#define PN532_RESET (3)  // Not connected by default on the NFC Shield

// Uncomment just _one_ line below depending on how your breakout or shield
// is connected to the Arduino:

// Use this line for a breakout with a software SPI connection (recommended):
Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);

// Use this line for a breakout with a hardware SPI connection.  Note that
// the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's
// hardware SPI SCK, MOSI, and MISO pins.  On an Arduino Uno these are
// SCK = 13, MOSI = 11, MISO = 12.  The SS line can be any digital IO pin.
//Adafruit_PN532 nfc(PN532_SS);

// Or use this line for a breakout or shield with an I2C connection:
//Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);

void setup(void) {
  Serial.begin(115200);
  while (!Serial) delay(10); // for Leonardo/Micro/Zero

  Serial.println("Hello!");

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  // Got ok data, print it out!
  Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
  Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
  Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);

  // configure board to read RFID tags
  nfc.SAMConfig();

  Serial.println("Waiting for an ISO14443A Card ...");
}

void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
  uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

  // Wait for an NTAG203 card.  When one is found 'uid' will be populated with
  // the UID, and uidLength will indicate the size of the UUID (normally 7)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  if (success) {
    // Display some basic information about the card
    Serial.println("Found an ISO14443A card");
    Serial.print("  UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
    Serial.print("  UID Value: ");
    nfc.PrintHex(uid, uidLength);
    Serial.println("");

    if (uidLength == 7)
    {
      uint8_t data[32];

      // We probably have an NTAG2xx card (though it could be Ultralight as well)
      Serial.println("Seems to be an NTAG2xx tag (7 byte UID)");

      // NTAG2x3 cards have 39*4 bytes of user pages (156 user bytes),
      // starting at page 4 ... larger cards just add pages to the end of
      // this range:

      // See: http://www.nxp.com/documents/short_data_sheet/NTAG203_SDS.pdf

      // TAG Type       PAGES   USER START    USER STOP
      // --------       -----   ----------    ---------
      // NTAG 203       42      4             39
      // NTAG 213       45      4             39
      // NTAG 215       135     4             129
      // NTAG 216       231     4             225

      for (uint8_t i = 0; i < 45; i++)
      {
        success = nfc.ntag2xx_ReadPage(i, data);

        // Display the current page number
        Serial.print("PAGE ");
        if (i < 10)
        {
          Serial.print("0");
          Serial.print(i);
        }
        else
        {
          Serial.print(i);
        }
        Serial.print(": ");

        // Display the results, depending on 'success'
        if (success)
        {
          // Dump the page data
          nfc.PrintHexChar(data, 4);
        }
        else
        {
          Serial.println("Unable to read the requested page!");
        }
      }
    }
    else
    {
      Serial.println("This doesn't seem to be an NTAG203 tag (UUID length != 7 bytes)!");
    }

    // Wait a bit before trying again
    Serial.println("\n\nSend a character to scan another tag!");
    Serial.flush();
    while (!Serial.available());
    while (Serial.available()) {
    Serial.read();
    }
    Serial.flush();
  }
}

And nothing happens in the monitor after the setup
22:28:56.855 -> Hello!
22:28:56.888 -> Found chip PN532
22:28:56.888 -> Firmware ver. 1.6
22:28:56.922 -> Waiting for an ISO14443A Card ...

If I uncomment #define PN532DEBUG in Adafruit_PN532.cpp, I get some extra logs but still none when I pass my NTAG213 tag. Adding a timeout doesn't help the tag to be detected either.
// Passing the NTAG213 here
15:51:00.519 -> Sending : 0x0, 0x0, 0xFF, 0x4, 0xFC, 0xD4, 0x4A, 0x1, 0x0, 0xE1, 0x0,
15:51:01.582 -> TIMEOUT!
15:51:01.582 -> No card(s) read
15:51:01.582 -> Sending : 0x0, 0x0, 0xFF, 0x4, 0xFC, 0xD4, 0x4A, 0x1, 0x0, 0xE1, 0x0,
15:51:02.614 -> TIMEOUT!
15:51:02.614 -> No card(s) read
15:51:02.614 -> Sending : 0x0, 0x0, 0xFF, 0x4, 0xFC, 0xD4, 0x4A, 0x1, 0x0, 0xE1, 0x0,

// Passing another tag here
15:51:03.212 -> Reading:  0x0 0x0 0xFF 0xC 0xF4 0xD5 0x4B 0x1 0x1 0x0 0x4 0x8 0x4 0x47 0xF5 0xC 0xD8 0xAE 0x0 0xAA
15:51:03.212 -> Found an ISO14443A card
15:51:03.212 ->   UID Length: 4 bytes
15:51:03.249 ->   UID Value: 0x47 0xF5 0x0C 0xD8
15:51:03.249 ->
15:51:03.249 -> This doesn't seem to be an NTAG203 tag (UUID length != 7 bytes)!
15:51:03.249 ->
15:51:03.249 ->
15:51:03.249 -> Send a character to scan another tag!

I have no special knowledge the related NFC topics, but I have been looking over everything you've referenced and I noticed nfc.SAMConfig() returns a bool value to indicate success on true (I think).  For lack of anything more intelligent to suggest for now, I thought maybe you might see that this is call is indicating success.

A fair mount of useful debugging information may come from uncommenting PN532DEBUG and MIFAREDEBUG (https://github.com/adafruit/Adafruit-PN532/blob/1.2.1/Adafruit_PN532.cpp#L67) in Adafruit_PN532.cpp.  Might help to include that information with the question.

Thanks for commenting @timemage. nfc.SAMConfig() returns 1 so this seems ok I think. I've tried adding the debug macros in the .ino file but it didn't print any additional info. I haven't tried to recompile the library yet, as I have never done it before.

It is usually enough to edit the source in place and just compile again.  In the past, I believe the IDE has incorrectly cached object files.  You can restart the IDE to get it to use a new temporarily build directory to prevent that from happening.  You may need to change the macro for the Serial port the library is using to print diagnostics.

@timemage I did t didn't get any more luck :/ It still doesn't print anything when i try to pass the tag on the reader. I do see extra logs when I pass another tag but it's still not detecting the NTAG213

What happens if you use the version of the readPassiveTargetID() that accepts a timeout?  Does it in fact timeout or does it lock up inside the function?

@timemage It loops until it detects something. With a NTAG213 it keeps going as if nothing happened, and then stops when detecting another tag. I've updated the question with the logs from PN532DEBUG and readPassiveTargetID() with a timeout

I'll keep looking at it.  I get the sense though that someone who knows this library and part will be able to say something useful based on the information you have in the question now.

Well, I'm curious about this stuff.  So, you should know I've ordered some things to test with here.  Some NTAG213 and a reader using the PN532, though not your exact board.  Perhaps within the week I'll be able to test locally.

Have you checked your tag with other readers? Many smartphones should be able to read (and write to) such tags, if that helps.

@timemage I truly appreciate your involvment in this :) I've also contacted the sellers just in case

@jcaron You're right, I absolutely meant to test the tags with a phone but I forgot. Mine doesn't support NFC but I live with a person who owns such a phone. I'll try that and let you know.

I have tags, but my board for testing won't come until Tuesday at the earliest.  I'm not sure how much longer I'm going to be on arduino.stackexchange.com.  I can be found on freenode if you want to talk there.

Received my board a day early it seems.  Wired it as described.  Using the code given unaltered on an UNO.  When I try an NTAG213, it recognizes it, prints the 7 byte UID, and proceeds to dump 4-byte pages numbered 0 to 44 inclusive.

@timemage Looking back on the PN532 link I initially provided, I think it might be a reader issue. It states that it supports ISO14443 but I couldn't find NTAG213 mentioned anywhere. I expected it to work because PN532 usually do but apparently this one doesn't. I contacted the vendor but they haven't been of much help knowing what their product supports or not. I've also tried reading the tags with a smartphone, and didn't have any problem doing so.

What you're saying seems to hinge on the idea that, since we're running the same code, that the PN532 can be configured to work (or not) with NTAG213 and that this configuration must exist in some non-volatile way, as part of the circuit construction or built-in eeprom etc.  I can't seem to substantiate that idea.

@timemage I'm not 100% sure I understood your last comment. I'll try my best to reformulate what I understood. I thought - seemingly wrongly - that any PN532 module would be able to work with NTAG213 because a quick google search indicates that these two can be compatible. However PN532 does not seem to be follow a specific norm or specification. Therefore simply being a PN532 module is not enough to ensure compatibility with NTAG213.

I'm not sure what more I can do while staying inside the stack-exchange format.  If you want, you can locate me on freenode.  If we come to a conclusion, you can write up your experience an answer to your own question.

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


text:
Temperature sensors are heating themselves
I have 2 IoT devices for measuring room temperature. Room does not have direct sunlight (it is north oriented and have tree in front of window). One is ESP8266 with DHT11 and next one is ESP8266 with DS18B20. DHT is on the table, away from PC. DS18B20 is on the top of bookshelf next to plant. Both of them shows temperature around 32-33 deg. celsius. It is not that hot in the room for sure. My home thermostat shows 23-24 deg. celsius. Outside temperature is about 15 deg. When I open the window and cool down the room, I can see temerature drop on both sensors, but still ony to around 26-28 celsius. I think, they are overheating themselves.
Code is almost same on both devices. Sampling every minute, so it should not be an issue of overloading sensors. Supply voltage is 3,3V. Not parasitic with 2k2 pull-up resistor.
What should I do to get correct temperature reading from these sensors?
EDIT: I have tired to get sensor out of PCB. First, I have just raised it for lengt of its legs (about 1cm) above board. It helped little, but it is visible, that sensor started cold, and slowly saturated heat from wires. So I took quite thick cables (0,25mm^2) and put sensor about 10cm away from board. And it helped! Temperature is about 23 degrees, what is somwhere in expected range. Most important is, that temperature curve was dropping before stabilizing. Spikes are just 85°C first reading.

Have you checked, if they are warm? If yes, then they are broken and you need to replace them. Though I suspect more of a calibration problem

DHT is cold. DS is little bit warmer than object around, but it is new original chip. I will try to get my hands on another one

I have bought brand new original DS18B20. Replaced other one. Temperature reading is still above 30⁰C. About 6⁰C above thermostat reading.

start by separating the sensor from the microcontroller by an insulating barrier

@jsotola it seems, that you hit the nail! I would not expect, that heat is transimiting that easily through wires to sensor.

Please write an own answer and mark it to help future visitors find a solution to their similar problem.

It seems, that problem is in heat transfer from ESP chip to thermometer via wires. Worst it was, when chip was on board itself, little bit better when it was raised about 1cm out of board. I have achieved correct readings only when I put sensor on longer and quite thick leads to avoid heat transfer as much as possible.

I can't just now find a source for this but I have read in several places that the DS18b20's leads (and the ground-lead in particular) conduct heat into the device rather well, and in the case of the plastic-packaged devices that most of us use, probably have the dominant influence on the sensor. This suggests that either the ground lead be in intimate contact with the surface to be measured, or the leads be well insulated, thermally, from influences not of interest.

It does not surprise me that a sensor needs a correction to calculate the correct value. I have had the same problems with a range of sensors.
Because linearity is not really important when you need to measure only a room temperature, it would be sufficient to measure room temperature with a reliable thermometer and see how much you need to subtract to correct the value from your sensor.
When still in doubt, you could cover the sensor with a plastic bag and measure the temperature dipped in a bowl of water with crushed ice cubes in it.

Unfortunately, that doesn't help if the error varies over time (e.g. when the sensor reading changes just because it's been on for hours)

I agree with you that this can happen with a very inaccurate sensor. In my case the fault was specified in the datasheet. A 12 bit digital sensor, LM76 with an accuracy of 1 degree C.


text:
Write file to SD card using SDFat.h and ESP8266
I have simple problem with not simple solution.
My workflow is:

Read CID from SD card
Send CID via Http to clodud
Download specific text from cloud
Write this text to file in same SD card

All is working except last step. I cannot figure out how to write to file using SDFat lib. I have to use SDFat for reading CID and other low lvl data from card. Im strugling on "open File" step. Have numerous problems with multiple declarations and none of combinations SD.h SDFat.h and FS.h not working for me. Please, help me, how to open file.
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include "SdFat.h"
#include "sdios.h"

SdFat sd;

...

void WriteToFile(String payload) {
  fs::File myFile;

  myFile = sd.open("test.txt", FILE_WRITE);

  myFile.println(payload);

  myFile.flush();
  myFile.close();
}

So what is wrong: Using ESP8266 I cannot compile code due to multiple occurence of fs::File and File32.
C:\...\Arduino\libraries\SdFat\src/SdFat.h:400:16: error: 'typedef class File32 File' conflicts with a previous declaration
 typedef File32 File;
                ^

Now I rebuild whole code for ESP32 chip. I can compile and upload code. It can read CID send it, read incoming file and ope SD card. But when writing to file I got
error: Cannot open file
Check SD format.

I tried several formats, Fat16, Fat32, exFat on several SD cards from 2 to 64Gbs. All of them were unlocked, all of them were formated to 2 partitions (thats what I want) and 1 partition (for testing) withouth difference. I was also tweeking SPI speed When I set more than 16MHz, it fails (Using ESP32 Wroom)
EDIT2: When I first open volume, call chvol() on volume (not sd card) then it works and I can open file and write to it. Wtf?
  if (!volume.begin(sd.card())) {
    Serial.println("Could not find exFat partition.\nMake sure you've formatted the card");
    return;
  }

  volume.chvol();

If you don't describe us the problems more detailed, we can not say what went wrong. Does the code not compile? Is there an error message, when you run the prog? Perhaps you locked the SD card, so writing is impossible, or you have to change the FAT Vlolume with sd.chvol(). Does open for read work? Have you tried that?.... Just saying "it doesn't work" is not enough!  ;-).

I edited question with some news and updates


text:
can't connect paj7620 (gesture detector module) to nodemcu
I'm trying to connect paj7620 to nodemcu micro-controller. I have implemented the following code and it worked perfect on arduino uno. The problem is that I was made to migrate to nodemcu.
Here is my code:
/*
 * Copyright (c) 2015 seeed technology inc.
 * Website    : www.seeed.cc
 * Author     : Wuruibin
 * Modified Time: June 2015
 * Description: This demo can recognize 15 gestures and output the result.
 *              You can adjust the reaction time according to the actual circumstance
 *              by modifying "#define GES_REACTION_TIME  500".
 *
 * The MIT License (MIT)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#include <ESP8266WiFi.h>
#include <Wire.h>
#include "paj7620.h"

/*
Notice: When you want to recognize the Forward/Backward gesture or other continuous gestures, your gestures' reaction time must less than GES_REACTION_TIME(0.8s).
        You also can adjust the reaction time according to the actual circumstance.
*/
#define GES_REACTION_TIME       800
#define GES_QUIT_TIME           1000

void setup()
{
    uint8_t error = 0;

    Serial.begin(9600);
    Serial.println("\nPAJ7620U2 TEST DEMO: Recognize 15 gestures.");

    error = paj7620Init();          // initialize Paj7620 registers
    if (error)
    {
        Serial.print("INIT ERROR,CODE:");
        Serial.println(error);
    }
    else
    {
        Serial.println("INIT OK");
    }
    Serial.println("Please input your gestures:");
    Serial.begin(115200);
  Serial.println();

  // Serial.print("Setting soft-AP configuration ... ");
  // Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");

  Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP("NODEMCU") ? "Ready" : "Failed!");

  Serial.print("Soft-AP IP address = ");
  Serial.println(WiFi.softAPIP());
}

void loop()
{
    uint8_t data = 0, data1 = 0, error;

    error = paj7620ReadReg(0x43, 1, &data);             // Read Bank_0_Reg_0x43/0x44 for gesture result.
    if (!error)
    {
        switch (data)                                   // When different gestures be detected, the variable 'data' will be set to different values by paj7620ReadReg(0x43, 1, &data).
        {
            case GES_RIGHT_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_LEFT_FLAG)
                {
                    Serial.println("Right-Left");
                }
                else if(data == GES_FORWARD_FLAG)
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG)
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Right");
                }
                break;
            case GES_LEFT_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_RIGHT_FLAG)
                {
                    Serial.println("Left-Right");
                }
                else if(data == GES_FORWARD_FLAG)
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG)
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Left");
                }
                break;
                break;
            case GES_UP_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_DOWN_FLAG)
                {
                    Serial.println("Up-Down");
                }
                else if(data == GES_FORWARD_FLAG)
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG)
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Up");
                }
                break;
            case GES_DOWN_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_UP_FLAG)
                {
                    Serial.println("Down-Up");
                }
                else if(data == GES_FORWARD_FLAG)
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG)
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Down");
                }
                break;
            case GES_FORWARD_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_BACKWARD_FLAG)
                {
                    Serial.println("Forward-Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                break;
            case GES_BACKWARD_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_FORWARD_FLAG)
                {
                    Serial.println("Backward-Forward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                break;
            case GES_CLOCKWISE_FLAG:
                Serial.println("Clockwise");
                break;
            case GES_COUNT_CLOCKWISE_FLAG:
                Serial.println("anti-clockwise");
                break;
            default:
                paj7620ReadReg(0x44, 1, &data1);
                if (data1 == GES_WAVE_FLAG)
                {
                    Serial.println("wave");
                }
                break;
        }
    }
    delay(100);
}

------------------------
|paj7620    | nodemcu  |
------------------------
| VCC       | 3.3v     |
------------------------
| GND       | GND      |
------------------------
| SCL       | D1       |
------------------------
| SDA       | D2       |
------------------------

After connecting the ports like the above table, I get the following error when I am trying to upload the code on nodemcu.
Would someone help me how to resolve this error?

Wiring

PS I have also tried I2C Scanner as @timemage mentioned in comments.

PS 2 It works properly when I connect the paj7620 to arduino compiling the above code.

output:

Do you have external pull-up resistors on the I2C bus?  What else, if anything, do you have connected to the board?

@timemage Sorry I am newbie in this field. can't understand what you have said. would you please give me more details?

If you haven't already, run the I2C scanner and make sure your sensor is showing up in it.

@timemage I got the following error:
/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool/esptool.py", line 672, in flash_defl_block self.ESP_FLASH_DEFL_DATA, struct.pack('<IIII', len(data), seq, 0, 0) + data, self.checksum(data), timeout=timeout)  check_command raise FatalError("Failed to %s. Only got %d byte status response." % (op_description, len(data))) esptool.FatalError: Failed to write compressed data to flash after seq 12. Only got 1 byte status response. esptool.FatalError: Failed to write compressed data to flash after seq 12. Only got 1 byte status response.

You need to close the serial monitor before uploading a new sketch, that looks like an upload error.

There's nothing particularly special about the I2C Scanner code with respect to uploading.  So, it sounds like like your talking about separate and distinct problem that should be fixed before continuing on this question.  What I can tell for you now is that until your device shows up in the scanner, it is not worth troubleshooting the device-specific code (sketch or library), because the problem is lower level than that.  Something like having been miswired.

@timemage it was compiled and uploaded on the board successfully. but the output in serial was empty! :(

@MaximilianGerhardt Yeah you are right. after running that code, the output was empty!

Perhaps if you add a clear image of your wiring to your question something will stand out.

@timemage done!

Well the CJMCU board seems to have I2C pull-ups of reasonable size. So, that answers that.  Your purple(ish) wires on center of the left appear to be serving no functional purpose, although they're harmless.  This breadboard appears to only have one set of rails there.  I'm not sure what to suggest except to reduce the wiring, if possible go directly from the 3.3v and GND to the sensor board.

On closer inspection, your SCL pin soldering on the CJMCU module seems not-so-good.  Can you get a closeup picture of that?

It is possible that the three-pin device on your sensor board is a 3.3v regulator and that the intention is to power the board from 5V.  I haven't been able to find any schematics for or proper specs for it though.  So, I'm leery of telling you to try that.  I suppose if you've already been doing that on the UNO and it hasn't killed it, it makes sense to try.  I would fix the soldering first though.

Special thanks to @timemage for his support. After struggling with the board for more than 6 hours it works properly. I will describe and give more details about how the problem was solved later on.
Arduino Uno has 5 Analog inputs, while there isn't any of them on nodemcu. To connect paj7620 to nodemcu, it is noticable that as @timemage said:

"The A4 and A5 on the UNO are where the ATMega328P's I2C bus signals happen to be. Earlier versions of the Arduino UNO and related boards didn't have dedicated SDA and SCL headers as they do now. On those UNO that have SDA and SCL pins on the upper digital header, they are the same exact signal as those found on A4 and A5."

So the first schema was correct.
As it is implied from the fifth page of this link there isn't any difference among 3.3v inputs on nodemcu. But I have changed wiring like the following image and it works!

#COLOR MAPPING
RED: VCC - 3.3v
BLACK: GND
ORANGE: SCL - D1
GREEN: SDA - D2

I hope it helps, cause there isn't any way to trace the problem. :)

When you get a chance, try the load test on your "bad" 3.3v pin.  Just put something on the order of 50 ohms there.  It should draw about 66 mA and pin should stay near 3.3v  If the voltage drops off to nothing, maybe mark the pin somehow so you don't try to use it in the future.  And you know, fix the soldering when you can. =)

You've gotten rather quiet over there since I suggested zooming in on your sensor board.  Just so this question doesn't circulate around in the system for years, here's an answer:

Your soldering should closer to this.  Hopefully better, as these are ones I did:

The solder short of sort web-up the sides of the pins. The use the term "fillet" for that.  Where your pads around the through-hole looks broader than the ones that are on the board above, it should probably look a bit better.  There shouldn't be unfilled parts of the through-hole, in any case.  At least not on the side you're soldering.
I expect it will at least show in the I2C scanner when you fix that.  It may show a different address from what is default in the library, in which case you may need to tell it to use the address that shows in the scanner.

you are right, but it works properly when I run the above code on arduino. The problem is with connection to nodemcu.

The connection may be so weak that it doesn't take much to affect whether or not it "works".

I have connected it to the arduino like this picture. scl to a5 and sda to a4. How can I change the above code that works the same? I think the problem is with the connection of pins to paj and nodemcu. But I didn't find any resource about connecting paj to nodemcu and I have added my code to see whether it has solution or not.

I don't believe there's anything wrong with the I2C scanner running on the esp8266.  And I don't believe that it's worth dealing with your original code until it shows in the scanner.  As I said, I'm sure the problem is something more fundamental.

I don't know where the problem is. I have edited the post again. would you please take a look at that?

I have look at arduino again. I have connected the scl to analog input, while nodemcu doesn't have any analog input, what should I do?

The A4 and A5 on the UNO are where the ATMega328P's I2C bus signals happen to be.  Earlier versions of the Arduino UNO and related boards didn't have dedicated SDA and SCL headers as they do now.  On those UNO that have SDA and SCL pins on the upper digital header, they are the same exact signal as those found on A4 and A5.

Let us continue this discussion in chat.


text:
Reading Serial Data sent from PC to Arduino with help of another Arduino
I am trying to sniff the Serial Communication between the PC and Arduino MEGA 2560. For trying to check what my PC is sending to my Arduino. I am using another Arduino MEGA 2560 to read this data since my serial monitor is busy.
To this I have connected RX pin of my arduino to RX Pin of my second arduino and both have common ground. In this way i thought i can use serial monitor of my second arduino to see the data what my pc is sending to Arduino.
But when i upload the program to Arduino, I am getting the following error

avrdude: stk500v2_ReceiveMessage(): timeout avrdude:
stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage():
timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude:
stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage():
timeout avrdude: stk500v2_getsync(): timeout communicating with
programmer

I dont have any problems when i use only one Arduino.
One Arduino uses COM Port 4 and other uses COM Port 5. I am not sure what is going wrong. I googled this problem and found few things but none of them were quiet working for me.
The main issue which i am not sure is if i can use Arduino IDE instance twice(one for each arduino with different com port) and check what my pc is sending to first arduino with the help of second arduino.
Can anyone suggest some other alternative on how to see serial data when serial monitor is busy or when we cant use serial monitor?

Can you program them one at a time, with the other disconnected?

@Edgar Bonet I already tried to program one at at time with other disconnected. It worked fine when the other is disconnected and Arduino did what it was supposed to do.

Use a separate program to read the serial data. Something like putty.


text:
ESP32 light strips showing incorrect colours
I bought some individually addressable LED strips (a large reel). To keep the cost down they are WS2811 and it's one chip per 6 leds. I don't know the cheapness or LED styl makes any difference to the problem but I'm just putting it out there.
They support 24V so to be safe I'm running them at 23V. I have the data line hooked up to pin 13 of the ESP, and a ground connection to the power supply to create a common ground. I am using Alexa to control the colours. This is the code:
#include <WiFi.h>
#include <Espalexa.h>
#include <FastLED.h>
#include <Adafruit_NeoPixel.h>

FASTLED_USING_NAMESPACE

#define NUM_LEDS 120
#define LED_TYPE WS2811
#define LED_PIN 13
CRGB leds[NUM_LEDS];

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, LED_PIN, NEO_RGB + NEO_KHZ400);

#define ESPALEXA_ASYNC
Espalexa espalexa;

#define RELAY_PIN 12

boolean connectWifi();

void colorLightChanged(uint8_t brightness, uint32_t rgb);

const char* ssid = "****";
const char* password = "****";
boolean wifiConnected = false;

void setup()
{
  Serial.begin(115200);
  delay(2000);

//  FastLED.addLeds<LED_TYPE, LED_PIN>(leds, NUM_LEDS);
//
  pinMode(LED_PIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);

  digitalWrite(RELAY_PIN, HIGH);
//
//  for (int i = 0; i < NUM_LEDS ; i++) {
//    leds[i] = CRGB(0, 0, 0);
//  }
//  FastLED.show();

  strip.begin();
  strip.show();

  wifiConnected = connectWifi();

  if(wifiConnected){
    espalexa.addDevice("Lights", colorLightChanged);

    espalexa.begin();

  } else
  {
    while (1) {
      Serial.println("Cannot connect to WiFi. Please check data and reset the ESP.");
      delay(2500);
    }
  }
}

void loop()
{
   espalexa.loop();
   delay(1);
}

void colorLightChanged(uint8_t brightness, uint32_t rgb) {
  for (int i = 0; i < NUM_LEDS; i++) {
//    leds[i] = CRGB((rgb >> 16) & 0xFF, (rgb >>  8) & 0xFF, rgb & 0xFF);
//    FastLED.setBrightness(brightness);
      strip.setPixelColor(i, (rgb >> 16) & 0xFF, (rgb >>  8) & 0xFF, rgb & 0xFF);
  }
//  FastLED.show();
    strip.show();

  if(brightness == 0) { //lights off
    digitalWrite(RELAY_PIN, LOW);
  }
  else { //lights on
    digitalWrite(RELAY_PIN, HIGH);
  }

//  Serial.print("Brightness: ");
//  Serial.print(brightness);
//  Serial.print(", Red: ");
//  Serial.print((rgb >> 16) & 0xFF); //get red component
//  Serial.print(", Green: ");
//  Serial.print((rgb >>  8) & 0xFF); //get green
//  Serial.print(", Blue: ");
//  Serial.println(rgb & 0xFF); //get blue
}

boolean connectWifi(){
  boolean state = true;
  int i = 0;

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");
  Serial.println("Connecting to WiFi");

  Serial.print("Connecting...");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    if (i > 40){
      state = false; break;
    }
    i++;
  }
  Serial.println("");
  if (state){
    Serial.print("Connected to ");
    Serial.println(ssid);
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());
  }
  else {
    Serial.println("Connection failed.");
  }
  return state;
}

I've tried both Neopixel and FastLED with the same outcomes. Those outcomes are totally wrong colours:
This is supposed to be cyan except it's mostly yellow with a bit of blue.

This is supposed to be purple

And I think you get the idea. The lights strips light up with wrong colours (I've had whats supposed to be gold, be purple), blotches of colours or just make some look really similar (on Alexa, warm white to cool white look almost identical apart from a change in brightness).
I don't know what could be causing this though. I've made sure theres a common ground, I've made sure the pin on the ESP is right (i.e. just a plain output pin with no other fancy stuff), I've tried 2 different libraries and still no luck.
Could anyone help me out?
EDIT: These are these the strips I bought if it helps: https://www.superlightingled.com/65ft20m-roll-ws2811-dc24v-36ledsm-addressable-led-light-strips-digital-full-dream-color-chasing-flexible-led-strips-p-3163.html

at this point it is unclear if the problem is with alexa, or with the LED strip itself .... remove all of the alexa code ... light the whole strip one color, pause 5 seconds, light whole strip another color , and so on .... start with red, then green, then blue

I tried it without Alexa code and they work perfectly. What confuses me is there is nothing wrong with the RGB values that come from the Alexa. Red comes through as 255 0 0 purple comes through as 171 35 255 and so on. Could it be that the LED libraries don't like being run in a callback?

If it's the callback issue, try moving strip.show(); to your loop function. If that too fails, try moving everything into the loop, and have colorLightChanged only store the new values in a global (volatile) variable, that your loop uses.

Just tried putting the FastLED code in loop and using a flag to determine when to set the  colour. Unfortunately, still doesn't work. My last idea is just to try changing the colour on a different core so espalexa and fastled are totally separate. I'm not hopeful but it's worth a shot

why are you using adafruit and fastled at the same time? I don't think that will work. Also, it's much faster to use .fill() instead of setPixelColor if they are all the same color.

In the code above the fastled code is commented out. I included the neopixel library to make sure it wasn't just an issue with fastled

That strip seems to be BGR instead or RGB.
Use NEO_GRB instead in your initializer. So:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, LED_PIN, NEO_BGR + NEO_KHZ400);

I'll still try it but would that make a difference to the colours? I didn't mention it (probably should have) but all the primary colours (red, green, blue) show up correctly. If I set the strip to red, it shows red.

Giving the new information you provided, this probably won't fix it.


text:
ISP Programmer with Serial and 5v/3.3v power
I currently use a Pololu USB AVR Programmer v2.1 for programming 328p chips and I really like it. The ability to have ISP and Serial in one physical device, enumerating as two separate COM ports on the PC, the programmer powering the circuit at 3.3v, with the programmers windows GUI interface to set voltages, programming frequency and give feedback on the programming when things go wrong, is all brilliant.
However, many of my circuits either have a power requirement higher than that on the Pololu (80mA), or to much capacitance (33uF) so that the power surge on connection is too much for the Pololu and it resets.  The reset disconnects my serial debugger, disconnects the Pololu GUI, and sometimes does not come back on at all due to the startup current draw.
I am looking for suggestions for an alternative device, or way of stopping the brown out on power up?
Thanks very much
Kevin

To clarify, you are avoiding powering your programmer from the target's VCC because you don't want the programmer to re-enumerate when the target power-cycles, correct?

Hi, I want the targets VCC to be 3.3v from the programmer, so that I don't have to provide a separate power supply.  It is normally Solar powered - but that is difficult inside in the winter in the UK :)

How about, connecting a tiny battery across the 3.3v output of the Pololu.  Lets assume a 3.7v LiPo, charged to 3.3v.
When the battery is connected at 3.3v, no current will flow.
When my device to be programmed is connected it will draw a spike of current, which will start to take the Pololu below 3.3v, but then the LiPo will start supplying current and stop the Pololu voltage getting dragged down and browning out.
The LiPo will then be slightly below 3.3v, so will get a Constant Voltage charge back to 3.3v.
Two potential issues I can see:

When the Pololu is disconnected from the USB will it be being 'back powered' by the LiPo?

When in CV charge mode, the only current limiting will be internal resistance of the Pololu output / LiPo cell, probably not an issue in practice due to the voltage drop being very small.

I know it is a hack, but thoughts welcomed.
Cheers
Kev


text:
How to connect D1 mini and ATTINY85 over data wire
I’m trying to connect my D1 mini module and attiny85 USB module together over a data wire, but I don’t know how to do it.
Basically, what I want to do is have the D1 broadcast a hotspot with a web page that when a button is pressed, it sends a signal to the attiny85. The D1 is connected via power wires to the attiny85.
I have the sending signal and web server setup on the D1 but I don’t know how to let the attiny85 receive it.
If it helps, I’m using the wire.h library on the D1
(edit: sorry for inactivity, just haven’t been able to test it)

why do you need to use the ATtiny? what does it do what the D1 can't?

I’m using the attiny85 USB module to send keystrokes to a computer, but if I was using it as a microcontroller I wouldn’t use it at all.

ATTinyCore seems to come with a Wire library implementation presenting the same interface as you find in other Arduino board packages.  The damellis package doesn't, so if you've been trying to use that one, I'd suggest switching to ATTinyCore.
To get started you should be able to use the ESP8266-Arduino Wire library's Master Writer example with ATTinyCore Wire library's Slave Receiver example.  To be clear, you don't need to get them from github, they should be available in the File/Examples menu.  Because the interface is the same, you may find that it doesn't matter which board from which you take the example.
I don't know that I've ever used this Wire library in ATTinyCore; my only memory of using I2C slave no an ATTiny85 was coding it directly myself, but I expect it works fine.  I may try myself to confirm though.
On the ATTiny85 you'll be using DIP/SOIC pin 7 (PB2) for the SCL signal.  And DIP/SOIC pin 5 (PB0) for the SDA signal.
If I try it myself later I'll update this with more details.
More details
I don't have a D1 mini.  I do have this NodeMCU clone though.  According to the pin maps, the D1 mini's D1 and D2 pins are same as on the NodeMCU, that is GPIO5 an GPIO4 respectively.  I wired it together as shown here:

I've drawn some lines on the lower part of the image where the camera angle is bad.  The smaller inset images are just for showing a better angle there.  The yellow and white leads carrying I2C "Wire" data are doctored simply because they went out of frame.
Don't take the "5V" on the ISP cable breakout too literally, that line is at 3.3V (from the NodeMCU 3.3V pin).
ATTiny85 had the following code loaded onto it.  It is just the ATTinyCore slave receiver example with unnecessary comments removed and code to set the LED based on whether it receives a non-zero byte in the I2C ("Wire") transaction:
#include <Wire.h>

static const int LED_PIN = 4;
static const int SLAVE_ADDRESS = 0x08;

void setup() {
  Wire.begin(SLAVE_ADDRESS);
  Wire.onReceive(wire_receive);
  Serial.begin(9600);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {}

void wire_receive(int howMany) {
  if (Wire.available()) {
    digitalWrite(LED_PIN, Wire.read());
  }
}

The following was loaded onto the NodeMCU board.  Likewise derived from the ESP8266 Arduino Wire master-writer example.  Set the local ESP8266 led when it sends the state over to the ATTiny85.  The result is that the ATTiny85 and ESP8266 change their LEDs every 1 second together.  The NodeMCU module is wired to light the LED on a LOW, the ATTiny85 to light on a HIGH, so when one is lit the other is not.
#include <Wire.h>
#include <PolledTimeout.h>

#define SDA_PIN 4
#define SCL_PIN 5
const int16_t I2C_SLAVE_ADDRESS  = 0x08;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Wire.begin(SDA_PIN, SCL_PIN);
}

void toggle_led() {
    static bool led_state;

    led_state = !led_state;
    digitalWrite(LED_BUILTIN, led_state);
    Wire.beginTransmission(I2C_SLAVE_ADDRESS);
    Wire.write(led_state);
    Wire.endTransmission();
}

void loop() {
  using periodic = esp8266::polledTimeout::periodicMs;
  static periodic nextPing(1000);

  if (nextPing) {
    toggle_led();
  }
}


text:
EEPROM programmer works with serial monitor but not with pySerial
I'm trying to modify Ben Eater's eeprom programmer to flash a 32K eeprom, since the arduino has 32K of program data total the data wouldn't fit in the program. So I wrote a python program using pySerial to send the data in chunks of 256 bytes over serial. The arduino program works correctly when I manually send the data over the serial monitor, and the python program works correctly when I print the values to a console as a test, but when I actually run the program over serial it seems to only write zeros to the eeprom. Additionally, the Rx led on the arduino seems to be lighting up with the correct data, but like I said only zeros are written.
Here's the relevant arduino code:
void setup() {
  pinMode(SHIFT_DATA, OUTPUT);
  pinMode(SHIFT_CLK, OUTPUT);
  pinMode(SHIFT_LATCH, OUTPUT);
  digitalWrite(WRITE_EN, HIGH);
  pinMode(WRITE_EN, OUTPUT);

  Serial.begin(57600);
  dataArrPage = 0;

  //delay(1000);
  //Serial.println("Reading EEPROM");
  //printContents();

}

void loop() {
  if (Serial.available() > 0) {
    int len = Serial.readBytes(dataArr, 256);

    for (int i = 0; i < 256; i++) {
      writeEEPROM(dataArrPage + i, dataArr[i]); // writeEEPROM(address, data)
    }
    dataArrPage += 0x100;

    Serial.write('s'); //success, writing is done
  }
}

And the relevant python code:
import time
import serial
ser = serial.Serial('/dev/ttyUSB0', 57600)
time.sleep(4) # wait for arduino to initialize

filename = input("Enter file name: ")
f = open(filename, "rb")
data = f.read()

page = 0
for x in range(128): # 128 pages in 32K eeprom
    for i in range(256):
        #print(hex(data[(page * 256) + i])) # printing prints the correct values
        ser.write(data[(page * 256) + i])
    page += 1

    #wait until receive 's' from arduino
    while True:
        if ser.in_waiting > 0:
            suc = ser.read(size=1)
            if suc == b's':
                print("Success")
                break

print("Writing done")
f.close()
ser.close()

I'm a beginner so sorry if it's something obvious.

And if you wait for the Arduino to reboot and pass the bootloader after you open the serial port?

I had a delay after opening the serial port in the python code but it didn't make a difference, entering the file name takes a bit anyways. I should probably add it back in.

You should consider a two-way protocol, so Python sends something then the Arduino responds once that operation is done with a status. That way you know what is happening from both ends.

Okay, I'll try that.

I edited the code to print "Success" when the arduino is done writing the 256 bytes, however it only prints success 3 times then freezes. Would the contents of the file matter at all? It's a 32K file that's mostly zeros after some text at the beginning.

This is probably the sort of thing that would be better to work out on a chat network.  If you're going through it bit by bit there's not going to be a clear question with a clear answer.

I figured out the problem. The for loop was writing one byte at a time, which probably wasn't fast enough and caused a timeout in the arudino. The code is now:
page = 0
for x in range(128): # 128 pages in 32K eeprom
    datalst = []
    for i in range(256):
        datalst.append(data[(page * 256) + i])

    ser.write(datalst)

    #wait until receive 's' from arduino
    while True:
        if ser.in_waiting > 0:
            suc = ser.read(size=1)
            if suc == b's':
                print("Success")
                break

    page += 1

I also changed the data types in the arduino sketch to use the ones in stdint.h which solved an unrelated bug. Let me know if I should post the full code for both.

Hm, strange. Since your line runs with 57600 baud, it transfers just some 6000 bytes per second. I would think that the Python loop runs faster. -- However, if the USB-based serial interface connects directly to a USB module inside the AVR, the baudrate is not maintained.


text:
Ethernet Shield web server - Can't find the index.htm file
i've just got the EthernetShield and watched a tutorial on how to host a html page with it but i can't find my html page on the SD card.
#include<SPI.h>
#include<Ethernet.h>
#include<SD.h>

byte mac[] = {0xA8, 0x61,0x0A, 0xAE, 0x3A, 0xC4 };

EthernetServer server(80);

File webPage;

void setup() {
  Ethernet.begin(mac);
  server.begin();
  Serial.begin(9600);

  Serial.println(Ethernet.localIP());

  Serial.println("Initializing SD card...");
  if(!SD.begin(4)){
    Serial.println("ERROR - SD card initialization failed!");
    return;
  }
    Serial.println("SUCCESS - SD card initialized.");
    if(!SD.exists("index.htm")){
      Serial.println("ERROR - Can't find index.htm file!");
    }
      Serial.println("SUCCESS - Found  index.htm file.");
}

void loop() {
   EthernetClient client = server.available();
   if(client){
    boolean currentLineIsBlank = true;
    while(client.connected()){
      if(client.available()){
        char c = client.read();
        if(c == '\n' && currentLineIsBlank){
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println();

          webPage = SD.open("index.htm");
          if(webPage){
            while(webPage.available()){
              client.write(webPage.read());
            }
            webPage.close();
          }
          break;
        }
        if(c == '\n'){
          currentLineIsBlank = true;
        }
        else if(c != '\r'){
          currentLineIsBlank = false;
        }
      }
    }
    delay(1);
    client.stop();
   }
}

When i save the HTML file i can't save it with the .htm format

What you served is not 369 bytes?

Are you just confused by the mention of "Microsoft Edge"?

@timemage no its not

There are reportedly 369 bytes in the file.  So what does the file contain if not what you wanted?

@timemage the file contains only the HTML code, u can see a screenshot of my error down below , in the Answer section.

The answers you are giving don't seem terribly connected to the questions asked and I'm don't know what more I can say or ask to help you except this: Your question needs clarification.  The additional information you're providing should be edited into your question.  There's not enough information here to make me think what you're seeing is unexpected.

@timemage I'm a beginner and I can't say that I understand very well what the problem is with the file size. I simply created an html file with a simple page and then uploaded the file to the SD card. When I load the code in arduino you can also see in the picture that it does not read my file.

Hi @antisocialkid and welcome to the Arduino Stack Exchange. It would be really helpful if you could add a screenshot (or the source text) of what is inside the index.htm file on the SD card. To do this, insert the SD card into a computer and open the index.htm file in a text editor like Notepad.

Windows is hiding the extension from you.
The file you showed is either index.htm or index.html. If it's the latter, you could change the windows setting to "show extensions for know filetypes", or change the sketch so it uses index.html instead of `index.htm. I'd go with the latter, as it's the easiest.
EDIT: the SD library doesn't seem to like file extension that are longer than 3 characters. So changing the code to use "index.html" doesn't work.

I've changed the sketch but is still not working error

Did you change if(!SD.exists("index.htm")){ to if(!SD.exists("index.html")){ as well?

yes, still not working

My guess is there something weird going on with that file. How did you create it? What do you see if you right-click the file, and select properties? Especially, what does it say after "type of file"; what file extension is between the braces?

Type of file: Microsoft Edge HTML Document (.html) and I created it in Visual Studio Code. (Save as > index (with HTML extension)

Weird. The file appears fine, but somehow, the SD library can't find it on the SD card.

also the  SDcard already has the format FAT32

Maybe try it with a .txt file. I'm running out of ideas here.

finally windows let me to change the extension file to .htm and now it works !

Ahh. I think it has to do with the DOS 8.3 filename convention. It doesn't like file-extensions longer(/other) than 3.

@antisocialkid if the answer was useful to you, you should vote it up.  If it is the answer to your question, you should "accept" it.

Might be worth adding that it's probably available under its short name, which is likely INDEX~1.HTM


text:
Resolved: ESP8266 works when arduino UNO reset pin is grounded
I'm setting up PIR and esp8266 with arduino UNO.
First my esp8266 doesn't work after alot of research my esp8266 start working when I put arduino UNO reset pin to ground.
But now my arduino UNO does not run any program and I'm not able to use PIR with this wifi module.
Any help will be appreciated

Only one extra thing is that reset pin is set to GND pin.

Show how you have all of this wired together.

I've added wiring image to question please check. Only one extra thing is that reset pin is set to GND pin

Please check the specs on your ESP8266 module.  The IO pins are not 5V tolerant.  That would explain the problems you are having.  I see you are powering it from 3V3 but the Uno's GPIO pins are all 5V.

The RESET of the UNO puts the ATMega328P (the MCU of the UNO) into an electrically inert state when it is connected to GND.  It is not supposed to be running your sketch when it is being held in reset.  It is, roughly speaking, electrically disconnected from everything else on the board.  This allows you to use the UNO as though it were a USB to TTL serial cable.
If you want to be able to run a sketch on the UNO while it uses the ESP8266, you'll need to not hold reset to GND and you'll also, practically speaking, need to choose a different set of pins for communicating with it, as D0 and D1 on the UNO are the same signals used to for the ATMega328P to talk to the host and used for programming the UNO via its bootloader.  On the UNO, you'd instead need to use SoftwareSerial (or something similar) and pins other than D0 and D1.  [Update: see the original poster's own answer containing the guide they ultimately used, making use of SoftwareSerial on pins 10 and 11]
The ESP-01 can run Arduino sketches using the ESP8266 Arduino core and it may make a great deal more sense to not involve the UNO at all, and instead connect the distance sensor more or less directly to the ESP8266.

Thanks for the quick reply, can you send me any link to blog or youtube tutorial to setup it up like you said

I don't have any links for you offhand.  But you're likely to find some if you look for people using UNO together with the ESP-01.  You'll notice a lack of grounding reset, and the use of SoftwareSerial or something else to do the communication from the UNO to the ESP-01.  You should keep in mind that these parts do not run at the same voltage, so you need to be careful with interfacing them.

Ok, I tried few solutions with software serial as I remember and I got no response in my serial monitor. I'll check if can find something more similar. Thank you

If the only things connected to the UNO are PIR sensor and the ESP-01, I strongly encourage you to move the sketch code onto the ESP-01 and find a tutorial on using one of those PIR sensors directly with the ESP-01.  esp-01 and  "PIR sensor" as search terms turn up a number of probably useful articles.  If I get a look at them later to vet one, I may integrate it into the answer.

I've posted answer with link to blog that helped me resolve issue. Thank you for moving me in right direction

So, I got it working with this information on this blog
Few things, my serial.begin(115200) where as in blog its 9600
Thanks @timemage for moving me in right direction
[1]: https://medium.com/@cgrant/using-the-esp8266-wifi-module-with-arduino-uno-publishing-to-thingspeak-99fc77122e82


text:
Problem with sending IR with at ATMega328P-PU
I have a sketch that sends an IR code every second. It works fine (the correct code is received by my receiving Arduino next to it) on the Arduino but when I try to move the sketch to an ATMega328P-PU, the IR no longer sends (the serial monitor output still works).
I have used a camera to look at the IR LED and it just doesn't flash on the ATMega328 but does on the Arduino (and I have tested my LED, it does work). It uses pin 3 on the Arduino, so I use pin 5 on the ATMega328.
Are there extra components that are needed to make PWM work without the Arduino board? I am honestly stumped so any help would be appreciated. Thanks in advance.
Sketch:
#include <IRremote.h>

IRsend irsend; //Setup the IR transmitter

int codeToSend;
int team = 1;
int damage = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
    team++;
    if (team > 8) team = 1;
    damage++;
    if (damage > 99) damage = 0;

    if (damage > 9) codeToSend = (String(team) + String(damage)).toInt();
    else codeToSend = (String(team) + "0" + String(damage)).toInt();

    Serial.println("sent");
    irsend.sendNEC(codeToSend, 32);
    delay(500);
}

If I take your question literally, "no".  However, I'm guessing you actually want to know why this isn't working on a breadboard.  For that, it would be helpful to have in-focus picture(s) of your board's actual wiring, in one frame if that's possible.

I added a photo, sorry the wiring is messy, I only have small breadboards. Far left is ground, front left is 5v. You can't see but the capacitor connects the ground and 5v rows and the resistor connects pin 1 to 5v (10Kohms).

NOTE: The following comment was left on this answer (below) and indicates the principal problem the original poster was having above and beyond not having a resistor, etc.

SOLVED - my breadboard was broken on that rail. :/

Current limiting
What you have pictured looks alright for the most part with the exception of there appearing to be no current limiting resistor for the IRED.  It is possible that you've damaged the IRED by setting the pin HIGH for an extended period of time.  It is also technically possible to have damaged the AVR (or just the one pin) by doing that, though this wouldn't be my first guess.
Typical forward voltages for an IRED around around a volt.  An AVR pin's maximum rating current is 40mA.  To get proper logical levels out of it, it should be less than 20mA.  You could perhaps operate near 30mA, since you're not doing much else with the AVR's ports and you're not trying to get logic level voltages out of the pin.  For that you'd need a resistor in series with the IRED that is something like  (5V - 1V) / 0.030A, approximately 133 ohms.

Transistors
When people use IRED to make remotes, it is normal to use a transistor to offload the current requirement from the MCU.  And also to operate the IRED above its continuous operation current, closer to it's rated peak/pulse current.  Operating in the low tens of mA often only gets you a meter or so.
That arrangement might look something like the following for higher current pulses around 80mA:

Asides

I'm not able to read your reset resistor well.  If you're not, do measure it to make sure it's 10K.  If in doubt, remove it.  There is a weaker internal pullup on the AVR reset and it's usually enough.  If you wanted you could wire the reset signal over to the UNO reset pin to take advantage of the external pullup, reset switch, and DTR reset mechanism of the UNO itself.

You may want to add .1uF capacitors from your VCC and AVCC pins to ground.  You can often go without while experimenting, but when you're switching higher currents they'll become more important.

I have a bunch of those jumpers with the rounded (cylindrical) ends.  They often don't make good connections on breadboard.  You can save some trouble sometimes with "Dupont" type jumpers or just making your own out of solid 22awg hookup wire.

When I put the IRLED into my other Arduino with the same circuit and sketch set up, the IRLED works, so I don't think it's damaged. I have added a 133ohm resistor (100+33) as you said and tried again with a different 328p-pu but still no luck. The resistor on my reset is definitely 10kohm as I tested it with a multimeter

I'll look over the image some more, but I don't know what expect to find.  The fact that it's still operating over serial rules out a lot of ideas.  With respect to the current limiting, that's good to hear, because you should have that no matter what else is going on.

It would appear that digital pin 3 (pin 5 of 328) doesn't work at all without the board. I uploaded a simple led blink sketch to the MCU and that worked fine using pin 2 (pin 4 of 328), but not 3 (pin 5 of the 328). This would suggest that pin 5 of the 328 doesn't work at all, but it must do as the sketch works with the chip in the Arduino board using pin 3. This goes to both my 328 chips and boards. Any ideas?

On an official UNO PD3 doesn't go anywhere except the header.  I expect no difference on any normal clone.  It's my suspicion that if you put it back into the board it will continue to fail to work there.  If not that, then perhaps one of those jumpers is not making very good contact.

"On an official UNO PD3 doesn't go anywhere except the header." - I think you mean the pin on the Arduino doesn't go anywhere except for pin 5 on the 328?

SOLVED - my breadboard was broken on that rail. :/  Thank you so much for your time and help.

PD3 is the signal on DIP pin package no. 5, or Arduino digital pin no. 3.  So what I mean is that signal goes straight from the AVR to the header.  It is not connected to anything else on the board.


text:
What does avrdude: Device signature = 0x000000 mean? Faulty wiring? Software issue? Incorrect tutorial?
I followed this tutorial a couple of times and when I clicked on bootloader I get this error:
avrdude: Device signature = 0x000000

To see the configuration file click here.

Why do I get this error (Arduino can't communicate with chip, problem with software)?
How can I fix it?
Is something in the tutorial incorrect?

Keep in mind I use an Arduino Uno Rev. 3 and ATmega328P

There is one part of the tutorial that is incorrect - or rather missing.
When you open the serial port the Arduino resets. That includes when the serial port is opened by avrdude.
You need to prevent that from happening, so that the ArduinoISP sketch receives the serial data, not the Arduino's bootloader.
There's a number of ways of doing that:

Add a 10uF or greater capacitor between RESET and GND on the Arduino
Add a small (say 100R) resistor between RESET and 5V on the Arduino
Cut the RESET-EN trace on the underside of the Arduino

Of those my preferred method is the first: add a 10uF or greater capacitor between RESET and GND on the Arduino.

Update:
Now that you have provided photographs of your actual setup I can see that the ground wire between your Arduino and the breadboard is actually plugged into the VIN pin of the Arduino, not GND.

It already has a 10k resistor between 5V and pin 1 (on the chip)

So? That has absolutely nothing to do with the RESET pin of the Arduino.

OK! Thanks I will try again with the resistor/capacitor!

I still get the same error: avrdude:
Device signature = 0xffffff (probably .avr8x_mega)
avrdude: Yikes!  Invalid device signature.
Double check connections and try again, or use -F to override
this check.

And you did connect the capacitor to the Arduino's RESET pin, didn't you? Not the signal that goes to the RESET pin of your target ATmega?

I put a 10μf (16v) electrolytic capacitor between Arduino's RESET pin and Arduino's GND pin. I will send you a couple of pictures.

Then you may have wired something incorrectly.

These are the links to the pictures: https://photos.app.goo.gl/N5NBcmSgFeBrE6Dr7, https://photos.app.goo.gl/wKcDfGXizjdPJspw8. That's what I should do, right?

You have your GND wire plugged into VIN, not GND.

Yeah. I saw it. I put it to GND now and it worked! Thanks a lot!

Unfortunately the three prominent threads on the Arduino forum on this topic are closed, so their good but incomplete information is baked in time:

Invalid device signature error

Which references: Did I get these ArduinoISP instructions right?

Invalid Device signature = 0x000000
no clock on Atmega328p-AU

So let me add a bit more useful information in the hope it permeates.

Device signature = 0x000000

Means the MCU did not respond with a signature. There is a very thin chance that's because it reported all zeros when asked for a signature, but a much higher chance that it did not respond at all. Correct signature bytes are found here (eg. ATmega328P = 0x1E950F) and crucially, all Atmel microcontrollers have one.
Further, the error:

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.

will occur if you're using ArduinoISP to flash a target Arduino and the target is not physically connected. So it really is an "all bets are off" message that doesn't pinpoint any particular cause. To troubleshoot, checking wiring if a good first step.
Do not, on the other hand, concern yourself with the external clock signal. In contrast to some guides, the ATmega328P at least comes factory configured to use an internal RC oscillator, so even a correctly connected crystal or resonator on the XTAL pins will not show any activity until the first successful flash.

Can confirm previous answer about changing SPI clock.
I edited ArduinoISP.ino example and changed #define SPI_CLOCK (1000000 / 6) to #define SPI_CLOCK (128000/6) and after that I successfully burned bootloader to my UNO

Answer is a duplicate of other answers.

One of the reason for getting weird device signature like 0x000000/0x0000ff/0xff0000
is not having the crystal clock right.
When I tried uploading the sketch I was getting this different device signatures. I had no idea it could be clock setting because we don't generally get this option to set the clock on regular Arduino boards upload options.
I was using this Atmega328PU clone Chinese board and wasn't able to upload a sketch.
Than I tried uploading the sketch using miniCore board (where by default it was External 16MHz Clock selected). Same signature issues still.
For some reason I tried uploading with 8MHz Clock and this time the device signature was right
i.e. device signature = 0x1e950f (probably m328p)
and was able to successfully upload the sketch.
I highly recommend trying this.


text:
Reusing Digispark ATtiny85 micro-USB as 1-wire bus
I'm working on a project of my home plants irrigation/hydroponic system(not cannabis!)) just chilies and other eatables). Also I'm trying to recycle modules, wires and other projects' leftovers such as Digispark ATtiny modules. I'd to use it as a slave controller to pass some sensors' data to master-controller. (Sensors are soil pH, moisture sensor, water counter, PIR as a cat detector).
Now I'm looking for a way to reuse Digispark USB-connector(3 and 4 pins) as a communication bus. Those pins have pull-up resistors and diodes attached to, so that's why it could be difficult.
My goal is to reduce extra components count, reuse old micro-usb wires, connect digispark slave controller using existing USB connector. And optionally save the ability to program digispark via the same connector.
I'd like to use 1-wire/i2c protocols for communication, cause it would be better to connect multiple slave-devices on the same bus.
So here are a few troubles:

choose of the protocol. I2C sounds better, but the popular library TinyWireS use USI pins to communicate which are different to USB pins.
1-wire looks suitable, and it also have pullup resistors on the bus.
voltage shift on these pins
How do you think Is it possible to connect multiple 1-wire slave digispark devices on the same bus. Do I need an optocoupler or logic level convertors?

It sounds like you're describing a project.  I see two actual questions, neither of which, if answered, would seem to satisfy the whole of the thing.   What is the overarching  question?

@timemage fixed the question to be more clear!


text:
Is the EEPROM the best alternative for store non-volatile values with Arduino?
SD-cards are capable of store values even if it is turned off.
I don't know what is the time that a EEPROM can keep a value in it's memory, but of course are better than the volatile memory.
There are some others ways of store non-volatile values for arduino?
Which of these need hardware built-in and which doesn't?
Are the EEPROM the best alternative (in terms of facility, durability, and cost) for store non-volatile values when we talk about Arduinos (or even microcontrollers in general)?

the best alternative for store non-volatile values. Updated question

Do you know what is a SQL?

I mean what is the best way to store non-volatile values in the Arduino, dear

it is a language for manipulating databases ... it is kind of irrelevant to the question

So, don't is the EEPROM and the SQL used for the same thing? Store non-volatile values?

instead of getting caught up in details like a grammar nazi, try to catch the idea behind the question

you are not understanding. . one person's best may be another person's don't care ... for example, one person may only be interested in data retention... another person may be interested in write speed ... etc.etc. .... so, what is your definition of best?

So you can respond like that: If you are interested in data retention, do like this... If you are interested in write speed, thus. In this way, we can have a broad understanding of the question. I am not able to define my question more than this, because if I could, I would be likely to respond it by myself.

then the EEPROM is not suitable because it has a limited number of write cycles available before it fails

I wouldn't say alternative, it's fundamentally different. EEPROM is basically stand alone (on chip, or on board) and small. For full blown SQL you'll probably need network connection and server with SQL. Alternative for EEPROM can be FRAM (almost unlimited writes), flash (size but less writes), sd card or similar (even bigger, also limited writes).

@jsotola thanks. Now i appreciate your response.

don't is the EEPROM and the SQL used for the same thing? ... you are confusing a hardware component with software ... a comparison between EEPROM and SD card would make more sense

@KIIV I am grateful. Let me do a question. Do sd card need hardware aditional parts or no? The FRAM kind of store and the flash you said, need aditional hardware too?

@jsotola ok, i will improve the question

Usually needs few wires and maybe slot or so. But no need for full blown server and network (another computer)

Question improved.

Your question got down-voted because asking what is the "best" thing is pretty subjective. You may as well ask what is the best car to buy. If you are more specific next time you may get a better response and less argument. A more general question like "what are the advantages and disadvantages of using EEPROM?" could probably be answered with a Google search.

EEPROM on the Atmega328P (such as on the Arduino Uno) holds 1KB (1024 bytes) and has a documented write/erase cycle of 100,000 writes.
So, if your application only needs to store 1024 bytes in a non-volatile way, and you do not plan to write more than 100,000 times then that is suitable.
The sort of things I would use EEPROM for are remembering settings (eg. fan speed, oven temperature, a password for accessing WiFi, that sort of thing).
I also personally use it for "remembering" RFID card codes for access to my house. In my experience, using it for that purpose, it has never "forgotten" a code. According to the datasheet it will retain data for 100 years at 25°C.
It is convenient because you don't need any extra hardware.

Other alternatives are SPI or I2C based external EEPROM, such as NVRAM (non-volatile RAM) which would have larger capacity, but you would need to connect it. That would likely be about 5 wires and somewhere to put the chip. An example of that is Adafruit I2C FRAM Breakout.

You could use a micro-SD card, which I have used on another project to record temperature readings every 15 minutes. This has a lot more capacity than EEPROM, and then you can just take the SD card out and read it in an ordinary PC. This needs extra hardware (eg. a holder for the SD card and possibly voltage-level shifters). However you can buy that for around $20, and it is easy enough to hook up.

I don't know how SQL got into the discussion under the question, but that is a language (Structured Query Language) and not a piece of hardware.

Another alternative, if you don't particularly want portability, is to send your data along a connection to your PC, and record the data there. Conceivably WiFi could be used for that.

Speed
Speed-wise, I would say EEPROM is the fastest because it is natively inside the chip. Other alternatives required sending messages along wires (I2C, SPI, or maybe USB) to somewhere else and that takes time.
Writing is slower than reading, because writing involves using electricity to make a chemical change in the chip (turning a 1-bit into a 0-bit) but it is still quite fast.

Try FRAM either SPI or I2C, read and writes in the billions. 32K x 8. Here is a link: https://learn.adafruit.com/adafruit-i2c-fram-breakout/wiring-and-test

@Gil Nice. Easy to use and ridiculously cheap. I might order myself one ... or a few. :)
My only problem with it would be that you would need to fiddle around to get the data off it (if that was a requirement). Using an SD card makes that part simpler.

It works like external EEPROM but no delays for read or write. You can do one location at a time if wanted. In general, ferroelectric-based memory technologies (FeRAM, FeFET, and FTJ) exhibit fast write/read speed, long retention, high endurance, and low write energy consumption.