text:
Problems uploading arduino zero bootloader to atsamd21g18a
I am trying to upload the arduino zero bootloader (https://github.com/arduino/ArduinoCore-samd/tree/master/bootloaders/zero) to an atsamd21g18 breakout board that I made. The breakout has a 32KHz oscillator hooked to pins 1 and 2 (with 22pF caps). I have successfully done this twice before with two other atsamd21g18's, Atmel Studio, and an Atmel ICE as the programmer. These are the steps I followed the first two times:

Create a new GCC C executable project in Atmel Studio and chose ATSAMD21G18A as the device
Go to Tools->Device Programming, chose Atmel-ICE as tool, and SWD as interface
Go to Fuses, set USER_WORD_0.NVMCTRL_BOOTPROT to 0 Bytes, and hit Program
Go to Memories, select the file ArduinoCore-samd-master\bootloaders\zero\samd21_sam_ba.bin under the Flash option, and hit Program
Go back to Fuses, set USER_WORD_0.NVMCTRL_BOOTPRT to 8192 Bytes and hit Program

Then, I went to the Arduino IDE and was able to upload any sketches with Arduino Zero (programming port) chosen as the board and Atmel SAM-ICE as the programmer.
I have followed these same steps with the third samd21 chip. Eventually, all of the commands will go through. About 30% of the time when I click Program (in steps 2-5) I will get one of two errors:
Could not activate interface
Unable to enter programming mode. Verify device selection, interface settings, target power, security bit, and connections to the target device.
or
Erasing device failed.
However, if I just retry clicking Program it will not give any errors.
After following those steps with no errors in Atmel Studio, I go to the Arduino IDE and try uploading a basic blink sketch (with the same board and programmer selection as before), and the upload goes through (it says Done Uploading). However, the code does not execute. This is the code I am trying to upload:
const int ledPin =  6;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

This is the output I get after uploading the code:
Sketch uses 11444 bytes (4%) of program storage space. Maximum is 262144 bytes.
Global variables use 2188 bytes (6%) of dynamic memory, leaving 30580 bytes for local variables. Maximum is 32768 bytes.
Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:36)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0000060c msp: 0x20007ffc
** Programming Started **
auto erase enabled
wrote 11520 bytes from file C:\Users\Michaela\AppData\Local\Temp\arduino_build_379254/blinky_samd21.ino.bin in 1.021138s (11.017 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x00000694 msp: 0x20007fdc
Error: error executing cortex_m crc algorithm
verified 11444 bytes in 0.999887s (11.177 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked

I have tried switching out the oscillator and led, uploading the bootloader and arduino sketch with and without the oscillator, simply hitting the Burn Bootloader command from the Arduino IDE, and even tried using openocd directly in the command line.
I do not believe this is an error with the specific samd21 chip I am using, because before I started messing with the bootloader, I uploaded a C sketch from Atmel Studio to blink the led, and it worked fine.
If anyone has any insight as to what could be going wrong, I would greatly appreciate it!

is the LED on the right pin?

I believe so. It is on pin 29 of the samd, which correlates to pin 6 in arduino.


text:
Arduino UNO R3 not detected by Arduino Create Agent
So I just got my Arduino Uno R3 and tried to use it with Arduino Web IDE. I installed (and reinstalled) Arduino Create Agent and was expecting it autodetect my board, but it did not happen. Below is a picture of my board link. One light is solid and the other is flashing. In device manager I see USB serial with exclamation mark. Do I need to installed any drivers? This page says that I do not need to:
getting started
Any thoughts?
P.S. I also openned debug console, but there is nothing useful, it keeps scrolling: Network Port and Serial Port.
P.P.S. I tried two different USB cables, still no luck
P.P.P.S. I installed desktop IDE, selected Arduino Uno and tried to upload, but got back error message:
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino Uno"

Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.

Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

Serial port not selected.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

In device manager I see USB serial with exclamation mark ... what does the exclamation mark mean?

Install driver for the CH340 USB chip on your Uno

I never used the Web IDE, but can you find a "Serial port" setting anywhere? The message Serial port not selected indicates that it does not know which port to use. Since you could have connected more than one Arduino, you have to tell it which serial port it should use (typically COM3 or COM4)

@PMF How can I tell it which port to use?

@Juraj Thank you, but how can I install it on Uno if I cannot connect it to computer?

@user1700890 If the port is visible in device manager, it is shown there. You should see something like "USB Serial CH340 (COM4)".

Thank you, All! Indeed, it looks like I need to install CH340 USB driver on my Windows 10. I tried my Arduino with Ubuntu and it worked almost perfectly. Too bad Windows comes without this driver.

source: Stack Exchange

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

sort: votes


text:
Why float and not 16-bit Integer? Mpu6050 with atmega328P
I've been trying to follow this example code for interfacing my atmega328P with Mpu6050:
https://www.instructables.com/Accelerometer-MPU-6050-Communication-With-AVR-MCU/
And was wondering a couple of things. First of all, the sensors on an MPU6050 are 16-bit, which means that each sensor value such as Ax, Ay etc. are 2 byte each (8-bit + 8-bit = 16-bit = 2 bytes).
The code itself reads from the following line when obtaining the values: AcX = Wire.read()<<8 | Wire.read(); where the MSB (8-bit) are first read, and then the LSB (8-bit); which gives us 2 bytes.
So what I don't understand is why he uses float values for storing the sensor-data and not a 16-bit int? Since Floats are 4 byte long; won't that just add a bunch of zeros to the obtained 2 bytes?

In your second question, what do you mean by "data lost"? Is the information transferred with its full-precision?

The code snipped you show seems to have been written by someone who doesn't know what they are doing. Do not pay too much attention to it.

In the instructables code he's using a float because he wants to scale the value to a range of ±2g. The values the accelerometer gives are not the actual values but, like the Arduino's ADC, a representation of the value using a range.  By dividing that representation by 16384 you get the actual G value, which is a decimal value.
That value can be more useful than the raw data.
As for that other snippet of code you provide, it cannot work. Not only does it use global variables that don't exist, but it returns a value from a void function which cannot happen. I don't know quite what it hopes to achieve.

Floats aren't that simple. The conversion to float happens at the moment of division. The bytewise combining is done in an int. It can't be done in a float because a float doesn't represent the value in that kind of way. If you then assign a float to a byte it will be a byte and any decimal portion will be discarded.

We can't know this writer's reasons, but a typical reason why someone might use floats vs. ints is that they prefer not to manage the binary-point location and any possible overflows during the following calculations. Instead, they are willing to accept the tradeoff of execution-time vs. programming time, and the increased memory requirements (both RAM and Flash) of letting the floating-point library do it for them.
Update:
Or, as implied elsewhere, the programmer doesn't know how to calculate with integer arithmetic (which to be fair, is a little more complicated than just writing out the formula).

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


text:
receives 0 0 instead of "hello"
I receive the following:
09:27:10.618 -> 0 0
09:27:12.589 -> 0 0
09:27:14.616 -> 0 0
09:27:16.622 -> 0 0
09:27:18.576 -> 0 0
09:27:20.577 -> 0 0
09:27:22.583 -> 0 0
09:27:24.606 -> 0 0
09:27:26.571 -> 0 0
09:27:28.612 -> 0 0
09:27:30.585 -> 0 0
09:27:32.582 -> 0 0
09:27:34.564 -> 0 0
09:27:36.563 -> 0 0
09:27:38.587 -> 0 0

When I use the following codes:
For sending:
#include <SPI.h>
#include <SoftwareSerial.h>
SoftwareSerial Serial1(0, 1);
char mystr[6] = "Hello"; //String data

void setup() {
  // Begin the Serial at 9600 Baud
  Serial1.begin(9600);
}

void loop() {
  Serial1.write(mystr,6); //Write the serial data
  delay(1000);
}

For receiving:
    char mystr[10]; //Initialized variable to store recieved data

void setup() {
  // Begin the Serial at 9600 Baud
  Serial.begin(9600);
}

void loop() {
  Serial.readBytes(mystr,6); //Read the serial data and store in var
  Serial.println(mystr); //Print data on Serial Monitor
  delay(1000);
}

Why don't I get my hello string?
NOTE: When I changed to Serial1 for the receiver code I now receive nothing. Not sure why it doesn't work.

pins 0 and 1 are hardwareserial. don't use them with SoftwareSerial. you have to terminate the buffer with 0 to use it with print

I want to use it between my rx/tx from a custom made circuit based on nano board to my adafruit feather m0. The feather supports serial1, the other board does not; yet I want to send the message on a hardware level, how would I do this without softwareSerial? As Serial1 won't work on its own as its "not declared in scope". When you say terminate the buffer with 0, should i do "Hello0"?

why not use Serial if you don't use it for USB? not '0', but 0. int l = Serial.readBytes(buff, len); buff[l] = 0;

The Receiver log looks like some SerialMonitor output, which receives via USB. The text to report there should come from feather's Serial1 ? I'd guess on the feather you should do if (Serial1.available()) Serial.write(Serial1.read());


text:
Attiny85 uploading error
I am getting an error while trying to upload programs to the Attiny85 through a USBTinyISP programmer, found here. Unfortunately, it isn't working. Following this tutorial for connecting the board and this tutorial for programming it with the Arduino IDE. My code is:
#include <SoftwareSerial.h>

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

A picture of my setup, which I checked at least 10 times:

However, I get this error message:
avrdude: Version 6.3, compiled on Jun 22 2016 at 16:05:21
     Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

     Using Port                    : usb
     Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATtiny85
         Chip Erase delay              : 400000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
       flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

     Programmer Type : USBtiny
     Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

An error occurred while uploading the sketch
avrdude done.  Thank you.

Can someone please help me to fix this problem?
Thank you.
P.S.: On a website that talked about this error message and a similar programmer said to take out a jumper. I took out the only jumper on the programmer and it did not affect the error message.
UPDATE:
I changed the support from "attiny" by David 0 Mellis to "ATTinyCore" by SpenceKonde. Here is a screenshot of my tools menu:

Now I get a different error:
    avrdude: Version 6.3, compiled on Jun 22 2016 at 16:05:21
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\loydn\Documents\Arduino\hardware\ATTinyCore-master\avr/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : arduino
         Overriding Baud Rate          : 2400
         Setting bit clk period        : 5.0
avrdude: ser_open(): can't open device "\\.\COM3": The system cannot find the file specified.

avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

FIX!!!:
It turns out that it was a problem with the programmer. By connecting the Attiny85 to the 10-pin header instead of the 6-pin one, it was able to upload successfully.

Look at the last lines of the output, and do what it says Double check connections and try again, also it would be preferable to not connect anything to certain pins on your board.
Please add your code used.

The code is a simple serial sketch. Also, I am not connecting anything to the chip.

Answers should be posted as answers, not as part of the question :) Glad you worked it out, though. Unrelated, but there's no way to understand what your setup is from that picture. Consider using Fritzing or even a hand-drawn schematic instead. I just see a fuzzy pile of wires and a chip in a breadboard.


text:
Math on analog read wrong result
I'm trying to execute a math of analog read but I get some weird result.. I searched about int and floats but didn't understand..
My code is :
#include <SevSeg.h>

SevSeg sevSeg;

int bitsChange = analogRead(A0) ;
float fuel = (923 - bitsChange) * 0.121065375;
sevSeg.setNumber(round(fuel));

Assuming bitsChange = 683, so fuel has to be after rounding 29, what I get is 39!!!!
I want to know why I get this result to learn about it..

rather than assuming, set it and see for yourself...

I already set it and tried several time with other values, I get each time a wrong result, also tried to declare float and int inside the math but didn't get it solved... That's why I want to understand as I tried several times and failed to get it.

Try setting the value of bitsChange to 683 and printing the value of fuel to the serial port. You will probably see that it's exactly what it should be (i.e. the output is 29.06). Maybe there's something wrong with the setup of your seven segment display (i.e. displaced a segment)?

why are you making an assumption about the value of analogRead(A0) ... you have no code that verifies the assumption ... please use int bitsChange = 683; instead

jsotola, yes I did that and I get the correct result (29.06)..but when I let the analog read the input (3.32 Volts) which means 683 bits of the 1023 the result becomes 39!!

StarCat, I have checked the 7 segment display pins/setup visually and by passing random numbers through setNumber().. it's not the problem..

If you do Serial.println(bitsChange) after setting int bitsChange = analogRead(A0) what result do you see on the serial monitor?

@luker, both Serial.println() & setNumber() show 683 on serial monitor and 7 segment display.. even using (923 - bitsChange) shows the correct result (240), but once I use (*0.121065375) the math is not correct, there is something about this decimal value I cannot understand!!

Why does the decimal need to be so much precise? Can you try typecasting bitchange  Change to float? And also 923 to 923.0

@ArduinoFan, not need to be that precise (0.1211 is enough) but also I used 0.121 & getting the same wrong result, I tried also (bitsChange - 923) instead of +923!!! By saying "typecasting" you mean declaring bitsChange as a float? (if you mean that I declared it float and the same error)... I'm going crazy after trying all available solutions.

When I make the math (923 - bitsChange) * 2.0, the result is 480 which is correct, trying * 1.0, the result is 240, again correct... Once I use * 0.1 the result get wrong!!!! That's why I considered the issue is in the decimal value.


text:
Arduino Uno R3 stops executing code, when trying to instantiate multiple HX711 objects
This is my first time asking something on this platform, so if form or anything else is off, please feel free to point out things about how I could refine it and ask more concisely in the future.
I'm trying to develop an orthosis, which uses 4 load cells (full-bridge type) and 4 HX711 load cell amplifiers to inform patients via an app when they exceed their prescribed weight limit.
I have test code to calibrate the load cells and the code for the project itself. On the same Arduino, with the same components connected the test code, which only instantiates 4 HX711 objects and reads them after calibration, works fine. The full-blown project code uses exactly the same lines as well as the same hardware setup, but after the 2nd HX711 is instantiated I get no further Serial output and for all I can tell without a debugging jig, it looks like the Arduino stops executing code. If I try running the project code with only two HX711 objects (leaving the others physically connected, but commenting out the respective lines) the code works just fine.
So far I tried measuring RAM consumption, the Arduino should have 2048 bytes available, of which my project code seems to use 1483 bytes. My sensor test code uses 276 bytes, which means that technically I shouldn't be able to run out of memory. I also tried using another Arduino as a power source for the HX711 modules, just in case that the entire setup is asking for too much from a single Arduino - had no luck with that either. I would be really thankful for any pointers in the right direction since I can't figure it out on my own.
I'm using the following library for my HX711 modules: https://github.com/bogde/HX711
Project code (stops working after line 126):
#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>
#include "DHT.h"
#include "RTClib.h"
#include "HX711.h"

#define DHTPIN (uint8_t) 8
#define DHTTYPE DHT11
#define LED (uint8_t) 5
#define BUZZER (uint8_t) 9
#define BAUD 9600
#define NUM_CHARS (byte) 32
#define CHIP_SELECT (uint8_t) 10
#define SENSOR1_DATA (uint8_t) A0
#define SENSOR2_DATA (uint8_t) A2
#define SENSOR3_DATA (uint8_t) A4
#define SENSOR4_DATA (uint8_t) 7
#define SENSOR1_SCK (uint8_t) A1
#define SENSOR2_SCK (uint8_t) A3
#define SENSOR3_SCK (uint8_t) A5
#define SENSOR4_SCK (uint8_t) 6
#define TEST_DURATION 3000
#define NOT_CONNECTED 0
#define LIVE_VIEW 1
#define SETTINGS 2

// Constants
const int CHAR_SIZE = sizeof(char);

// Hardware interface settings
SoftwareSerial btSerial(2, 3);
RTC_DS1307 rtc;
DHT dht(DHTPIN, DHTTYPE);

HX711 SENSOR1;
HX711 SENSOR2;
HX711 SENSOR3;
HX711 SENSOR4;

// Hardware status & settings
boolean ledEnabled = true;
boolean isLedOn = false;
boolean buzzerEnabled = true;
boolean isBuzzerOn = false;
boolean error = false;

float threshold1 = 0.0f;
float threshold2 = 0.0f;
float threshold3 = 0.0f;
float threshold4 = 0.0f;

// Hardware testing
boolean ledTestinProgress = false;
unsigned long ledTestStart = 0;
boolean buzzerTestinProgress = false;
unsigned long buzzerTestStart = 0;

// Modes
int8_t mode = 0;

// Bluetooth
char data[NUM_CHARS];
boolean newData = false;

void receive();
void processMessage();
void testLED();
void testBuzzer();
void loadSettings();
void saveSettings();

extern void* __bss_end;
extern void* __brkval;

int get_free_memory()
{
  int free_memory;

  if((int)__brkval == 0)
    free_memory = ((int)&free_memory) - ((int)&__bss_end);
  else
    free_memory = ((int)&free_memory) - ((int)__brkval);

  return free_memory;
}

void setup() {
    pinMode(LED, OUTPUT);
    pinMode(BUZZER, OUTPUT);
    Serial.begin(BAUD);
    rtc.begin();
    if (!SD.begin(CHIP_SELECT)) {
        Serial.println(F("ERROR: SD init failed."));
        error = true;
    } else {
        loadSettings();

        Serial.println(F("SD initialized."));
        Serial.println(F("Settings: "));
        Serial.print(F("LED: "));
        Serial.println(ledEnabled);
        Serial.print(F("Buzzer: "));
        Serial.println(buzzerEnabled);
        Serial.print(F("Threshold 1: "));
        Serial.println(threshold1);
        Serial.print(F("Threshold 2: "));
        Serial.println(threshold2);
        Serial.print(F("Threshold 3: "));
        Serial.println(threshold3);
        Serial.print(F("Threshold 4: "));
        Serial.println(threshold4);

    }

    dht.begin();

    SENSOR1.begin(SENSOR1_DATA, SENSOR1_SCK);
    SENSOR1.set_scale(-63.f);
    SENSOR1.tare();
    Serial.println(F("Sensor 1 initialized."));

    SENSOR2.begin(SENSOR2_DATA, SENSOR2_SCK);
    SENSOR2.set_scale(-58.f);
    SENSOR2.tare();
    Serial.println(F("Sensor 2 initialized."));

    SENSOR3.begin(SENSOR3_DATA, SENSOR3_SCK);
    SENSOR3.set_scale(-50.f);
    SENSOR3.tare();
    Serial.println(F("Sensor 3 initialized."));

    SENSOR4.begin(SENSOR4_DATA, SENSOR4_SCK);
    SENSOR4.set_scale(-46.f);
    SENSOR4.tare();
    Serial.println(F("Sensor 4 initialized."));

    btSerial.begin(BAUD);
}

void loop() {
    if (!error) {
        receive();
        processMessage();

        DateTime now = rtc.now();
        float sensor1 = SENSOR1.get_units() / 1000;
        float sensor2 = SENSOR2.get_units() / 1000;
        float sensor3 = SENSOR3.get_units() / 1000;
        float sensor4 = SENSOR4.get_units() / 1000;

        Serial.print(F("Sensor 1: "));
        Serial.println(sensor1);
        Serial.print(F("Sensor 2: "));
        Serial.println(sensor2);
        Serial.print(F("Sensor 3: "));
        Serial.println(sensor3);
        Serial.print(F("Sensor 4: "));
        Serial.println(sensor4);

        if (isnan(sensor1) || isnan(sensor2) || isnan(sensor3) || isnan(sensor4)) return;

        if (!buzzerTestinProgress && !ledTestinProgress) {
            if (threshold1 > 0 && sensor1 > threshold1 ||
                threshold2 > 0 && sensor2 > threshold2 ||
                threshold3 > 0 && sensor3 > threshold3 ||
                threshold4 > 0 && sensor4 > threshold4) {
                if (buzzerEnabled)
                {
                    tone(BUZZER, 1000);
                    isBuzzerOn = true;
                }
                if (ledEnabled) {
                    digitalWrite(LED, HIGH);
                    isLedOn = true;
                }
            } else {
                if (isBuzzerOn) {
                    noTone(BUZZER);
                    isBuzzerOn = false;
                }

                if (isLedOn) {
                    digitalWrite(LED, LOW);
                    isLedOn = false;
                }
            }
        }

        if (mode == LIVE_VIEW) {
            btSerial.print(F("<"));
            btSerial.print(F("M;"));
            btSerial.print(now.unixtime());
            btSerial.print(F(";"));
            if (threshold1 > -1.0f) btSerial.print(sensor1);
            else btSerial.print(-1.0f);
            btSerial.print(F(";"));
            if (threshold2 > -1.0f) btSerial.print(sensor2);
            else btSerial.print(-1.0f);
            btSerial.print(F(";"));
            if (threshold3 > -1.0f) btSerial.print(sensor3);
            else btSerial.print(-1.0f);
            btSerial.print(F(";"));
            if (threshold4 > -1.0f) btSerial.print(sensor4);
            else btSerial.print(-1.0f);
            btSerial.println(F(">"));
        }

        if (ledTestinProgress && ((millis() - ledTestStart >= TEST_DURATION))) {
            ledTestStart = 0;
            ledTestinProgress = false;
            digitalWrite(LED, LOW);
        }

        if (buzzerTestinProgress && ((millis() - buzzerTestStart >= TEST_DURATION))) {
            buzzerTestStart = 0;
            buzzerTestinProgress = false;
            noTone(BUZZER);
        }

        delay(250);
    } else {
        tone(BUZZER, 1000);
        digitalWrite(LED, HIGH);
        delay(1000);
        noTone(BUZZER);
        digitalWrite(LED, LOW);
        delay(1000);
    }

    Serial.print(F("Free RAM: "));
    Serial.println(get_free_memory());
}

// Receive a Bluetooth message from the companion app
// Valid messages are encapsulated within '<' and '>' to ensure that the whole message is received.
void receive() {
    static boolean receiving = false;
    static byte index = 0;
    char startMarker = '<';
    char endMarker = '>';
    char rc;

    while (btSerial.available() > 0 && !newData) {
        rc = btSerial.read();
        delay(10);

        if (receiving) {
            if (rc != endMarker) {
                data[index] = rc;
                index++;

                if (index >= NUM_CHARS) {
                    index = NUM_CHARS - 1;
                }
            } else {
                data[index] = '\0';
                receiving = false;
                index = 0;
                newData = true;
            }
        } else if (rc == startMarker) {
            receiving = true;
        }
    }
}

// Processes a received message based on length and content
void processMessage() {
    if (newData) {
        int dataLength = strlen(data);

        Serial.println(data);

        if (dataLength == 1) {
            switch (data[0]) {
                case 'l': mode = LIVE_VIEW;
                break;
                case 's': {
                    mode = SETTINGS;
                    btSerial.print(F("<S;"));
                    btSerial.print(ledEnabled);
                    btSerial.print(F(";"));
                    btSerial.print(buzzerEnabled);
                    btSerial.print(F(";"));
                    btSerial.print(threshold1);
                    btSerial.print(F(";"));
                    btSerial.print(threshold2);
                    btSerial.print(F(";"));
                    btSerial.print(threshold3);
                    btSerial.print(F(";"));
                    btSerial.print(threshold4);
                    btSerial.println(F(">"));
                }
                break;
                case 'H': btSerial.println(F("<W>"));
            }
        } else if (dataLength == 2) {
            if (strcmp(data, "LT") == 0) testLED();
            if (strcmp(data, "BT") == 0) testBuzzer();
        } else {
            char* token = strtok(data, ";");
            int count = 0;

            if (strcmp(token, "S") == 0) {
                while (token != NULL) {
                    token = strtok(NULL, ";");
                    if (count == 0) ledEnabled = atoi(token);
                    if (count == 1) buzzerEnabled = atoi(token);
                    if (count == 2) threshold1 = atof(token);
                    if (count == 3) threshold2 = atof(token);
                    if (count == 4) threshold3 = atof(token);
                    if (count == 5) threshold4 = atof(token);
                    count++;
                }

                saveSettings();
            }
        }

        newData = false;
    }
}

// Initiate an LED test
void testLED() {
    ledTestStart = millis();
    ledTestinProgress = true;
    digitalWrite(LED, HIGH);
}

// Initiate a buzzer test
void testBuzzer() {
    buzzerTestStart = millis();
    buzzerTestinProgress = true;
    tone(BUZZER, 1000);
}

// Load settings from SD card
void loadSettings() {
    File settingsFile = SD.open("settings.txt", FILE_READ);

    if (settingsFile) {

        char settings[10];
        int index = 0;

        while (settingsFile.available()) {
            settings[index] = settingsFile.read();
            index++;
        }

        settingsFile.close();
        settings[index] = '\0';

        int count = 0;

        char* token = strtok(settings, ";");
        ledEnabled = atoi(token);

        while (token != NULL) {
            token = strtok(NULL, ";");
            if (count == 0) buzzerEnabled = atoi(token);
            if (count == 1) threshold1 = atof(token);
            if (count == 2) threshold2 = atof(token);
            if (count == 3) threshold3 = atof(token);
            if (count == 4) threshold4 = atof(token);
            count++;
        }
    } else {
        Serial.println(F("ERROR: Reading settings failed."));
        error = true;
    }
}

// Save settings to SD card
void saveSettings() {
    SD.remove("settings.txt");

    File settingsFile = SD.open("settings.txt", FILE_WRITE);
    if (settingsFile) {
        settingsFile.print(ledEnabled);
        settingsFile.print(";");
        settingsFile.print(buzzerEnabled);
        settingsFile.print(";");
        settingsFile.print(threshold1);
        settingsFile.print(";");
        settingsFile.print(threshold2);
        settingsFile.print(";");
        settingsFile.print(threshold3);
        settingsFile.print(";");
        settingsFile.print(threshold4);
        settingsFile.println(";");

        settingsFile.close();
    } else {
        Serial.println(F("ERROR: Saving settings failed."));
        error = true;
    }
}

Sensor test code (working flawlessly with the same hardware setup):
#include "HX711.h"

#define SENSOR1_DATA (uint8_t) A0
#define SENSOR2_DATA (uint8_t) A2
#define SENSOR3_DATA (uint8_t) A4
#define SENSOR4_DATA (uint8_t) 7
#define SENSOR1_SCK (uint8_t) A1
#define SENSOR2_SCK (uint8_t) A3
#define SENSOR3_SCK (uint8_t) A5
#define SENSOR4_SCK (uint8_t) 6

extern void* __bss_end;
extern void* __brkval;

HX711 SENSOR1;
HX711 SENSOR2;
HX711 SENSOR3;
HX711 SENSOR4;

int get_free_memory()
{
  int free_memory;

  if((int) __brkval == 0)
    free_memory = ((int)&free_memory) - ((int)&__bss_end);
  else
    free_memory = ((int)&free_memory) - ((int)__brkval);

  return free_memory;
}

void setup() {
    Serial.begin(9600);
    Serial.println(F("Sensor Test"));

    SENSOR1.begin(SENSOR1_DATA, SENSOR1_SCK);
    SENSOR1.set_scale(-63.f);
    SENSOR1.tare();
    Serial.println(F("Sensor 1 initialized."));

    SENSOR2.begin(SENSOR2_DATA, SENSOR2_SCK);
    SENSOR2.set_scale(-58.f);
    SENSOR2.tare();
    Serial.println(F("Sensor 2 initialized."));

    SENSOR3.begin(SENSOR3_DATA, SENSOR3_SCK);
    SENSOR3.set_scale(-50.f);
    SENSOR3.tare();
    Serial.println(F("Sensor 3 initialized."));

    SENSOR4.begin(SENSOR4_DATA, SENSOR4_SCK);
    SENSOR4.set_scale(-46.f);
    SENSOR4.tare();
    Serial.println(F("Sensor 4 initialized."));
}

void loop() {
  Serial.print(F("S1: "));
  Serial.print(SENSOR1.get_units(), 1);
  Serial.print(F(" | S2: "));
  Serial.print(SENSOR2.get_units(), 1);
  Serial.print(F(" | S3: "));
  Serial.print(SENSOR3.get_units(), 1);
  Serial.print(F(" | S4: "));
  Serial.println(SENSOR4.get_units(), 1);
  Serial.print(F("Free RAM: "));
  Serial.println(get_free_memory());
}

Wiring diagram (Fritzing):
Changelog:

Code is now embedded in the question.

If the code is important to the question, it should be brought into the question.  That said, it's already better than most first-questions here.

comment out lines 118-121 ... see if it crashes in a different place

@jsotola Interestingly enough it still crashes at the same line, which is unexpected. I figured it would crash after Sensor 3 now, basically shifting the problem back.

try changing all four set_scale to -63

maybe something is wrong with sensor 3 ... move the four lines of sensor3 code to before the sensor1 code

@jsotola changing the calibration values did nothing, but I tried a few permutations of initializing the sensors.
1 - 2 - 4 - 3: 1, 2, 4 init 3 not showing
3 - 1- 2 - 4: No init output at all
4 - 2 - 1 - 3: 4, 2, 1 init 3 not showing
I think you may be right about the 3rd sensor, but this begs the question: Why is it behaving itself in the test code and just acting up in the project code itself? I will need to investigate this weird behaviour.

I wonder if you are not running out of stack / heap RAM.  You might try a Arduino platform with a processor which has more (RAM) memory (before pulling all your hair out).  Do you need to measure weight fast?  You may want to try to only construct 2 instances of the scale measurement class at a time.  Construct 2, measure 2, destroy them the repeat connecting to the other 2 sensors.   Then start all over again.  Every class instantiation uses the same program code.  But you use up a block of RAM to hold data from each instantiation.  Welcome to C++ programming.

Why is it behaving itself in the test code and just acting up in the project code itself?
...so, what is the difference between the "test code" and the "project code"?

After some digging I found that the offensive line is SENSOR3.tare();. The Arduino won't get past that one.
The app is expecting the data as close to real-time as possible and we already have some latency thanks to the Bluetooth connection.  I was also suspecting a memory shortage, but if those memory test codes floating around every Arduino forum are somewhat accurate, I should be in the clear.

swap sensor 1 and sensor 3 pin definitions

Now sensor 3 is working and 1 is acting up, again stuck at the tare() call. Sounds like you are thinking about a hardware problem?

now swap only either the DATA or SCK pins ... sounds like A4 or A5 is being interfered with ... maybe one of the libraries uses it ....... or try just reversing the pins for sensor 3

A4 & A5 are the same pins as SCL/SDA on the Uno R3. The RTC and sensor are hooked up directly to the same pins.

You guys are geniuses, I would have never figured that out!
Sensor 3 is now using A5 and 4 instead is working perfectly.
Thank you so much for your time and help!

Maybe a bit late, but I notice you use a DHT11 (humidity and temperature sensor) library, initialize a DHT11 sensor on pin 8 but never read or use the sensor in your code. I think it's better to remove it from the code.

You'll need to use a library that support multiple HX711's. The HX711-multi library by compugician has worked great for me.

The main difference this library introduces is the ability to sample multiple HX711 units simultaneously. It is optimized for intoducing minimal (effectively zero) overhead.

If I have seen this correctly, you are currently only measuring the memory requirement in the loop().
To find out how much memory your code is using you should measure the memory consumption in any function which is memory hungry. You should call this line in all functions that are likely to put a heavy load on the heap.
freeRAM = min(freeRAM, get_free_memory());

freeRAM is a global defined int with an initial value of 2048 (or what the RAM size is).
It is not enough to measure the memory usage only in loop(), because every function uses the heap during a call and frees the memory afterwards if variables not static.

I don't know why someone voted this down, I was about to suggest the same thing. In particular saveSettings which instantiates a File object may use a lot of RAM. You don't have a lot in reserve.


text:
Cannot instantiate SLIPSerial object used in OSC/SLIPSerial classes for Arduino
Hey I'm trying to test out the CMAT/OSC library for Arduino and just want to get up and running sending SLIP encoded OSC messages. I've been able to observe the typical Serial monitor when sending OSC Messages that way, but I cannot seem to get the example code to compile:

    #include <SLIPEncodedSerial.h>
    #include <OSCData.h>
    #include <OSCBundle.h>
    #include <OSCBoards.h>
    #include <OSCTiming.h>
    #include <OSCMessage.h>
    #include <OSCMatch.h>
    #include <SLIPEncodedUSBSerial.h>

    SLIPEncodedUSBSerial SLIPSerial( thisBoardsSerialUSB );
    // SLIPEncodedSerial SLIPSerial(Serial);

    void setup() {
      //begin SLIPSerial just like Serial
      SLIPSerial.begin(9600);   // set this as high as you can reliably run on your platform
    }

    void loop(){
      //the message wants an OSC address as first argument
      OSCMessage msg("/address");
      msg.add("Hello World\n");
    ;

      SLIPSerial.beginPacket();
      msg.send(SLIPSerial); // send the bytes to the SLIP stream
      SLIPSerial.endPacket(); // mark the end of the OSC Packet
      msg.empty(); // free space occupied by message
      delay(20);
    }

Furthermore this is the output error I see:
error: 'SLIPEncodedUSBSerial' does not name a type; did you mean 'SLIPEncodedUSBSerial_h'?
   10 | SLIPEncodedUSBSerial SLIPSerial( thisBoardsSerialUSB );
      | ^~~~~~~~~~~~~~~~~~~~
      | SLIPEncodedUSBSerial_h
exit status 1
'SLIPEncodedUSBSerial' does not name a type; did you mean 'SLIPEncodedUSBSerial_h'?

Could someone lend some clarity on what "thisBoardsSerialUSB" and "Serial" are in this context? I thought that the SLIPEncodedSerial / SLIPEncodedUSBSerial constructors simply take a reference. This might be trivial, but I am not sure how to properly instantiate these classes within the Arduino IDE.
Cheers!

What board are you compiling for?

thisBoardsSerialUSB is merely a placeholder for whatever the USB serial connection is for your board. Some have it as Serial, some USBSerial. It's up to you to put the right thing in.

there is #if (defined(TEENSYDUINO) && defined(USB_SERIAL)) || (!defined(TEENSYDUINO) && defined(__AVR_ATmega32U4__)) || defined(__SAM3X8E__) || (defined(_USB) && defined(_USE_USB_FOR_SERIAL_))  || defined(_SAMD21_) || (defined(__PIC32MX__) || defined(__PIC32MZ__))

@Majenko Ah okay! I read into the example code a bit too literally! the board I'd like to use is the Adafruit Metro M0 Express, which uses a ATSAMD21G18 chip (an ARM Cortex M0+)

SAMD21 should work: || defined(_SAMD21_)

@Juraj Yeah I had originally thought so as well! I found a weird quirk with installing the library via the provided library manager within the arduino IDE: it pulled an out of date version of the .cpp & .h files. Pulling from the git repo itself and referencing "Serial" as the argument to the constructor rectified the situation!


text:
How can I add an additional temperature sensor (EZO RTD of Atlas Scientific) to an Atlas Scientific bare-bones wifi pool kit?
Problem summary
When I changed the I2C address of a sensor (EZO RTD) to another address (e.g., 50 or 100) from its default address (102), it didn't work on my Atlas Scientific bare-bones WiFi Hydroponics Kit.
Specific description
I tried to add a temperature sensor (EZO RTD) to an Atlas Scientific bare-bones WiFi Hydroponics Kit that already has a pH Sensor (EZO pH) and a temperature sensor (EZO RTD) on the pH port and Temperature port, respectively. Since a provided setup guide of Atlas Scientific says that each sensor on the kit has to have a different I2C address when multiple sensors are used on it. So I assigned an I2C address "50" to the additional sensor and then added it to the AUX port (and tried the Temperature port as well), but it didn't work at all. Meanwhile, the temperature sensor with the default I2C address 102) works very well on both the Temperature and AUX ports. I guess this might be related to a coding problem. Atlas Scientific's provided code is as follows: THE CODE IS DELETED BY MYSELF
Thanks for reading my problem.
Jayjay
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
I solved this problem based on the answer I voted for.
The code I made is as follows:
#include <iot_cmd.h>
#include <ESP8266WiFi.h>                                         //include esp8266 wifi library
#include "ThingSpeak.h"                                          //include thingspeak library
#include <sequencer4.h>                                          //imports a 4 function sequencer
#include <sequencer1.h>                                          //imports a 1 function sequencer
#include <Ezo_i2c_util.h>                                        //brings in common print statements
#include <Ezo_i2c.h> //include the EZO I2C library from https://github.com/Atlas-Scientific/Ezo_I2c_lib
#include <Wire.h>    //include arduinos i2c library

WiFiClient client;                                              //declare that this device connects to a Wi-Fi network,create a connection to a specified internet IP address

//----------------Fill in your Wi-Fi / ThingSpeak Credentials-------
const String ssid = "WIFI NAME";                                 //The name of the Wi-Fi network you are connecting to
const String pass = "WIFI PASSWORD";                             //Your WiFi network password
const long myChannelNumber = ;                            //Your Thingspeak channel number
const char * myWriteAPIKey = "";                 //Your ThingSpeak Write API Key
//------------------------------------------------------------------

Ezo_board PH = Ezo_board(99, "PH");       //create a PH circuit object, who's address is 99 and name is "PH"
Ezo_board EC = Ezo_board(100, "EC");      //create an EC circuit object who's address is 100 and name is "EC"
Ezo_board RTD = Ezo_board(102, "RTD");    //create an RTD circuit object who's address is 102 and name is "RTD"
Ezo_board RTD2 = Ezo_board(50, "RTD2");   //create an RTD circuit object who's address is 50 and name is "RTD2"
Ezo_board PMP = Ezo_board(103, "PMP");    //create an PMP circuit object who's address is 103 and name is "PMP"

Ezo_board device_list[] = {   //an array of boards used for sending commands to all or specific boards
  PH,
  EC,
  RTD,
  RTD2,
  PMP
};

Ezo_board* default_board = &device_list[0]; //used to store the board were talking to

//gets the length of the array automatically so we dont have to change the number every time we add new boards
const uint8_t device_list_len = sizeof(device_list) / sizeof(device_list[0]);

//enable pins for each circuit
const int EN_PH = 14;
const int EN_EC = 12;
const int EN_RTD = 15;
const int EN_AUX = 13;

const unsigned long reading_delay = 1000;                 //how long we wait to receive a response, in milliseconds
const unsigned long thingspeak_delay = 15000;             //how long we wait to send values to thingspeak, in milliseconds

unsigned int poll_delay = 2000 - reading_delay * 2 - 300; //how long to wait between polls after accounting for the times it takes to send readings

//parameters for setting the pump output
#define PUMP_BOARD        PMP       //the pump that will do the output (if theres more than one)
#define PUMP_DOSE         -0.5      //the dose that the pump will dispense in  milliliters
#define EZO_BOARD         EC        //the circuit that will be the target of comparison
#define IS_GREATER_THAN   true      //true means the circuit's reading has to be greater than the comparison value, false mean it has to be less than
#define COMPARISON_VALUE  1000      //the threshold above or below which the pump is activated

float k_val = 0;                                          //holds the k value for determining what to print in the help menu

bool polling  = true;                                     //variable to determine whether or not were polling the circuits
bool send_to_thingspeak = true;                           //variable to determine whether or not were sending data to thingspeak

bool wifi_isconnected(){                            //function to check if wifi is connected
  return (WiFi.status() == WL_CONNECTED);
}

void reconnect_wifi(){                                    //function to reconnect wifi if its not connected
  if(!wifi_isconnected()){
    WiFi.begin(ssid, pass);
    Serial.println("connecting to wifi");
  }
}

void thingspeak_send(){
  if (send_to_thingspeak == true) {                                                    //if we're datalogging
    if(wifi_isconnected()){
      int return_code = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
      if (return_code == 200) {                                                          //code for successful transmission
          Serial.println("sent to thingspeak");
      }else{
        Serial.println("couldnt send to thingspeak");
      }
    }
  }
}

void step1();      //forward declarations of functions to use them in the sequencer before defining them
void step2();
void step3();
void step4();
Sequencer4 Seq(&step1, reading_delay,   //calls the steps in sequence with time in between them
               &step2, 300,
               &step3, reading_delay,
               &step4, poll_delay);

Sequencer1 Wifi_Seq(&reconnect_wifi, 10000);  //calls the wifi reconnect function every 10 seconds

Sequencer1 Thingspeak_seq(&thingspeak_send, thingspeak_delay); //sends data to thingspeak with the time determined by thingspeak delay

void setup() {

  pinMode(EN_PH, OUTPUT);                                                         //set enable pins as outputs
  pinMode(EN_EC, OUTPUT);
  pinMode(EN_RTD, OUTPUT);
  pinMode(EN_AUX, OUTPUT);
  digitalWrite(EN_PH, LOW);                                                       //set enable pins to enable the circuits
  digitalWrite(EN_EC, LOW);
  digitalWrite(EN_RTD, HIGH);
  digitalWrite(EN_AUX, LOW);

  Wire.begin();                           //start the I2C
  Serial.begin(9600);                     //start the serial communication to the computer

  WiFi.mode(WIFI_STA);                    //set ESP8266 mode as a station to be connected to wifi network
  ThingSpeak.begin(client);               //enable ThingSpeak connection
  Wifi_Seq.reset();                       //initialize the sequencers
  Seq.reset();
  Thingspeak_seq.reset();
}

void loop() {
 String cmd;                            //variable to hold commands we send to the kit

  Wifi_Seq.run();                        //run the sequncer to do the polling

  if (receive_command(cmd)) {            //if we sent the kit a command it gets put into the cmd variable
    polling = false;                     //we stop polling
    send_to_thingspeak = false;          //and sending data to thingspeak
    if(!process_coms(cmd)){              //then we evaluate the cmd for kit specific commands
      process_command(cmd, device_list, device_list_len, default_board);    //then if its not kit specific, pass the cmd to the IOT command processing function
    }
  }

  if (polling == true) {                 //if polling is turned on, run the sequencer
    Seq.run();
    Thingspeak_seq.run();
  }
}

//function that controls the pumps activation and output
void pump_function(Ezo_board &pump, Ezo_board &sensor, float value, float dose, bool greater_than){
 if (sensor.get_error() == Ezo_board::SUCCESS) {                    //make sure we have a valid reading before we make any decisions
    bool comparison = false;                                        //variable for holding the reuslt of the comparison
    if(greater_than){                                               //we do different comparisons depending on what the user wants
      comparison = (sensor.get_last_received_reading() >= value);   //compare the reading of the circuit to the comparison value to determine whether we actiavte the pump
    }else{
      comparison = (sensor.get_last_received_reading() <= value);
    }
    if (comparison) {                                               //if the result of the comparison means we should activate the pump
      pump.send_cmd_with_num("d,", dose);                           //dispense the dose
      delay(100);                                                   //wait a few milliseconds before getting pump results
      Serial.print(pump.get_name());                                //get pump data to tell the user if the command was received successfully
      Serial.print(" ");
      char response[20];
      if(pump.receive_cmd(response, 20) == Ezo_board::SUCCESS){
        Serial.print("pump dispensed ");
      }else{
        Serial.print("pump error ");
      }
      Serial.println(response);
    }else {
      pump.send_cmd("x");                                          //if we're not supposed to dispense, stop the pump
    }
  }
}

void step1() {
  //send a read command. we use this command instead of RTD.send_cmd("R");
  //to let the library know to parse the reading
  RTD.send_read_cmd();
  RTD2.send_read_cmd();
}

void step2() {
  receive_and_print_reading(RTD);             //get the reading from the RTD circuit
    if ((RTD.get_error() == Ezo_board::SUCCESS) && (RTD.get_last_received_reading() > -1000.0)) { //if the temperature reading has been received and it is valid
    PH.send_cmd_with_num("T,", RTD.get_last_received_reading());
    EC.send_cmd_with_num("T,", RTD.get_last_received_reading());
    ThingSpeak.setField(2, String(RTD.get_last_received_reading(), 2));                 //assign temperature readings to the third column of thingspeak channel
  } else {                                                                                //if the temperature reading is invalid
    PH.send_cmd_with_num("T,", 25.0);
    EC.send_cmd_with_num("T,", 25.0);                                                          //send default temp = 25 deg C to EC sensor
    ThingSpeak.setField(2, String(25.0, 2));                 //assign temperature readings to the third column of thingspeak channel
  }

  Serial.print(" ");
  receive_and_print_reading(RTD2);
  if ((RTD2.get_error() == Ezo_board::SUCCESS) && (RTD2.get_last_received_reading() > -1000.0)) { //if the temperature reading has been received and it is valid
    PH.send_cmd_with_num("T,", RTD2.get_last_received_reading());
    EC.send_cmd_with_num("T,", RTD2.get_last_received_reading());
    ThingSpeak.setField(3, String(RTD2.get_last_received_reading(), 2));                 //assign temperature readings to the third column of thingspeak channel
  } else {                                                                                //if the temperature reading is invalid
    PH.send_cmd_with_num("T,", 25.0);
    EC.send_cmd_with_num("T,", 25.0);                                                          //send default temp = 25 deg C to EC sensor
    ThingSpeak.setField(3, String(25.0, 2));                 //assign temperature readings to the third column of thingspeak channel
  }

}

void step3() {
  //send a read command. we use this command instead of PH.send_cmd("R");
  //to let the library know to parse the reading
  PH.send_read_cmd();
  EC.send_read_cmd();
}

void step4() {
  receive_and_print_reading(PH);             //get the reading from the PH circuit
  if (PH.get_error() == Ezo_board::SUCCESS) {                                          //if the PH reading was successful (back in step 1)
     ThingSpeak.setField(1, String(PH.get_last_received_reading(), 2));                 //assign PH readings to the first column of thingspeak channel
  }
  Serial.print("  ");
  receive_and_print_reading(EC);             //get the reading from the EC circuit
  if (EC.get_error() == Ezo_board::SUCCESS) {                                          //if the EC reading was successful (back in step 1)
     ThingSpeak.setField(2, String(EC.get_last_received_reading(), 0));                 //assign EC readings to the second column of thingspeak channel
  }

  Serial.println();
  pump_function(PUMP_BOARD, EZO_BOARD, COMPARISON_VALUE, PUMP_DOSE, IS_GREATER_THAN);
}

void start_datalogging() {
  polling = true;                                                 //set poll to true to start the polling loop
  send_to_thingspeak = true;
  Thingspeak_seq.reset();
}

bool process_coms(const String &string_buffer) {      //function to process commands that manipulate global variables and are specifc to certain kits
  if (string_buffer == "HELP") {
    print_help();
    return true;
  }
  else if (string_buffer.startsWith("DATALOG")) {
     start_datalogging();
    return true;
  }
  else if (string_buffer.startsWith("POLL")) {
    polling = true;
    Seq.reset();

    int16_t index = string_buffer.indexOf(',');                    //check if were passing a polling delay parameter
    if (index != -1) {                                              //if there is a polling delay
      float new_delay = string_buffer.substring(index + 1).toFloat(); //turn it into a float

      float mintime = reading_delay*2 + 300;
      if (new_delay >= (mintime/1000.0)) {                                       //make sure its greater than our minimum time
        Seq.set_step4_time((new_delay * 1000.0) - mintime);          //convert to milliseconds and remove the reading delay from our wait
      } else {
        Serial.println("delay too short");                          //print an error if the polling time isnt valid
      }
    }
    return true;
  }
  return false;                         //return false if the command is not in the list, so we can scan the other list or pass it to the circuit
}

void get_ec_k_value(){                                    //function to query the value of the ec circuit
  char rx_buf[10];                                        //buffer to hold the string we receive from the circuit
  EC.send_cmd("k,?");                                     //query the k value
  delay(300);
  if(EC.receive_cmd(rx_buf, 10) == Ezo_board::SUCCESS){   //if the reading is successful
    k_val = String(rx_buf).substring(3).toFloat();        //parse the reading into a float
  }
}

void print_help() {
  get_ec_k_value();
  Serial.println(F("Atlas Scientific I2C hydroponics kit                                       "));
  Serial.println(F("Commands:                                                                  "));
  Serial.println(F("datalog      Takes readings of all sensors every 15 sec send to thingspeak "));
  Serial.println(F("             Entering any commands stops datalog mode.                     "));
  Serial.println(F("poll         Takes readings continuously of all sensors                    "));
  Serial.println(F("                                                                           "));
  Serial.println(F("ph:cal,mid,7     calibrate to pH 7                                         "));
  Serial.println(F("ph:cal,low,4     calibrate to pH 4                                         "));
  Serial.println(F("ph:cal,high,10   calibrate to pH 10                                        "));
  Serial.println(F("ph:cal,clear     clear calibration                                         "));
  Serial.println(F("                                                                           "));
  Serial.println(F("ec:cal,dry           calibrate a dry EC probe                              "));
  Serial.println(F("ec:k,[n]             used to switch K values, standard probes values are 0.1, 1, and 10 "));
  Serial.println(F("ec:cal,clear         clear calibration                                     "));

  if(k_val > 9){
     Serial.println(F("For K10 probes, these are the recommended calibration values:            "));
     Serial.println(F("  ec:cal,low,12880     calibrate EC probe to 12,880us                    "));
     Serial.println(F("  ec:cal,high,150000   calibrate EC probe to 150,000us                   "));
  }
  else if(k_val > .9){
     Serial.println(F("For K1 probes, these are the recommended calibration values:             "));
     Serial.println(F("  ec:cal,low,12880     calibrate EC probe to 12,880us                    "));
     Serial.println(F("  ec:cal,high,80000    calibrate EC probe to 80,000us                    "));
  }
  else if(k_val > .09){
     Serial.println(F("For K0.1 probes, these are the recommended calibration values:           "));
     Serial.println(F("  ec:cal,low,84        calibrate EC probe to 84us                        "));
     Serial.println(F("  ec:cal,high,1413     calibrate EC probe to 1413us                      "));
  }

  Serial.println(F("                                                                           "));
  Serial.println(F("rtd:cal,t            calibrate the temp probe to any temp value            "));
  Serial.println(F("                     t= the temperature you have chosen                    "));
  Serial.println(F("rtd:cal,clear        clear calibration                                     "));
 }

Define "changed the I2C address"--the sensor board itself needs to have its I2C address changed--how exactly did you change its I2C address?

@DaveNewton Thanks for your question. I used an Arduino UNO and issued a command, "I2C, 50" in Arduino IDE.

Did you update the code above to add your new sensor?
A quick look at Atlas' site and their Github page didn't find an obvious instruction to do what you're try to do, so that's the first thing I'd try if you haven't already. Below the Thinkspeak Credentials section, add your new device to the I2C devices definitions, then add its name to the array of available devices. I called the new temp sensor RTD2 in my example below, but you could probably call it something more descriptive of its function or placement. It looks like there is a name string in each definition that (I'm guessing) will be displayed in Thingspeak's data, and would be a good place to put a short description.
        Ezo_board PH = Ezo_board(99, "PH");       //create a PH circuit object, who's address is 99 and name is "PH"
        Ezo_board EC = Ezo_board(100, "EC");      //create an EC circuit object who's address is 100 and name is "EC"
        Ezo_board RTD = Ezo_board(102, "RTD");    //create an RTD circuit object who's address is 102 and name is "RTD";
        Ezo_board RTD2 = Ezo_board(50, "RTD2");   //create an RTD circuit object who's address is 50 and name is "RTD2"
        Ezo_board PMP = Ezo_board(103, "PMP");    //create an PMP circuit object who's address is 103 and name is "PMP"

        Ezo_board device_list[] = {   //an array of boards used for sending commands to all or specific boards
          PH,
          EC,
          RTD,
          RTD2,
          PMP
        };

Update:
On review, it looks like you'll need to define an Arduino pin to enable the new device (in the //enable pins for each circuit section) and enable it at the head of setup() where the the other devices' pins are set to OUTPUT mode, and set this pin HIGH (guessing that your new RTD will be identical to your current one):
//enable pins for each circuit
const int EN_PH = 14;
const int EN_EC = 12;
const int EN_RTD = 15;
const int EN_RTD2 =    <some available pin# here> ;
const int EN_AUX = 13;

And in setup():

 pinMode(EN_RTD2, OUTPUT);

  ...

 digitalWrite(EN_RTD2, HIGH);

Update 2:
I think what we did above will get your new sensor data logged to Thingspeak, since I see a message referring to a "datalog mode" in print_help(). If you're expecting the control process to act your new sensor data in some way, you'll need to understand what it does now and what you want it to do differently based on the newly available data. But I would still take getting the system to just log the new data as your first step.

Thanks for your answer. I found a way to solve this problem following part of your answer. I edited my code only based on the first paragraph of your answer but not the rest of it. Rather, I edited void. step1 and void step 2.


text:
Proper Micro SD card schematic
I am using a micro sd card shield with an arduino zero, and I am not sure I am using a proper circuit with it. This is the circuit I am using right now:

That is all it is there, just a capacitor for the power and a pullup resistor for the chipselect. The tags just go to the processor.
I have seen a lot of schematics out there with resistors in series to the processor, some times with pull up resistors, some times with pulldown resistors...
I'm not sure the pullup resistor I am using is a good idea, and I am unsure about the value.
To me something like this makes more sense:

Can someone teach me a proper circuit for this? what is best and why?
Right now I am not very happy with the performance of the micro SD card socket. That's why I want to improve it.
EDIT: Turns out I didnt really understand very well the second schematic, it was just voltage dividers to lower the 5v os arduino uno to 3V. But what about the pullup resistor of the MISO?

As per the SD card specification:

When an SD card is operating in SPI mode or 1-bit SD mode, the CMD and DATA (DAT0 - DAT3) lines of the SD bus must be pulled up by 10 kOhm resistors. Slaves should also have pull-ups on all above-mentioned lines (regardless of whether these lines are connected to the host) in order to prevent SD cards from entering a wrong state.

Basically you need to ensure that "everything is off" until the Arduino actively drives the SD card. Without them the SD card's inputs will be floating and doing anything they like until the Arduino starts communicating.
Resistors in-line with the signals are there really just to increase the impedance and prevent damage when hot-swapping a card.
If you have a 5V Arduino you will require logic level translation. This is a separate thing to the resistors. While resistors are OK for UART or simple IO logic level translation they are not suitable for use with an SD card. This is because the clock frequencies involved are too high and the resistors will corrupt the signal (through low pass filtering). Instead you require an active logic level translation system, such as a dual voltage, or TTL input, buffer, or active MOSFET level shifters.

I think those are not a good idea. They are actually voltage dividers from 5V to 3V.

@Espada86 What are not a good idea? And what is a voltage divider between 5v and 3v?

Arduino UNO works with 5V, but SD Socket works with 3V. Thats the reason they put 3 voltage dividers.

@Espada86 Logic level translation is a completely separate issue. The resistors are still required even if you have level translation. And using resistors as logic level translation for SD cards is not practical - the frequencies involved are too high.

After a lot of testing and investigating it seems that the pullup resitor on miso is the key. I tried a lot of things and this one is the single thing that did the job for me. I finally managed to make it work in a reliable way. I am thinking about putting it on every SPI device connected. Do you think it is usefull to put pull up resitors on al lines? I mean miso, mosi, sck, and CS. Or just miso?

There's an excellent tutorial on Instructables I recommend one to read.
here's the link
https://www.instructables.com/Select-SD-Interface-for-ESP32/

Thanks for sharing that link, it is really usefull

There are a couple of "do and don't" when designing an SPI interface.
Do add pull-up resistors on SS or set SS HIGH for multiple-slave system
SPI is a bus system, means that your device might not be the only one using the interface. When designing an SPI interface, you therefore has to consider the scenario where multiple SPI devices are used, and especially when some of the slaves are not coded by your system.
Without a pullup resistor, the SS line might be neither LOW nor HIGH, this might caused some of the devices on the bus to “hear” the communication on its MISO that was not intend for the device. This might explained why some of the Arduino shields or breakout boards with SPI works when used alone, but fail when used together with other SPI boards, causing by some of those boards lack of pullup resistor or the user didn't pull the SS lines in the system HIGH at the setup() before calling the SPI.begin()!
Do ensure MISO can be tri-state in multiple-slave system
Most SPI chips will be at tri-state on their MISO pin (but there are some chips out there requires extra external tri-state buffer chip) when their chip select signal is HIGH. Tri-stage means that it is neither HIGH nor LOW (i.e. floated) and effectively disconnect. However, A SPI device without tri-state MISO could caused potential problem on a SPI bus where multiple SPI devices are connected. If the MISO is unable to be at tri-state, it will be either HIGH or LOW, this will affect other devices connected on the same bus in receiving data.
With this in mind, it is not a good idea to add a pull-up resistor on MISO line.

Noted, Thank you


text:
ESP32 doesn't connect to Arduino. | could not open port 'COM2': WindowsError(5, 'Access is denied.')
ERROR:
serial.serialutil.SerialException: could not open port 'COM2': WindowsError(5, 'Access is denied.')

I've tried literally everything.

Drives checks out! | Silicon Labs CP210x USB to UART Bridge (installed!)
Restarting the computer didn't make any difference
Restarting apps and stuff
Arduino's Serial monitor is closed
The cable is ok! Brand new and testing with other cables (also tested) don't work
The led in the ESP is on and stable, I could upload the sketch wifi scan code once, it keeps looping and just works properly, but I cannot upload new data and/or update the code within the esp32
I've tried holding the buttons in every way possible, it doesn't make any difference.

++

help :(

Nothing else has the port open? It’s the correct port? Can you connect to it with a different machine?

Check whether the board appears as USB to serial CP210x or some variant of it on device manager. If it does  appear you can rule out a hardware issue.

if the port appears in the device manager when you plug the board in, then the hardware is working between windows and the UART bridge ... the access denied is a windows message that is probably not related to the UART bridge

@DaveNewton no I haven't tried connecting it to another machine.

@Coder9390 I'll update the question with the device manager's ports image


text:
Serial.print() Inferferes with my digitalRead()
I'm running into issue properly reading a button connected to a digital I/O pin on my Adafruit Feather HUZZAH ESP8266 device.
I've implemented the debouncing script exactly as the Arduino provided example shows, but if I add a print statement to my setup loop:
void setup() {
  Serial.begin(230400);
  Serial.println("Starting");
  pinMode(buttonPin, INPUT_PULLUP);
}

I trigger a reading of the switch on every reset cycle. Commenting out the print statement will avoid the problem so it doesn't appear to be related to the debouncing script.
In addition, I can replicate the problem on any digital I/O pin even when there is no pin connected. Once I get past the setup function, everything works as intended. Here's my whole setup code (again, copied from the example):
const int buttonPin = 13;
int buttonState;
int lastButtonState = LOW;

unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;

void setup() {
  Serial.begin(230400);
  Serial.println("Starting");
  pinMode(buttonPin, INPUT_PULLUP);
  lastDebounceTime = millis();

}

void loop() {
  int reading = digitalRead(buttonPin);

  if (reading != lastButtonState) {
    lastDebounceTime = millis();
  }

  if ((millis() - lastDebounceTime) > debounceDelay) {
    if (reading != buttonState) {
      buttonState = reading;

      Serial.println("A");
    }
  }

  lastButtonState = reading;
}

And here's the output of my serial monitor (with no delays on reset):
Starting
A

I can avoid this by just ignoring the first button switch but it seems odd that this is happening and I can't find any explanations for what's going on.

Please not just include your setup code, but the whole code.

We can't either since we can't see your code ;) There's no particular reason writing to the serial port would "trigger a button read". However: serial writes are asynchronous, and adding a call to Serial.println adds to (a) time spent in setup, and (b) time spent doing "things" before the serial buffer is written out. It seems more likely there's a flaw in the debounce logic, particularly if lastDebounceTime is initialized to 0 (a Long Time Ago to the controller).

Added my loop code. @DaveNewton - I changed my setup to reset my lastDebounceTime to my last operation before entering my loop but still I print "A" on every reset.

Did you try moving the pinMode to avoid the period of floating?

I've tried putting it first and last in my setup with no effect. Would there be a time period needed for the digital read to "settle" or something?

The issue ended up that buttonState was never initialized in the example scripts so it begins != to the reading thus triggering as soon as the timer exceeds the debounce delay.  I was able to fix it simply by initializing the value to be the same as the value of lastButtonState.

I haven't really been paying much attention to this question; I just notice you've solved your own problem.  If what you've written above is an answer that follows from the information in the question and you think all of this would be useful to someone else, you can post your own answer to it.  Otherwise the question will likely float around in the system forever as unaswered, unless you delete it.

You need to initialise buttonState to the current signal state and initialise lastDebounceTime to the current time, something like this:
int buttonState = digitalRead(buttonPin);
unsigned long lastDebounceTime = millis();

Compare with this very simple debouncer I put on GitHub.

You're absolutely right! I'm not sure why I didn't catch that or why the Arduino provided sketch doesn't initialize the variables.

Initializing my buttonState solved my problem:
int buttonState = LOW;

In any case, be aware that writing in serial pauses the microcontroller for a few milliseconds!

@alessandromrc: For a few microseconds. Unless the TX buffer is full, in which case it can indeed take milliseconds.

@EdgarBonet You are right!


text:
How to send data from esp-01 Wi-Fi module to arduino
The L1 is the value i will get from firebase database, but now i wanna send the value that i receive in realtime database to arduino to on LED, how to solve? any suggestion? which mean when arduino receive value 1 from firebase then led will on
ESP8266 code :
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

// Set these to run
#define FIREBASE_HOST ""
#define FIREBASE_AUTH ""
#define WIFI_SSID "Home "
#define WIFI_PASSWORD ""

int value1;

void setup() {
  //Initializes the serial connection at 9600 get sensor data from arduino.
  Serial.begin(9600);

  delay(1000);

  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
  }

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
  Firebase.setInt("L1",0);
}

void loop()
{
  while(Serial.available())
  {
        value1 =  Firebase.getString("L1").toInt();
  }

  delay(1000);
}

Arduino code:
#define LED 13;

int value1;

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

void loop()
{
  if (value1 == 1)
  {
     digitalWrite(LED, HIGH);
  }
}

see the basic examples in IDE examples menu

Which one should I see?

all of them .... think about this in your code what will be the state of the LED when value1 is not equal to 1?

if the value not equal to 1, LED will be off

ESP8266 code :
   #include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

// Set these to run
#define FIREBASE_HOST ""
#define FIREBASE_AUTH ""
#define WIFI_SSID "Home "
#define WIFI_PASSWORD ""

int value1;
String string_value;
void setup() {
  //Initializes the serial connection at 9600 get sensor data from arduino.
  Serial.begin(9600);

  delay(1000);

  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
  }

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
  Firebase.setInt("L1",0);
}

void loop()
{

        value1 =  Firebase.getString("L1").toInt();
        string_value = String(value1);
        Serial.print(string_value);

  delay(1000);
}

Arduino code:
    #define LED 13

int value1;
String data;

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

void loop()
{

  bool Sr =false;

  while(Serial.available()){

        data=Serial.readString();
        value1 =data.toInt();
        Sr=true;

    }

    delay(500);

    if(Sr){

        if (value1 == 1)
        {
           digitalWrite(LED, HIGH);
        }else if(value1 == 0){

            digitalWrite(LED, LOW);
          }
   }
}

For More details:
https://www.youtube.com/watch?v=ji71cHaGW8w

Thank you for your help.

Your ESP needs to

receive data from Firebase over WiFi;
send the received data (or the useful part of it) to the Arduino, over its serial port.

Your Arduino needs to:

watch its own serial port for data becoming available;
read the data;
decide whether turn the LED on or off.

Your loop() code on the Esp is watching its serial port, but from your description, it shouldn't expect any data from its serial port - that is connected to the Arduino. You need to watch for data arriving via WiFi instead.
Your Arduino code is testing the variable value but value never gets set to anything. You should set it according to what you receive from the Esp.
Also, since I'm not familiar with Firebase, does the Esp need to tell Firebase each time it wants new data? Or does Firebase send data at intervals without you having to ask for it? If it's the former, your Esp will need code to ask for the data and wait for it to arrive before it can send it on to the Arduino.


text:
Arduino nano + 4x 7 segment display + 74HC595 - Only dot points are turn on
I am trying to run a thermometer with thermocouple sensor on Arduino Nano.
I have bought 4x 7 segment display and 74HC595 chip. Everything is connected like in the attached diagram below (without DS18B20) , but when I uploaded sketch to Nano - only dots are turn on .
Below You Can find my code
#include <OneWire.h>

const int latchPin = 8; // Pin connected to ST_CP of 74HC595
const int clockPin = 9; // Pin connected to SH_CP of 74HC595
const int dataPin = 10; // Pin connected to DS of 74HC595
const int digitPins[4] = {
    3, 4, 5, 6}; // pins to control the 4 common anode pins of display
// seven segment digit bits + blank + minus
const byte digit[12] = {
    B00111111, // 0
    B00000110, // 1
    B01011011, // 2
    B01001111, // 3
    B01100110, // 4
    B01101101, // 5
    B01111101, // 6
    B00000111, // 7
    B01111111, // 8
    B01101111, // 9
    B00000000, // Blank
    B01000000  //-
};

int digitBuffer[4] = {1};
int digitScan = 0;
int soft_scaler = 0;
float tempC, tempF;
int tmp;
boolean sign = false;

void setup()
{
    TCCR2A = 0;
    TCCR2B = (1 << CS21);
    TIMSK2 = (1 << TOIE2);
    TCNT2 = 0;

    for (int i = 0; i < 4; i++)
        pinMode(digitPins[i], OUTPUT);

    pinMode(latchPin, OUTPUT);
    pinMode(clockPin, OUTPUT);
    pinMode(dataPin, OUTPUT);
}

ISR(TIMER2_OVF_vect)
{
    soft_scaler++;
    if (soft_scaler == 15)
    {
        refreshDisplay();
        soft_scaler = 0;
    }
};

void refreshDisplay()
{
    for (byte k = 0; k < 4; k++)
        digitalWrite(digitPins[k], LOW);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
    digitalWrite(latchPin, HIGH);
    delayMicroseconds(50);
    digitalWrite(digitPins[digitScan], HIGH);
    digitalWrite(latchPin, LOW);

    if (digitScan == 1)
    {
        shiftOut(dataPin, clockPin, MSBFIRST,
                 ~(digit[digitBuffer[digitScan]] | B10000000));
    }
    else
    {
        shiftOut(dataPin, clockPin, MSBFIRST, ~digit[digitBuffer[digitScan]]);
    }

    digitalWrite(latchPin, HIGH);
    digitScan++;
    if (digitScan > 3)
        digitScan = 0;
}

void loop()
{

    tempC = 90.8;
    tmp = int(tempC * 10);
    if (tempC < 0)
    {
        sign = true;
        tmp = abs(tmp);
    }
    else
    {
        sign = false;
    }

    if (int(tmp) / 1000 == 0)
    {
        digitBuffer[3] = 10;
        if (sign)
        {
            digitBuffer[3] = 11;
        }
    }
    else
    {
        digitBuffer[3] = int(tmp) / 1000;
    }

    if (int(tmp) / 1000 == 0 && (int(tmp) % 1000) / 100 == 0)
    {
        digitBuffer[2] = 10;
        if (sign)
        {
            digitBuffer[2] = 11;
            digitBuffer[3] = 10;
        }
    }
    else
    {
        digitBuffer[2] = (int(tmp) % 1000) / 100;
    }

    digitBuffer[1] = (int(tmp) % 100) / 10;
    digitBuffer[0] = (int(tmp) % 100) % 10;

    delay(500);
}

I didn't connect thermocouple yet, but I use constant "tempC" with value = 90.8, to check if it works. If I change the value to higher - dots on displays are more dimmed.

please indent your code properly ... right now, it is difficult to read

That is a big display. That only the dots turns on is an indication that the voltage could be too low. The dots probably have less series diodes than the segments. Green display diodes also have a relatively high forward voltage. There may be other problems too. Post a link to the data sheet or vendor site for that display.
Also this indicates a software problem because the schematic implies a common cathode type display: //pins to control the 4 common anode pins of display Remember also the absolute max 40mA limit for Arduino pins especially relevant for d3 to d6 here

Your digit pins can probably not source enough current for the display segments to light. You need a PNP transistor with a proper base resistor on each digit pin to drive the displays using an active low (inverted) signal. This would have been easier if your display was of the Common Cathode type. The fact that the dots are the only thing to light might also indicate there's something wrong with your code.

Thank You for response! You may be right, that transistors will be necessary. Below You can find vendor site of this display
https://sklep.avt.pl/wyswietlacz-led-2-30-57mm-zielony-wa.html You can find in the descrpition - this is common anode display.

The vendor description is not very good, however it is clear that 5 volts is not enough for these displays implying that you have to redesign the circuit to include a higher voltage power source. It does appear from the description, however, to be a common anode device. The screen shot from the data sheet shows each segment has 4 diodes in series and the DP has 2 diodes in series. That the DP lights with 5 volts indicates that the segments will light with 10 volts (possibly a bit less). Because it is common anode type you could use a TPIC6B595 shift register to replace the 74HC595. You need also 4 high side switches (each 1xPNP + 1xNPN transistor) for the 4 anodes. For this, you could also use a high side driver chip, say a MIC2981. Since the segment diode voltage drop is not shown, but should be in the range 2.1 to 4 volts, you really need to do a test to discover the optimum value of the segment current limiting resistors to give the 10mA talked about in the description, at the voltage you decide to drive the display at. The DP really requires a correspondingly higher value current limiting resistor.

Thank You for Your support!
Does changing 74HC595 to TPIC6B595 is requiring changing code or circuit?
And to be sure - on the output of D3-D6 I need to place MIC2981?

The wiring to the TPIC6B595 is different to that of the 74HC595. You'd best search for a tutorial Arduino TPIC6B595. Also, the data you send is inverted because sending a "1" switches on a segment by pulling it LOW. On the 74HC595, sending a "1" would have switched the segment off by pulling it HIGH. It would be easiest to invert the table, for example "8" is currently B01111111, //8. You'd change this to B10000000, //8 . The MIC2981 is an 8 channel source driver. You'd connect Arduino pins D3 to D6 to  MIC2981 pins 1 to 4. The MIC2981 outputs 18 to 15 would go to the display common anodes.

Looking at your code, it is difficult to see how all four dots could be displayed simultaneously as in your picture. Only the dot on the second digit should be displayed. However, the pinout of the display on the schematic differs from that on the vendor document. The anode is connected to pins 3 & 8 on the schematic and 1 & 5 in the vendor document. This implies also that you have wired the display incorrectly.
The code change for the TPIC6B595 should be even easier than I said earlier. Simply remove the inverting tildas '~' in the two shiftOut() statements.


text:
esp8266 analogRead of 5.5V soil moisture sensor input using voltage divider
On an ESP8266 I try to analogRead(A0) my soil moisture sensor using a voltage divider but I get unexpected low values.
The MT3608 increases the esp's output voltage from 3.3V to 5.5V which is the recommended voltage for my capacitive soil moisture sensor v1.2 (different to the picture below I use v1.2, not v1.0). When there is no voltage divider in the game and the sensor is dry, the sensor outputs ~4.5V (yellow wire). The output is around ~2.3V when the sensor is completely wet.
For my voltage divider I use a 150 Ohm (R1) and a 39 Ohm (R2) resistor. Given ~4.5V Vin on the yellow wire this should provide me with ~0.9V Vout on the green wire, because Vout=Vin*(R2/(R1+R2)). A voltage <=1V I could safely attach to the esp8266 A0 analog pin. However, using the voltage devider I measure only 8,3mV instead of the expected 0.9V! It drops to 7.7mV when Vin is 2.3V (wet sensor).

What am I doing wrong? Any advise is highly appreciated!
For testing I currently use a board which has a build-in internal voltage divider that allows for up to 3.3V input, however in the final design I need to run everything using an ESP12-E without such an internal divider.

If the "V3" is anything like the "V1" then the A0 pin already has a voltage divider in it aimed at 3.3V operation (the analog input of the ESP8266 only handles 1.1V max). You just need to add another resistor instead of a whole voltage divider to adjust the onboard one. 100kΩ should work.

It looks like my board has a voltage divider on it, however I use the NodeMCU board just for testing and need to run the final circuit with an ESP12-e that doesn't have a build-in voltage divider and expects <=1V analog input. I still wonder why I get this low value of just 8.3mV while I actually expect 900mV

Just use the internal divider as part of your design.

but ESP12-e doesn't have an internal divider, it's just the chip. I edit the question to make this more clear.

Neither does the esp that is on the nodemcu. The divider is on the board. That is most of your divider that you want to design. When you go to your own design of board just take that but of divider design with you.

those resistors are way too low of a value; they are pulling down the output. Multiply your ohms by 100 and it should work.

@dandavis, thank you that did the trick! I'm curious, can you provide me with an explanation why a voltage divider with more Ohms result in higher Vout?

A low-resistance voltage divider draws more current than a high resistance one, even without a measurement device (your ESP) connected at the mid-point. The power supply must be able to supply enough current and still maintain it's voltage. If it isn't, the supply voltage drops.

@mika Look this exemple using ampOps.

I got similar situation having a 47ohm as R2, the one that goes to ground, how did you fix the issue? After reading the comments of Vincent and @dandavis , I patched the R2 adding a 10Kohm in serial having a total of 10047ohm now and suddenly the levels detected in the analog pin rose. When I have a 100K in the cable to the analog pin, with 47ohm I was getting 13 similar to when no data was coming, having 47K I was getting 13~14, with 10047ohm in R2, the value of the analog pin jumped to 108 for 100K and 195~196 for 47K.

When designing a voltage divider with 2 resistors, there are 2 things to consider:

The ratio between R1 and R2, which gives the output voltage: U(out) = U(in) * [R2 / (R1 + R2)]
The magnitude of each resistors: to get a 1/2 ratio, you need to have R1 = R2 no matter their value. But depending the value of your resistors (it can be 10Ω, 1kΩ, 100kΩ or 10MΩ for example), you will have a different current travelling through the bridge. The higher the resistors, the lower the current, and vice-versa.

When mesuring voltage inside the voltage divider, the ADC can be considered as a load to the circuit (as shown below). Some forums state that the input resistor of the ESP8266 ADC is around 20MΩ. If the resistors of the bridge are too low, the current will be high and will only travel through the bridge, leaving not enough current for the ADC to measure (electrons are lazy and always take the path of least resistance). On the other hand, if the resistors are too high, the current will be to low to be accurately detected as well.

In most cases, voltage dividers are build with resistors between 10kΩ and 1MΩ. This allows enough current to travel through the ADC to give an accurate measure of the voltage.
As suggested by dandavis comment, choosing (R1 ; R2) = (15kΩ ; 3,9kΩ) or (150kΩ ; 39kΩ) should work in your circuit.


text:
Can I get the actual fingerprint data from AS608?
So I own an AS608 fingerprint scanner, and I've been looking everywhere for information on how to get the fingerprint data (raw, processed, or binary) from the scanner itself to use with a database but to no luck.
I've seen some answers on here, but they don't point to anything specific, so I am bubbling asking again. I have intentions of using this with Atmega MCUs, I just need to get any form of data that I can then tie to a user for a system. Thank you!
This is the datasheet, but it doesn't really say if it can do that or not. The datasheet doesn't really talk about its applications.
So this is the fingerprint sensor I have, here is a link to it on a store. It is based on AS608 as RowanP pointed out in the comments.

please provide a link to the manufacturer datasheet for the AS608

An https://server4.eca.ir/eshop/000/AS608/Synochip-AS608.pdf 144MHz 512KB Cortex-M is capable of many things.  You'd have to find out what the code embedded in the scanner is programmed to communicate.

https://server4.eca.ir/eshop/000/AS608/Synochip-AS608.pdf

You’re linking to a microprocessor (AS608) that says it is intended for integration with fingerprint equipment. However after a quick skim of the datasheet it does not seem to have inbuilt fingerprint scanning peripherals. Are you saying it does (if so can you point to the relevant section of the datasheet)? Alternatively are you saying you have it connected to a fingerprint scanner? If so please provide details of the scanner. Or if both of these alternatives are wrong can you provide more information?

As background (and acknowledging the OP question is more specific) there is a general discussion on this topic here https://arduino.stackexchange.com/q/85270/71575

I did some googling and I can see a number of sensors labelled AS608, which is I guess a reference to the embedded chip. What you might do with the module (eg access to internal data) would depend on how much control you have over the code loaded into the AS608 I would guess. Although these all look the same I’d anticipate a fair bit of variation?

The best doco I can find is at Adafruit https://cdn-learn.adafruit.com/downloads/pdf/adafruit-optical-fingerprint-sensor.pdf

The Adafruit guide @RowanP posted shows it is possible to get images. //
https://makersportal.com/shop/optical-fingerprint-sensor-as608 has a pic of their AS608 fingerprint sensor board clearly showing the Synochip AS608 processor on a board silkscreened with "DY50-2V1"  Searching for DY50 leads to Ziantec Fingerprint Module or ZFM Fingerprint module with an english datasheet at https://www.velleman.eu/downloads/29/infosheets/vma329_datasheet.pdf and a chinese one at https://cdn-shop.adafruit.com/datasheets/DY001fingerprint.pdf //  What module do you have? Post pics?

https://github.com/bastianraschke/pyfingerprint/blob/Development/src/files/examples/example_downloadimage.py is a python example from https://github.com/bastianraschke/pyfingerprint for use with ZhianTec ZFM-20, ZFM-60, ZFM-70 and ZFM-100 and several other modules.  It suggests that the Adafruit Library https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library is the inspiration.  So yes, it seems possible, but the exact interfacing depends on the module, and what you want to do with it. Do you want to do image processing on the ATMega, or pass it through to a computer? Try the python.

I want to collect the data and store it on a database and use it for authentication elsewhere. I'm using the AtMega238.

If you can extract the actual fingerprint data you want from your device with a computer and those python programs, then your device can do it.  If so, then you can look at the python code and maybe adapt/use it or the Adafruit library to accomplish your purpose.  From your Q its hard to tell exactly what device you have or exactly what it is capable of.

@BeulahAkindele Can you show a photo of the PCB at the back of the actual sensor?

The thing is... I am using Cpp on an Atmega microcontroller. I really need to consolidate on an MCU solution right now for the project at hand. The python libraries you listed actually use USB fingerprint scanners, I need a serial/GPIO solution.
Also, @RowanP I added the images.

@DaveX The python libraries you listed actually use USB fingerprint scanners, I need a serial/GPIO solution

The specific device you actually have is still a bit unclear from your Q.  If it is compatible with the datasheet from Adafruit that you linked, then it looks like yes, you can get the image data out.  They demo that use-case with a (DY20 device)
serial/GPIO passthrough to USB rigged on an arduino, and then show the image in a windows app.  If that adafruit library demo works with your device, then the "FINGERPRINT_UPLOAD" Command, 0x08, or "Section 6.3.9 -- Upload Image" in https://www.velleman.eu/downloads/29/infosheets/vma329_datasheet.pdf should get your image.


text:
Problem with first two samples of serial data received by RPi
I'm trying to receive a string from an Arduino to a Raspberry Pi via a Bluetooth socket connection (RFCOMM).  I'm using an HC-06 Bluetooth module, an Arduino UNO R3, and an RPi 4 Model B.  For the most part, everything is working well --except the first two data samples.  This is what my output generally looks like when I view it from the RPi terminal:
0.
06,21,0.01,64
0.06,21,0.01,64
0.06,21,0.01,64
0.06,21,0.01,64
0.06,21,0.01,64
0.06,21,0.01,64

Is there any way I can get the first two lines to show the data properly?  This data is a singular string and I chose my buffer to be 32 bits, so I don't think buffer size is the issue.  I had to add time.delay(4) in my Py script or else every sample of the data would look messed up.  I've tried adjusting the time delay relentlessly, but I can't seem to get the first two samples to display correctly.  Below is a bit of my Python code:
while 1:
try:
        received_data = bluetoothSocket.recv(24)
        formatted_data = received_data.decode("utf-8")
        print("Received Data: ", formatted_data)
        time.sleep(4)

except KeyboardInterrupt:
        print("keyboard interrupt detected")
        break
bluetoothSocket.close()

why do you say that it is a problem with first two samples? ... it looks like a problem with just one line

@jsotola You're correct.  It's just the first sample being split into two lines.

It could be some previous data being buffered by the HC-06 which finally gets to come through once the rfcomm port is opened. Nothing much you can do about that unless you create a bidirectional protocol to instigate the communication only once the port is opened and the receiving program is ready to receive.

@Majenko Is there any way on the receiving Py script that I can have the socket "hold on" to the incoming string until a certain event happens?  I heard there may be a way to do this so that when "\n" is reached, everything will be released from the socket.

@phosphorescent I don't know - that's Python. I don't use Python. Personally I would have the Arduino do nothing at all until your Python program requests data to be sent. That way there can be no buffering issues. Also yes, you should read data up to the \n and use that as the delimiting factor of your communication instead of assuming 24 bytes.

Simple fix: send a boilerplate first instead of jumping right to data. Something like --BEGIN--\n that you can easily strip out in python.

You might want to try sending the data in a packet delimited by unique characters, e.g. { and }, similar to the JSON format.
The NMEA GPS standard uses $ and '\n' to delimit messages.
Here is an Arduino non-blocking C++ algorithm which builds upon Majenko's readline() example to read a packet. It returns true when incoming data has been accumulated into a valid packet. It should be fairly straightforward to convert it to Python.
void setup()
{
    Serial.begin(115200);
    Serial.println(F("\n\nSerial Packet Test\n"));
    pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
    const static unsigned int INTERVAL = 200;
    static unsigned long previous_timestamp = millis();
    unsigned long current_timestamp = millis();
    static bool led_state = false;

    if (current_timestamp - previous_timestamp >= INTERVAL)
    {
        led_state = !led_state;
        digitalWrite(LED_BUILTIN, led_state);
        previous_timestamp += INTERVAL;
    }

    static char packet[100];

    if (ReadPacket(Serial, packet, sizeof(packet)))
    {
        Serial.print(F("Received packet >"));
        Serial.print(packet);
        Serial.println(F("<"));
    }
}

bool ReadPacket(Stream& stream, char *const packet, const unsigned int SIZE)
{
    const char FIRST = '{';
    const char LAST = '}';
    static bool read_until_last = false;
    static unsigned int i = 0;
    char ch;

    if (stream.available())
    {
        ch = stream.read();

        if (ch == FIRST)
        {
            Serial.println(F("Received FIRST."));
            i = 0;
            packet[0] = ch;
            read_until_last = true;
            return false;
        }
        if (read_until_last)
        {
            i++;
            if (i > SIZE - 2)
            {
                Serial.println(F("Buffer overrun. Resetting to look for next packet."));
                i = 0;
                read_until_last = false;
                return false;
            }
            if (ch == LAST)
            {
                Serial.println(F("Received LAST."));
                packet[i++] = ch;
                packet[i] = 0;
                read_until_last = false;
                return true;
            }
            else
            {
                Serial.print(F("Received char >"));
                Serial.print(ch);
                Serial.println("<");
                packet[i] = ch;
                return false;
            }
        }
    }
    return false;
}

I don't know what the time.sleep(4) statement fixes, but you could try moving the  to the top of the loop instead of the bottom, so it precedes the first read. At the bottom of the loop, it's first execution comes after the first read.