text:
My servo is misbehaving
I have been trying to get my 9g tower pro servo to work and no matter what i do nothing happens. I connected the servo to the arduino with the red wire to 5v, brown to ground and orange to pin 6.
#include <Servo.h>
Servo myServo;

void setup(){
myServo.attach(6);
}

void loop() {
myServo.write(0);
delay(1000);
myServo.write(60);
}

I have been using this code to test it.
Another weird occurrence is when i disconnect the servo it sometimes start moving very slowly even though it has now power. I dont think the Uno is broken as other projects work fine on there, are my servos fried?

My guess is your drawing too much current from the Arduino 5v rail.
Try connecting the servo to it's own 5v source with of course a common ground with the Arduino.

I tried connecting it to a 9v and it did not work, would the results be any different with 5v?

You connected the servo to 9v ?

yes i connected it to a 9v and the ground to the arduino

Is your servo motor 9v tolerant ?

I will look into that and test it with some smaller batterys.

I think i have broken my servos as i did use 9vs for a long time and they are only meant for 3 - 7.2v (according to the amazon page).

I tested another servo i had - not one of the ones i have ever used before and it worked perfectly.

I found your problem. There is no delay at the end of the loop. So it runs myServo.write(0) then pauses for one second then runs myServo.write(60) immediately afterwards it starts the loop over and runs myServo.write(0) this happens before the servo has time to move.
To fix this add a delay at the end of the loop.
Try:
#include <Servo.h>
Servo myServo;

void setup(){
myServo.attach(6);
}

void loop() {
myServo.write(0);
delay(1000);
myServo.write(60);
delay(1000);
}

this doesn't change anything as i do not think it is to do with the code, even if i put myServo.write(50) in void setup the servo would do nothing.

Did you try the program? When you put myServo.write(50) in the void setup was there code in the loop? There is no delay in between the setup and loop. Try: void setup(){myServo.attach(6) myServo.write(50)} void loop(){}


text:
Controlling dynamixel AX12 by Arduino
Actually, i would like to control   12 motors of AX-12 using Arduino .. I could control just 2 motors. However when i send a command to the 12 motors they don't move and one or 2 of them move randomly!
could you please help me to find solution of that ???
note :
I am using an external power with 12 Volts and 5 amp maximum

source: Stack Exchange

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

sort: votes


text:
Can d2xx connect to an arduino mega 250?
I am trying to replace a device which used a FTDI chip (http://www.ftdichip.com/Drivers/D2XX.htm) to get USB to serial. I need some more code on the chip, so I want to use an arduino mega 2560 instead. However, there is quite a lot of software which talks to the FTDI-based solution, some of which is not maintained by myself.
Can I write a program for arduino mega which makes it look to the PC software like I am still a FTDI chip? I am somewhat concerned, because the FTDI requires special drivers, so any software will try to use this driver to connect to the arduino, which does not have a chip that is native to the d2xx driver.
Best,
Alex
PS: If I am not mistaken, arduino used those FTDI chips in the past, but switched to ATmega8u2 for arduino UNO, and to ATmega16U2 for arduino mega 2560.

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


text:
Plotting data from Arduino and using the serial monitor in parallel
I'm very new to the Arduino world so bare with me.
I would like to plot live data that I receive from my arduino. I use the Serial Monitor to read user input, show text, etc.
The only way I found to plot data from the arduino is by printing the data out in the serial monitor
I would rather prefer the data not to be shown in the serial monitor at all (just from a visual standpoint) but I guess there is no way around it.
Anyways, I would like to read and plot the data only when the user makes a specific input into the Serial Monitor.
Let's say the user types in: "start"
now the arduino prints out the values that needs to be plotted.
But every plotting tutorial on plotting with the arduino that I could find always prints out the data right from the start. I want to start the plotting with the specific user input.
I hope I could explain my question well enough.
Thank you in advance for your help.
Luca

What plotting tutorials have you looked at? Have you tried programming a plotting application in processing? Then you should be able to write code, that will implement the mentioned interaction

the title does not match the question ... please correct it

You're right: Unfortunately, you cannot combine the SerialPlotter part of the Arduino IDE with the SerialMonitor tool in parallel. (COM port blocked). Check @chrisl's hint writing a PC application...

You can also use the Serial Plotter in the Arduino IDE. If you use Serial.println(<some number>) and then open the Serial Plotter(Tools-Serial Plotter), you will see a live graph. Based on your baud rate, the update speed will change. It is very powerful.

Is using the Serial Monitor a requirement, or are you just looking for a good way to get and plot the data?  If the latter, you may be interested in the open-source DaqPort sketch. https://www.daqarta.com/dw_rraa.htm  This was created to use the Arduino as a peripheral for data acquisition, as opposed to the more typical case of the Arduino being the central device.  With DaqPort you can program in any language you like on the host computer, and use it to plot data from the Arduino. The Daqarta software package that includes DaqPort has several examples that use Daqarta's macro language to implement a multi-channel chart recorder, high-speed multi-function oscilloscope, timers, signal generator, etc.  You can use these for free, forever, even after Daqarta's 30-day trial ends.  Since Daqarta already has plotting, you may find it simpler to use than rolling your own, perhaps by modifying one of the examples.

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


text:
Reconnect to a com port
I want my Arduino to log data while connected to a battery.
After few hours, I need to reconnect the Arduino via COM port to a PC and read the logged data.
The com port will not reconnect. This is part of the code I am using. It works if I am not disconnecting the com port. Any idea how to fix this?
if (digitalRead(buttonPin) == HIGH) {
    LoopIndex=0;
    Serial.begin(9600);
    Serial.println("Start printing");
    while (LoopIndex < MinCounter) {
        // print the results to the serial monitor:
        Serial.print("Time = ");
        Serial.print(PressurePerMin[LoopIndex++]);
        Serial.print("\t sensor = ");
        Serial.println(PressurePerMin[LoopIndex++]);
    }
 }

Serial.begin(9600); does not "connect". Actually, plugging in/out the USB cable from an Arduino Uno does not affect the Serial port directly. Connecting to the COM port on the PC side might however reset the arduino. (There are several ways to avoid this)

Your snippet does not show the problem you describe. A minimal but complete test environment is highly recommended.

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


text:
Sending command through SPI on Arduino UNO
I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.
#include <SPI.h>

int value1 = 0x8026;
int value2 = 0x0801;
int value3 = 0x8027;
int value4 = 0x0000;

void setup (void)
{
  Serial.begin (9600);
  Serial.println ("Starting");
  digitalWrite(SS, HIGH);  // ensure SS stays high for now

  // Put SCK, MOSI, SS pins into output mode
  // also put SCK, MOSI into LOW state, and SS into HIGH state.
  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();

  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV4);

}  // end of setup

void loop (void)
{
  // enable Slave Select
  digitalWrite(SS, LOW);

  SPI.transfer (1);   // initiate transmission
  SPI.transfer (value1);
  SPI.transfer (value2);
  SPI.transfer (value3);
  SPI.transfer (value4);

  // disable Slave Select
  digitalWrite(SS, HIGH);

delay (1000);
}

transfer sends a byte only. See SPI.transfer16(intval); if necessary

Not sure about the int valuex and using the SPI.transfer() function.

A couple of things to know:

You are storing an unsigned 16-bit literal into a signed 16-bit variable. You should be using uint16_t value1 = 0x8026; etc. Also, unless you are planning to change the values, they should be const.
SPI.transfer() transfers only 8 bits of data. You are only sending the lowest byte of your valuex variables. SPI.transfer16() sends an unsigned 16-bit value.

To illustrate, this is how your program should look:
#include <SPI.h>

const uint16_t value1 = 0x8026;
const uint16_t value2 = 0x0801;
const uint16_t value3 = 0x8027;
const uint16_t value4 = 0x0000;

void setup(void) {
    Serial.begin(9600);
    Serial.println("Starting");
    digitalWrite(SS, HIGH);  // ensure SS stays high for now
    // Put SCK, MOSI, SS pins into output mode
    // also put SCK, MOSI into LOW state, and SS into HIGH state.
    // Then put SPI hardware into Master mode and turn SPI on
    SPI.begin();
    // Slow down the master a bit
    SPI.setClockDivider(SPI_CLOCK_DIV4);
}  // end of setup

void loop(void) {
    // enable Slave Select
    digitalWrite(SS, LOW);
    SPI.transfer(1);    // initiate transmission
    SPI.transfer16(value1);
    SPI.transfer16(value2);
    SPI.transfer16(value3);
    SPI.transfer16(value4);
    // disable Slave Select
    digitalWrite(SS, HIGH);
    Delay(1000);
}

That will transfer the stream of 8-bit values:
0x01 0x80 0x26 0x08 0x01 0x80 0x27 0x00 0x00

Hi, and thank you.  I believe the code is right but I do not get any signaling out of MOSI pin 11; it does go from high to low.  I can 'see' (with an oscilloscope) SS pin 10 go low, I can see only 3 clock pulses on pin 13.  I am not concerned with any incoming data.

Also, when I added 16 to SPI.transfer, transfer changed from blue to black color.

The code works perfect!  Thank you and I wish I had sent this sooner.  Thanks again!

@howdyrichard Accept the answer if it worked for you


text:
Problem with serial connection. Data garbled
I have a hardware device that sends data over the serial port and over a socket connection.
I have the TX of the device connected to the RX of the ESP8266, RX of the device to TX of the ESP8266.
Comm speed is set to 115200 on both.
Code is nothing more than
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}

void loop() { // run over and over
  if (Serial.available()) {
    Serial.write(Serial.read());
  }
}

I listen on the socket and on the serial port at the same time. On the socket port i get correct data (ASCII characters). On the serial monitor of the Arduino i get garbled data. Also, it looks like the Arduino IDE cannot cope with the volume of data. I am sending appx 100 char/sec.
Any ideas?
Update Aug 13 '18
Ok, I found out that I was trying to hook up an RS232 to an UART and that, to accomplish this, I need a RS232 to TTL converter like the max3232. I will go that road and update the question if I have it.

Ok, i found out that i was trying to hook up an RS232 to an UART and that, to accomplish this, i need a RS232 to TTL converter like the max3232.
I will go that road and update the question if i have it.

What is this mystery device?

and how is Serial Monitor connected?

Mystery device is an RFID reader. Serial monitor is connected via the USB port and launched from Arduino IDE..

What RFID reader? The reason I ask is that not all serial connections are equal. I need to know the exact device so I can look up the manual / datasheet and discover what kind of serial connection it has. There is a chance you may require extra hardware between the device and your ESP8266.

I think RS232 signals are outside the TTL limits; I don't know if you've done any permanent damage.
On the interfacing itself:
https://www.sparkfun.com/tutorials/215
On the damage part:
https://forum.arduino.cc/index.php?topic=26139.0


text:
Connecting two Arduinos via I2C while I2C Pins A4/A5 are already in use
I have the following problem:
Since the BH1750 Sensor only supports two different I2C adresses, but i need to use 6 of those sensors, i wanna use 3 arduinos, 2 nanos, 1 uno and send the data from the nanos to the uno. Problem is that the I2C bus is already in use and while trying to send data, it does not work properly.
Is this even possible? When trying it out, i can't get anything correct

Update:
That's what i tried now:
Results i get are still not correct

#include <Wire.h>
#include <BH1750.h>

// This code will feature the use of 6 gy 30 light sensors

BH1750 active_sensor(0x23); // We will use this adress for stating the active sensor
BH1750 inactive_sensor(0x5C);

void setup(){

  Serial.begin(9600);

  // Setting the input pins for controling the addr pins of the modules
    pinMode(8, OUTPUT);
    pinMode(9, OUTPUT);
    pinMode(10, OUTPUT);
    pinMode(11, OUTPUT);
    pinMode(12, OUTPUT);
    pinMode(13, OUTPUT);

    digitalWrite(8, LOW);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);
    digitalWrite(11, LOW);
    digitalWrite(12, LOW);
    digitalWrite(13, LOW);

  // Initialize the i2c bus
  Wire.begin();

 // Here we will set the mode of the module
  if (active_sensor.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) {
    Serial.println(F("BH1750 Advanced begin"));
  }
  else {
    Serial.println(F("Error initialising BH1750"));
    Serial.println("Problem on 1");
  }
}

void loop() {
  get_values();

}

void get_values(){
  int i;
  Serial.println("----");
  for(i = 8; i<=13;i++){
    digitalWrite(i,HIGH);
    delay(50);
    int lux = 0;
    lux = active_sensor.readLightLevel();
    Serial.println(lux);
    delay(50);
    digitalWrite(i,LOW);
    delay(150);
  }
}

the Question update is based on CrossRoads's answer

comment to question update. with ADDR HIGH address is 5C. change the address of active device to 5C.

you should accept CrossRoads's answer to mark this question solved

Use the ADDR pin as a chip select. Pull both pins high normally. When you want to talk to one, pull the ADDR pin low and use the ADDR = 0 address to talk to the selected device. Then you can have all 6 connected to one Arduino.

I actually tried this before, it did not work properly. Do you have any evidence that this really works?

Post the code of what you tried with all 6 devices connected as suggested. Make sure the devices are all getting power.

There is a simple sketch here you can try for 1 device, then easily modify to cycle thru all 6. Be sure to add 4.7K or even 3.3K pullup resistors to SDA and SCK. The internal pullups in a '328P are not enough.

Ok, i just posted the code i am using, i did not use any resistors by now. So only 1 resistor or one for each sensor?

https://media.digikey.com/pdf/Data%20Sheets/DFRobot%20PDFs/SEN0097_Web.pdf  Yes, one resistor each on SCL & SDA, at the end of the wiring chain preferably.   Not at each device, just at one device.

I tried what you told me, i provided a schematic and the code i used, yet i still don't get what i desire, can you have a look at it?

You can make the nanos use software I2C to isolate those I2C buses from the UNO's I2C bus. Then have the UNO be the master on it's own bus, requesting the data when needed.
Though if you go for software I2C you can make the UNO do all the I2C work, assuming you have enough free pins for that.
Another option is to get a proper I2C multiplexer like the TCA9548A.

Six software i2c busses requires 7 pins. That is 6 sda lines and just 1 scl line. The ADDR selection to bring one sensor in focus is easier, but requires 8 pins. The tca9548a still requires 5 pins (two i2c plus three address for 6 busses).

@Jot But you only need 3 buses because a pair of sensors can share a bus. Also the address pins of the tca9548a can be statically tied, the actual multiplexing is done internally. You write to the tca9548a itself through I2C (that is what the address pins are for) to select which channels should be open and then it passes through the I2C bus signals to those open channels. You can then close the channel when you are done.

Thanks, I didn't think about that. So it will be 4 pins for a software i2c, 8 pins for ADDR selection, and 2 pins for the tca9548a.


text:
How to get the overall average of the data received
I have an arduino uno with two sensors. Voltage and current sensors. I need to get the average value of voltage and current each time the data is received. But i don't know how to add up the current and previous values and divide it to how many values that it has received.
Can someone help me, please? I need it for my project
This is the code i have made
void setup(){
Serial.begin(9600);
}
void loop(){
    int n=5;
    float sum=0;
    float ave=0;
    for(int x=0;x<n;x++){
        float volt=analogRead(A0);
        float voltage = map(volt,0,1023,0,2500);
        voltage/=100;
        Serial.print("Voltage: ");
        Serial.print(voltage,2);
       sum=sum+voltage;
       }
ave=sum/n;
Serial.print("Average: ");
Serial.print(average,2);
delay(3000);
}

But this only takes the average of 5 datas. I want to get the average of all data received.

Cheat: https://github.com/MajenkoLibraries/Average

it's actually communicative: (1/3 + 2/3 + 3/3) == (1+2+3)/3

@Majenko does your library offer cumulative average, running average, exponential average, or any/all of those?

To the OP, do you want a cumulative average? As mentioned in the comments on DataFiddler's answer, with a very large number of samples the average will change so slowly that it will be hard to detect a change. (e.g. After a million samples have been averaged, if the input value suddenly change to 0, it will take 100,000 new samples, all at 0, for the average value to change by 10%)

You might want to use an exponential value or other rolling average instead.

My library offers all sorts of averages and statistical analysis of the data.

void setup(){
Serial.begin(9600);
}
void loop(){
    static unsigned long count=0;
    static float sum=0;
    float ave=0;
    int volt=analogRead(A0);
    float voltage = map(volt,0,1023,0,2500) / 100.0;
    Serial.print("Voltage: ");
    Serial.print(voltage,2);
    sum=sum+voltage;
    count++;
    ave=sum/count;
    Serial.print("  Average: ");
    Serial.println(ave,2);
    delay(3000);
}

This runs quite a while. The average is restarted only with a Reset of your arduino.
Alternatively, you might want to learn about a moving average (aka low pass filter)

You println an unknown variable average.  You declared ave. You should also mention that with this method the algorithm can only run some time until float overflows. A saver way would be A(1) = x(1); A(n+1) = A(n) * (n/(n+1)) + x(n+1)/(n+1). "A(n) = avarage in the n-th iteration; x(n) the n-th sensor value."

ave fixed. It will overflow after 400 years of uninterrupted operation, thanks to delay(3000);

This code receives equal value or output for voltage and average of it. Maybe it doesn't count the previous datas it received

Did you observe the static keyword of sum? Eventually you add more Serial.println to check sum and count as well for debugging?

Oh. I got it! Thank you so much. I just put a wrong variable on the serialprint for average.

@Peter Paul Kiefer:  n/(n+1) will become 1 or overflow as well. That's not a real solution. The problem is not too realistic anyway, as after some time the average will be pretty constant.

Yes that's correct - it's not a good solution. It would be better to add a fixed number of values say the last 40, 80, or 150 ones to get a moving average. The reason for which I ask you to mention that the variable can overflow, is because the OP could possibly decrease the measurement interval and then the overflow could be a problem. I did not think about my solution so long, so I made the mistake, that the n could overflow too. So yes, my idea is not better than your way of doing it.


text:
double to char* conversion. Weird results from dtostrf
Here’s the code:
void setup()
{
    Serial.begin(9600);
    delay(300);

    double lat = 1111.11;
    double lon = 4444.44;

    const byte len{10};

    char sLat[len];
    char sLon[len];

    dtostrf(lat, len, 2, sLat);
    Serial.println(sLat);

    Serial.println("---");

    dtostrf(lon, len, 2, sLon);
    Serial.println(sLon);
    Serial.println(sLat); // <-- prints nothing!

    Serial.println("---");

    dtostrf(lat, len, 2, sLat);
    Serial.println(sLat);
    Serial.println(sLon); // <-- prints nothing!
}

void loop()
{
}

Here’s the output:
   1111.11
---
   4444.44

---
   1111.11
   4444.44   1111.11

As you see. Every next call for dtostrf ruins the previous results, in a weird way.
What’s the problem?

If len is the text array size, you need space there for the terminating '\0'.
So the second paramater to dtostrf has to be smaller than len.

Yeah, of course, your're right! Thanks a lot! I fixed declaration: char sLat[len+1]


text:
Dht 11 sensors give null value
void Sensor_value()
{   server.handleClient();
    humidity = dht.readHumidity();
    temperature = dht.readTemperature();
 }

I want to make condition if temperature = null and Humidity= null that means the sensor fails to take reading so I want to return and take value again

both functions readHumidity() and readTemperature() have float as return type. NULL is a value of type pointer, so you will never get NULL as a result from these functions. I think the library returns NAN if it fails to read from the sensor

The way to do this is:
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);

if (isnan(h) || isnan(t) || isnan(f)) {
  Serial.println("Failed to read from DHT sensor!");
  return;
}

See https://www.hackster.io/MisterBotBreak/how-to-use-temperature-and-humidity-dht-sensors-9e5975 and https://stackoverflow.com/questions/40874880/getting-nan-readings-from-dht-11-sensor.
NULL should only be used with pointers.


text:
motor driver only works on one side:
I have 3 motor drivers and all 3 other them only seem to only work on one of the 2 sides. I have used a voltmeter to check the voltages across the each of the 2 sections on each motor driver. For all 3 of the motor drivers, 2 of them had one side which had a voltage of 5V (which should be 7.2 volts as thats the power supply) and the other sides of the 2 motor drivers was 0-0.05V (so effectively no voltage). The other motor driver had no voltage from either of the 2 sides. Are all 3 of the motor drivers faulty or have I broke them? The schematic for the motor drivers was as follows:

(Apart from instead of a 12V source, a 7.2V source is used buts thats the amount of Volts I need for the motors. The arduino I used was an Arduino mega rather than an UNO shown in this diagram as I got this diagram off the internet)
Heres a link for the place where I ordered the motor drivers from:
https://thepihut.com/products/l298n-motor-stepper-driver
Here is my code:
    #include <PS2X_lib.h> //for v1.6
    int enA = 3;
    int in1 = 8;
    int in2 = 7;
    int enB = 9;
    int in3 = 5;
    int in4 = 4;
    int error = 0;
    byte type = 0;
    byte vibrate = 0;
    int light_one_pin = 36;
    int light_two_pin = 38;
    bool lights_on = false;
    PS2X ps2x;
    void setup(){
     Serial.begin(9600);
     pinMode(enA, OUTPUT);
     pinMode(in1, OUTPUT);
     pinMode(in2, OUTPUT);
     pinMode(in3, OUTPUT);
     pinMode(in4, OUTPUT);
     pinMode(light_one_pin, OUTPUT);
     pinMode(light_two_pin, OUTPUT);

     //CHANGES for v1.6 HERE!!! **************PAY ATTENTION*************
     for(int x = 0; x < 100; x++)
     {
      error = ps2x.config_gamepad(13,11,10,12, true, true);   //setup pins and settings:  GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
     }
     error = 0;

    }

    void loop() {
      ps2x.read_gamepad(false, vibrate);

      if(ps2x.ButtonPressed(PSB_GREEN) && lights_on == false)
      {
         digitalWrite(light_one_pin, HIGH);
         digitalWrite(light_two_pin, HIGH);
         lights_on = true;
         Serial.println("on");
      }
      else if(ps2x.ButtonPressed(PSB_GREEN) && lights_on == true)
      {
          digitalWrite(light_one_pin, LOW);
          digitalWrite(light_two_pin, LOW);
          lights_on = false;
          Serial.println("off");
      }

      if(ps2x.Analog(PSS_LY) < 128)
        {
          digitalWrite(in1, LOW);//all fowards wheel
          digitalWrite(in2, HIGH);
          digitalWrite(in3, HIGH);
          digitalWrite(in4, LOW);
          analogWrite(enA, 255);
          analogWrite(enB, 255);
          Serial.println("forwards");

        }

        else if(ps2x.Analog(PSS_LY) > 128)
        {
          digitalWrite(in1, HIGH);//all backwards wheels
          digitalWrite(in2, LOW);
          digitalWrite(in3, LOW);
          digitalWrite(in4, HIGH);
          analogWrite(enA, 255);
          analogWrite(enB, 255);
          Serial.println("backwards");

        }

        else if(ps2x.Analog(PSS_LY) == 128)
        {
          analogWrite(enA, 0);
          analogWrite(enB, 0);
          Serial.println("stationary");

        }

        else if(ps2x.Analog(PSS_LX) == 128)
        {
            //Serial.println("still");
            //wheel_steering_servo.write(wheel_steering_servo_angle);
        }

        Serial.println(ps2x.Analog(PSS_LX));

    }

Please provide a link to the exact product that you are using for the motor drivers. And also show us your code. You can put those information into your question by editing it

@chrisl I have done that.

You have an UNO with pin numbers 36 and 38, eh?

@timemage Oh yeah sorry, my bad I forgot to mention it is an arduino Mega I am using

the correct thing to do, is to edit your post, instead of providing important detail in comments

Swap the motors left and right and see if the problem follows the motor. Swap the sets of INx/EN pins left and right and see if the problem follows the set of pins.

did you check if the library/shield requires some pins to be PWM pins?

Just a correction to something Coder9390 wrote:
The ENA and ENB pins on this motor drive are not supposed to be used as digital pins and receive HIGH or LOW, but as analog pins and receive a value in range 0-255 using a PWM pin (PWM pins are marked on the board with a ~). This enables you to control the speed of the motor, by simulating low voltage.
In your code you actually seem to do this correctly, so I don't think this is the problem. Setting the pinMode of ENA and ENB to OUTPUT on the other hand is correct, so it might actually be the problem. I couldn't reproduce your bug this way though, so it might be something else.
In case you don't need to control the speed of the motor and want it to always go full speed, you can use jumpers to short each EN pin with it's orthogonal-adjacent pin (which are marked in your image as 5v) to achieve the same effect of connecting them to 5v "manually" as Coder9390 suggested (basically by placing the jumpers there you are doing exactly that - connecting the EN pins to 5v).
Coder9390, if you implicitly meant to suggest using jumpers like this, then sorry for misrepresenting your answer. I thought it wasn't clear to beginners who might get here, and that it requires an elaboration.
See this motor driver usage explained here: https://create.arduino.cc/projecthub/ryanchan/how-to-use-the-l298n-motor-driver-b124c5

Very true, I having not much experience with these board, only knew that they enable the outputs, not control the speed, good info .

There are a couple of things that you can check-
Your code-
Chances are that all of the motor drivers are functional (as manufacturing defects are very rare) and that there is something wrong with the code.
1- The motor driver that you are using has 2 pins that should be labeled "ENA", "ENB" (or some variant of these), in order for the motor driver to work on both sides, both these pins must be high, if any one of these are low, then that side will not work. I highly recommend that you directly connect these 2 pins to 5V, and use the 4 inputs for the control.
2- The 4 input pins labeled "IN1", "IN2", "IN3", "IN4" are the pins that instructs the driver to move each side forward or back, check your code to make sure that these pins are high or low as per your requirement.
Another thing is that both the forward and back inputs of one side must not be high at the same time otherwise it won't work
Your hardware-
If you find that something is getting abnormally hot on the boards or worse if something is burnt, then you should check your circuit and make sure there are no problems.
--
A problem in your code, is that "ENB" is not set as an output and hence is not high, you should also modify the setup to set the "ENA", "ENB" to high to make sure that it is on.
So your setup should go something like this-
     Serial.begin(9600);
     pinMode(enA, OUTPUT);
     pinMode(enB, OUTPUT);
     digitalWrite(enA, HIGH);
     digitalWrite(enB, HIGH);
     pinMode(in1, OUTPUT);
     pinMode(in2, OUTPUT);
     pinMode(in3, OUTPUT);
     pinMode(in4, OUTPUT);
     pinMode(light_one_pin, OUTPUT);
     pinMode(light_two_pin, OUTPUT);


text:
I want my LED's to turn on for 5 sec when the Ultrasonic Sensor Activated
const int Trigger = 6;
const int Echo = 7;
const int LEDpin1 = 4;
const int LEDpin2 = 5;
const int Parameter = 400;
float Time;

void setup()
{
Serial.begin(9600);
pinMode(Trigger, OUTPUT);
pinMode(Echo, INPUT);
pinMode(LEDpin1,OUTPUT);
pinMode(LEDpin2,OUTPUT);
}
void loop()
{

digitalWrite(Trigger, HIGH);
delayMicroseconds(10);
digitalWrite(Trigger, LOW);
Time = pulseIn(Echo, HIGH);
Serial.print("Distance: ");
Serial.println(Time);
delay(10);
if (Time < Parameter)
digitalWrite(LEDpin1, HIGH);
else
digitalWrite(LEDpin1, LOW);

if (Time < Parameter)
digitalWrite(LEDpin2, HIGH);
else
digitalWrite(LEDpin2, LOW);

//**When I include -delay(5000)- right here, it also delays the Ultrasonic sensor to only detect every 5 seconds**
}

The answer is using non-blocking code involving the millis() function in a pattern like the BlinkWithoutDelay example shows. There are many tutorials about that on the web. When you learn that coding principle you will be able to solve your problem

Please format code as code (you can edit your post) so it's easier to read.


text:
Unknown text printing on Serial Monitor
I want to use the Serial Monitor for some debugging, but it prints something else.
Edit-
This only happens if  I use the attachInterrupt() function
I tried another program that does not use interrupts and there it works.
My code:-

/*
YF‐ S201 Water Flow Sensor
Water Flow Sensor output processed to read in litres/hour
Adaptation Courtesy: www.hobbytronics.co.uk
*/
volatile int flow_frequency; // Measures flow sensor pulses
unsigned int l_hour; // Calculated litres/hour
unsigned char flowsensor = 13; // Sensor Input
unsigned long currentTime;
unsigned long cloopTime;
void flow () // Interrupt function
{
   flow_frequency++;
}
void setup()
{
   pinMode(flowsensor, INPUT_PULLUP);
   Serial.begin(9600);
   attachInterrupt(0, flow, RISING); // Setup Interrupt
   sei(); // Enable interrupts
   currentTime = millis();
   cloopTime = currentTime;
}
void loop ()
{
   currentTime = millis();
   // Every second, calculate and print litres/hour
   if(currentTime >= (cloopTime + 1000))
   {
      cloopTime = currentTime; // Updates cloopTime
      // Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min.
      l_hour = (flow_frequency * 60 / 7.5); // (Pulse frequency x 60 min) / 7.5Q = flowrate in L/hour
      flow_frequency = 0; // Reset Counter
      Serial.print(l_hour, DEC); // Print litres/hour
      Serial.println(" Lhour");
   }
}

Data from Serial Monitor:-
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
⸮⸮⸮⸮⸮⸮ISR not in IRAM!

User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Abort called

>>>stack>>>

ctx: cont
sp: 3ffffef0 end: 3fffffc0 offset: 0000
3ffffef0:  feefeffe feefeffe feefeffe 00000100
3fffff00:  000000fe 00000000 00000000 00000000
3fffff10:  00000000 00000000 00000000 00ff0000
3fffff20:  5ffffe00 5ffffe00 3ffef0a4 00000000
3fffff30:  00000001 00000000 3ffee34c 40201e72
3fffff40:  40100402 40202e51 ffffffff 40201e84
3fffff50:  feefeffe 00000001 3ffee34c 40202399
3fffff60:  00000000 00000001 3ffee324 4020129c
3fffff70:  00000000 feefeffe feefeffe 3ffee38c
3fffff80:  3fffdad0 00000000 3ffee34c 40202448
3fffff90:  3fffdad0 00000000 3ffee34c 40201079
3fffffa0:  feefeffe feefeffe feefeffe 40201a80
3fffffb0:  feefeffe feefeffe 3ffe84e4 40100cfd
<<<stack<<<

Why is this happening?
Hardware-ESP8266 based NodeMCU

As the error says: your ISR is not in IRAM.

@Majenko What is that supposed to mean?

An ESP8266 ISR needs the ICACHE_RAM_ATTR prefix to force it to stay resident in IRAM (so it does not need to be run from SPI flash when an interrupt occurs). Your ISR definition should be: ICACHE_RAM_ATTR void flow () { .... For an explanation: See here. Also see this StackOverflow answer.

I’m voting to close this question because it is not a real Question

Please look at the edit


text:
Split Power supply in voltage and gnd?
I am new to electronics and arduino in general. I need to split a power supply in gnd and voltage. Basically, the power supply has one single wire (with the voltage and the gnd passing through it i think), and I need them to be separated. Sorry if this is a noob question, but I am really new to this whole thing.

Voltage is also called "electric potential DIFFERENCE". There is no such thing as "a wire with a voltage of 5V", but always "a 5V voltage with respect to this ground". Carrying away just the 5V wire is meaningless. And you can't carry both Vcc and ground on the same wire. So.. If you have one wire, there are TWO conductors. If they are coaxial (RGx cables), two wires or coated wires (like in cheap headphones), it doesn't matter. But.. You already have two wires. If you are not sure, post a photo and we'll try to figure out what are the two wires

Do you have a image of this? Logically, and as far as I know, One wire will not carry both GND and Positive.
Are you talking of a DC jack kind of thing?
BTW, I'm starting out here too!

It's exactly a DC jack that i needed! Thanks for the quick answer!

If the cable of the power supply contains voltage and gnd, it's two cables, with a layer between them.

On the inside they look much like coaxial cables, so if you softly cut the outer shell(A) you maye see a mesh of blank wires(B,C,D), they're gnd in most cases.
There also is an inner wire(C) which you have to cut softly, too.
That's the voltage carrying wire(D), in most cases. (If it's approx. less than 10 Volts, check with a LED.)


text:
System Is not Functioning Error. Windows XP, Arduino Uno R3, C# Listen SerialPort
Can anyone help me with this issue.
We created an arduino project. We listen microswitch.
If switch click, Arduino send basic serial data.
And C# application read serial port.
This solution is working but after more times (3Hours, 5Hours,..) system stoped.
Error message is "a device attached to the system is not functioning"
Solution: Usb remove and retry plug system is going to running.
We are try putty.exe maybe problem C# project but don't working.
If microswitch click don't flash "TX" or "RX" led.
const int button = 3;

uint64_t bounceTime = 50;
uint64_t holdTime = 250;
uint64_t doubleTime = 500;

uint64_t lastReading = LOW;
uint64_t hold = 0;
uint64_t single = 0;

uint64_t onTime = 0;
uint64_t lastSwitchTime = 0;

void setup() {
 pinMode(button, INPUT_PULLUP);
 Serial.begin(9600);
}

void loop() {

 int reading = digitalRead(button);

 if (reading == HIGH && lastReading == LOW) {
   onTime = millis();
 }

 if (reading == HIGH && lastReading == HIGH) {
   if ((millis() - onTime) > holdTime) {
     hold = 1;
   }
 }

 if (reading == LOW && lastReading == HIGH) {
   if (((millis() - onTime) > bounceTime) && hold != 1) {
     onRelease();
   }
   if (hold == 1) {
      delay(5000);
      reading = digitalRead(button);
      if(reading==LOW){
              Serial.println("B");
      }
     hold = 0;
   }
 }
 lastReading = reading;

 if (single == 1 && (millis() - lastSwitchTime) > doubleTime) {
   single = 0;
 }

}

void onRelease() {
 if ((millis() - lastSwitchTime) >= doubleTime) {
   single = 1;
   lastSwitchTime = millis();
   return;
 }

 if ((millis() - lastSwitchTime) < doubleTime) {
   single = 0;
   lastSwitchTime = millis();
 }

}

Why not uint32_t?

@MikaelPatel irrelevant

I assume that by "USB" you mean "USB-to-serial adaptor".
Try running the same code without any serial communications, just have an LED do the equivalent of printing, and power it from a good power supply. If it runs for more than five hours, the problem is with the USB adaptor and/or your PC (Windows XP? Really?), and hence not relevant to this forum.
If the code crashes, then maybe you have a marginal board, or there is some other environmental factor that's giving you trouble. The code looks OK on first glance.


text:
How to create a log file document which is not editable by a word processor on SD card
I'm using a Arduino Mega 2560  and SD card shield to make an industrial logging panel. Is there any way to write log data document in a read-only type file like a pdf on SD card so that the contents cannot be edited once created by word processing software? The data has to presented as a document on a windows machine.
Thanks in advance for your time – if I’ve missed out anything, over- or under-emphasized a specific point let me know in the comments.

Comments are not for extended discussion; this conversation has been moved to chat.

There is no such thing as a file that cannot be edited.
If a file can be read it can be edited.
However, there are ways of making it possible to know if a file has been edited - i.e., to integrity check the file. To make it hard to edit a file and maintain the intrinsic integrity of the file.
The simplest method is to create a checksum of the data in the file and store that in the file as well. If the data is, for example, a CSV file, you could include in each row a checksum of the data in that row as an extra column. If the data gets changed the checksum will no longer match. Of course, that doesn't preclude someone calculating the new checksum and entering that.  So maybe adding a checksum of all the checksums at the end of the file as well so you know if any checksums have changed.
Again, it's possible for someone to recalculate that checksum as well.
The most secure method is to digitally sign the file (in the way the PGP or GnuPG does). Without the private key, it's impossible to re-sign the file after modification. However, that kind of operation is comparatively heavyweight and not something an Arduino is particularly suited to doing (I'm not sure if it's even physically possible given the lack of resources an Arduino has).


text:
Arduino Nano no output on any controllable pins except for RX and TX pins
I have 2 Arduino Nanos which don't output anything on any controllable pins except for RX and TX pins. I used an LED which I have tested works on the 3.3v/GND and 5.0v/GND. When I try to control the RX and TX pins (1 and 2) the LED lights up on the board and the external LED I am using to test. I am using the example "Blink" program to test it, and I've tried it on both nanos. I've tested pins 26 (serial), 5 (digital) and 15 (digital) and none output anything. Why isn't it working?
    /*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

// Pin 13 has an LED connected on most Arduino boards.
// Pin 11 has the LED on Teensy 2.0
// Pin 6  has the LED on Teensy++ 2.0
// Pin 13 has the LED on Teensy 3.0
// give it a name:
int led = 26;

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

Anything. Please paste minimal test code demonstrating the problem.

It's the same as default

You are using a resistor with the LED? And it is .... ohm? And you connect to GND. Pin 26??? On an nano??

No, the LED doesn't need a resistor, yes I connected it to the relevant pin and ground.

What does a multimeter say when you check those pins for voltage levels?

@Matthew There is no pin 26 on Arduino. If you connect it to a analog/digital pin (they're all labeled) then you must use the same letter number combination. Most LEDs need resistors to limit the current to Arduino safe limits, are you sure you haven't burned any pins?

the LED doesn't need a resistor - why?

@NickGammon because I tested it with the 5v and 3.3v therefore higher voltages doesn't blow it up.

@Avamander See https://www.google.co.uk/search?q=arduino+nano+pinout&safe=strict&rlz=1C1MDNA_enGB657GB657&espv=2&biw=1440&bih=731&tbm=isch&imgil=DjW-X6jomBqBmM%253A%253Bk3TFJA7h4Hu5yM%253Bhttp%25253A%25252F%25252Fforum.arduino.cc%25252Findex.php%25253Ftopic%2525253D243653.0&source=iu&pf=m&fir=DjW-X6jomBqBmM%253A%252Ck3TFJA7h4Hu5yM%252C_&usg=__y-E6nlxoFgeWaZW9OJ5ZwOW-0Js%3D&ved=0ahUKEwj2j7rMi_PKAhUEWxoKHUSHBOkQyjcIMQ&ei=B0S-VrbwKoS2acSOksgO#imgrc=DjW-X6jomBqBmM%3A

Idea was to test it with the first digital pin, last digital pin and last analogue pin

Please read The care and feeding of LEDs. therefore higher voltages doesn't blow it up - however you are asking why your board isn't working properly.

@HollandWilson multimetre reports no voltage. I tried pins 5 and 15.

@NickGammon still doesn't work on pins that I haven't used, tested with the mutimetre

@Matthew I think you are confusing pin numbering. It is digital pin #n and analog pin # not the nano physical pin #. What you call 5 and 15 are digital pin 2 and 12,

@Matthew Numbers between 2 to 13 and A0 to A7 are accepted as valid pin numbers. The digitalWrite function expects the digital/analog pin number not physical pin number. In addition to that you've probably blown the physical pins 5 and 15 by drawing too much current.

I've tested pins 26 (serial), 5 (digital) and 15 (digital) and none output anything.
No, the LED doesn't need a resistor ...
because I tested it with the 5v and 3.3v therefore higher voltages doesn't blow it up

Sounds to me like you have damaged your output pins. Read The care and feeding of LEDs by Mike Cook.
The LED may briefly light up, but without a resistor you are damaging both the LED and the output pin. It is no surprise then, that afterwards the pins "none output anything".
Without a limiting resistor the output driver on the Arduino is overloaded and may burn out. Whether you have damaged the LED, the pin, or both, is hard to say.

(Edited to add)

still doesn't work on pins that I haven't used ...

Can you slow down a bit?

I've tested pins 26 (serial) ...

There is no pin 26 from the IDE point of view. On the board pin 26 is A7 (analog input 7) which cannot be used for digital input/output.
Please specify exactly what pin you tried (just choose one) and stick to the Arduino number (printed on the board, eg. D05) and then show the code you used to access that pin.

According to this ... the analogue pins can be used just the same as digital pins

That page shows a Uno. You have a Nano.
See Arduino Nano - Arduino.cc. On that page:

Analog pins 6 and 7 cannot be used as digital pins.

Added extra stuff to address comment about "still doesn't work".

According to this, http://waihung.net/arduino-tip-turn-your-analog-pins-into-digital-io/, the analogue pins can be used just the same as digital pins...

See amended answer. He shows a picture of a Uno. Don't believe everything you read on the Internet. In your case you have extended what one person said about one Arduino to think it applies to every Arduino.

I've managed to half fix the problem; I can use analogue pins as digital from A0 to A5, by referencing the pins as A+num rather then their physical location. However, the IDE doesn't recognise any D+num, so I still can't use the normal digital pins...

Digital pin 2 is just 2. For example: digitalWrite (2, HIGH); and for analog pins: digitalWrite (A3, HIGH); These are "board" pins, not the pins on the processor chip.

It seems I was getting all the pin numbers wrong... All pins work fine without the resistors.

No, the LED doesn't need a resistor ...
That is correct, but the processor I/O - output pin - does.
Check the schematic to see how RX /TX LEDs are connected.

So do the RX/TX pins have integrated resistors?


text:
Stop multiple presses in vex bumper (Unexpected bumper output)
According to Official documentation of the Vex Bumper, it states that the bumpers will cause:

the robot sometimes [counts] a press twice. This issue is also caused by the robot counting too fast and as the limit switch is released, a second press is registered by the robot.

The documentation suggests this code:
task main() {
    while(true) {
         string presses = buttonPresses;
         if(presses != last) {
             writeDebugStreamLine(presses);
         }
         last = presses;

         if(SensorValue(bump) == 1) {
             wait1Msec(5);
             while(SensorValue(bump) == 1){}
             buttonPresses++;
         }
    }
}

However, if you are like me, this didn't work at all, multiple button presses were registered from holding down the button for a moment and releasing it.

When you are testing buttons within a loop that runs repeatedly, there's no need for lengthy monolithic delays like wait1Msec(15), and no need to store and test start times, like time = time1[T1] and time1[T1] - time > 50.
Instead, you can change your loop so it takes at least some small time (as via wait1Msec(1) in following code sample), and add a holdoff counter that inhibits sensor testing during probable bounce periods.
string last;
long bumpCount = 0;
byte holdoff=0, isbump=0;

task main() {
  while (SensorValue(go) != 1) {
    string presses = bumpCount;
    if(presses != last) {
      writeDebugStreamLine(presses);
    }
    last = presses;
    wait1Msec(1);
    if (holdoff) {      // Ignore bump sensor during holdoff
      --holdoff;
    } else {
      if (SensorValue(bump)) {
        if (isbump==0) {
          ++bumpCount;  // Count a new closure
          holdoff = 40; // Start a holdoff period
        }
        isbump = 1;     // We detected bump is on
      } else {
        isbump = 0;     // We detected bump is off
      }
    }
  }
}

The code shown above acts as follows:
• Initially, bumpCount, holdoff, and isbump are zero, to indicate we haven't counted any bumps, are not inhibiting bump sensing, and think the bump sensor is off.
• Under initial conditions and while the bump sensor is off, we will pass through the outer while loop, each time waiting a millisecond, then taking the else branch of if (holdoff) and the else branch of if (SensorValue(bump)), so will repeatedly set isbump = 0, thus maintaining initial conditions.
• When the bump sensor goes on, we take the first branch of if (SensorValue(bump)).  From initial conditions, isbump==0 so we increment bumpCount and set holdoff = 40.  Lastly, set isbump = 1 to reflect sensor state.
• During the next 40 milliseconds or so (that is, during the holdoff period) we repeatedly decrement holdoff, while ignoring the bump sensor, which may bounce a number of times or not, as it pleases, but we don't care.
• After the holdoff period, SensorValue(bump) may still be true.  But since isbump==0 is false, we don't change bumpCount.
• If the bump sensor opens after the holdoff, isbump will go zero, restoring two of the initial conditions.  If it opens during the holdoff and stays open, the same thing happens at the end of the holdoff.

Because this problem was so infuriating and strange, I managed to do a workaround which the program refused to take a sudden addition to button counts after taking a first one. This enabled me to use the button without multiple extra counts.
string last;
float buttonPresses = 0;
float time = time1[T1];
bool isFirstTime = true;

task main()
{
    ClearTimer(T1);
    clearDebugStream();
    while(SensorValue(go) != 1) {

        string presses = buttonPresses;
        if(presses != last) {
            writeDebugStreamLine(presses);
        }
        last = presses;

        if(SensorValue(bump) == 1 && buttonPresses < 6) {
            if(isFirstTime || time1[T1] - time > 50) {
                isFirstTime = false;
                wait1Msec(15);
                while(SensorValue(bump) == 1){time = time1[T1];}
                buttonPresses++;
            }
        }

    }
}

If you want extra probability against multiple extra "presses" you can widen the interval of tolerance (in this case the 50 value) to something larger, but it makes it less accurate at registering quick taps.


text:
Do I have a faulty arduino uno, or have I found an Arduino bug?
Lately, we got an old arduino uno donated from a friend and have been trying to get it to work with servos. We have been having very perplexing results. We have tried many different "stock" code and servo combinations with our servos, but here is the behavior:

180 Servos automatically move to right max as soon as power is applied.
Sail Winch servo moves a tiny amount and then stops. If power wire is removed and then reapplied, the servo moves another tiny amount.

The code is very simple. First we call the servo.attach(pin), and confirm the pin. We have also tried doing the manual uSec definition: servo.attach(pin, 600, 2400). In our loop() we have tried servo.write(*value from 0-180*) and servo.writeMicroseconds(*value in PWM range*)
Power is being supplied by a 9v battery, the sensor (yellow) is directly in digital pwm pin, while red (power) is in + and black (ground) is in -.
I'm trying to decide whether I should invest in another arduino system.
servos:
180 servos
Sail Winch servo

I'd invest in a better power source first.

@IgnacioVazquez-Abrams The 9v is for testing purposes, we have a better battery for the actual power source. Also why would investing in a power source take priority over a proposed faulty system?

Because a 9V battery is a terrible power source, especially if you have high-load devices such as servos.

@IgnacioVazquez-Abrams in what way is is terrible? Amperage? Would that affect how the servos respond to code?

When the servos try to move, they draw current. When the current increases, the voltage drops. When the voltage drops, the Arduino fails.

If the Arduino "fails" the moment you apply power to a motor, you can bet that it is a power issue.
Or possibly you are exceeding the output rating of the output pin. You should not draw more than 20 mA from each output pin continuously.

I'm trying to decide whether I should invest in another arduino system.

Power the motor independently of the Arduino. This is normal advice for all but very small motors. Also make sure that you have a suitable driving transistor / MOSFET if the motor draws more than 20 mA. Take into account any surge startup current.

See Driving motors, lights, etc. from an Arduino output pin for some design ideas.
For example:

We built a small battery out of several AA batteries lined in series connected to a bread board. That was our original power source. We were also using a separate 9v battery for ease of testing. The 180 servos are rated "Current Drain (6.0V): 7.7mA/idle and 180mA no load operating",  and the 360s rated "Working  Current: 0.30~0.35A ". Does this mean we need to have a "driving transistor"?

Your working current of 300 mA far exceeds the 20 mA continuous output of the processor (by over 10 times!). See amended reply.


text:
Connecting Load combinator to HX711 then to Arduino
i'm currently a student and my project is to create a weighing scale using 50kg load sensors (x4) with HX711 amplifiers, load combinator and Arduino UNO. I've connected the load combinator and HX711 based on the picture below:

I'm wondering after this connection, how do i connect it to the pins of Arduino UNO and does anyone know the codes to make the load sensors work? Because currently i keep getting 0kg as the final value as well as the offset value.

How have you connected it to the Arduino? What code are you running? How are the rest of the pins on the bridge board wired?

part of your school learning is how to do research. ... i do not think that research is asking someone to give you the answer.

To be able to wire load sensors up you first need to understand how they work and what the wires on them actually mean. There are no standards as regards colour coding of the wires.
So step one is to find out the colour coding of your load cells. Assuming they are "normal" cheap 3-wire ones, internally they look like:

simulate this circuit – Schematic created using CircuitLab
You need to identify those wires on your cells.  We'll call them +, C and - (in that order) from now on.
The idea is that you provide power between + and - and a varying voltage comes out of C depending on the load applied. More load means a lower voltage, since R1 and R2 form a simple potential divider.
However that's not enough to get good results - the voltage differences are too small. So they are usually used as part of a Wheatstone Bridge. This allows a much smaller voltage variance to be detected.
The Wheatstone Bridge is created by the combinator board. It does it by combining the individual parts of separate cells together to form just two load cells along with the static resistances.  This is the form the Wheatstone Bridge create takes:

simulate this circuit
I have boxed in each load cell so you can see how two "variable" legs combine into a single variable resistance, and two "static" legs combine into a single static resistance.
Now you can see how you could test the combinator to make sure it's giving proper results. Apply a voltage between E+ and E- (say 5V) and measure the voltage between A+ and A-. Apply pressure to the load cells (all of them at once) and observe a change in the voltage between A+ and A-.
Assuming that is showing good results (the voltage change will be quite small, so set your DMM to its most sensitive setting), your next point of call is the connection to the Arduino itself.
The HX711 uses a digital serial protocol. Sparkfun has software that bit-bangs that protocol over any pair of IO pins you choose. There is nothing special about which pins are chosen - any two can be used. So as long as you have +5V, GND and the two data pins connected up to the Arduino there's not much that can go wrong.
So that then leaves the software.  The biggest mistake people often make is to not tell the software which pins are being used for the serial communication. Or telling it the wrong pins - getting the clock and data pins mixed up, for instance.  This would be the first port of call for checking the software. Make sure you have the right pins specified.  Quite how you do that without seeing your software I can't say, but Sparkfun have some example software (scroll down to the bottom of the page) which just uses a pair of #define macros to specify the pins.

Those cheap load cells are half-bridges.  The glued-on strain gauge has a patch with two variable resistor-strain gauges on the center bar of the disk.  Much like https://www.omega.com/en-us/force-strain-measurement/strain-gauges/dual-parallel-strain-gauges/p/SGT-Half-Bridge-Uniaxial   When the disk is supported on the ring, and loaded on the rivets on the E in the OP's pics, the center bar bends like a sigmoid function, one gauge compresses, and one gauge extends. They match resistances of the gauges by printing them w/same technology. R1,3,7,8 aren't constant, but vary opposite R2,4,5,6

thank you for your help to my question and sorry i was not being specific enough.
Initially the connection of the weighing scale was based on this:

However, after much research, i've decided to give the load combinator a try and use it to connect all the 4 load sensors to form a Wheatstone Bridge that will then connect to the Arduino. So basically, the load combinator is just another add on component.
As for my codes, this is how it looks like:
#include <hx711.h>
#define DOUT 3
#define CLK 2

Hx711 scale(3,2);

int count=0;

float sum=0;
float value;
float avg=0;
float offset;
float toffset;

int count2;

float V;
float VT;
float total;
int t;
float foffset;

void setup()
{
  Serial.begin(9600);
  Serial.println("HX711 Test");
}

void loop()
{
  for(count=0;count<10;count++)
  {
    value = (scale.getGram()*0.07);
    sum = sum + value;
  }
        toffset = +(sum / 10);
         Serial.print("Offset: ");
        Serial.print(toffset, 1);
        Serial.println(" kg");

        Serial.println("Please stand on the plate and do not remove both of your legs.");
        delay(4000);

  for(count2=0;count2<10;count2++)
  {
    V= (scale.getGram()*0.07);
    total=total+ V;
  }

  VT=(total/10);
  Serial.print("Average Weight: ");
  Serial.print(VT, 1);
  Serial.println(" kg");

   if(foffset= -toffset)
   {
    Serial.print("Final Weight: ");
    Serial.print(((VT+foffset)*-1), 1);
    Serial.println(" kg");
   }
 else
  {
    if(foffset=toffset)
   {
    Serial.print("Final Weight: ");
    Serial.print((VT-foffset), 1);
    Serial.println(" kg");
   }
 }
 Serial.end();
}

You should not answer your own question with information about your question. You should edit this into your question and delete this answer. I will leave it here for now to give you easy access to it, but it will be deleted soon.


text:
GPS timestamping of digitized voltages from geophones
I wonder if anyone has written a code for GPS time stamping of voltages from seismic geophone (or any other sensors) digitized by internal or better external ADC connected to Arduino? Since the accuracy of at least 1 millisecond is required I believe using 1 PPS signal of the GPS is the only solution.

What's your application?  There have been questions from... ahem... other people asking how to locate an elephant using this technique.

I am sorry for being vague. The application is to read acceleration or any other vibration monitoring sensor data in three components which has analog output in terms of voltage. The voltage readings need to be digitized and accurately time stamped and stored on microsd card. For now I am concentrated on millisecond accuracy of data stored. The next phase is to use external ADC since Arduino built in ADC has only 10 bits of resolution.

To tackle the time resolution and accuracy issue you could:

Attach the 1PPS signal to an interrupt pin
In the interrupt routine record the millis() value at the time the 1PPS signal is activated
In the main loop do a non-blocking read of the GPS data to find and build up the time string as it is sent from the GPS (shortly after the 1PPS is triggered).

You now know what the millis() count was the last time a 1PPS pulse arrived, and you know the current time to within a second. The 1PPS pulse will be at HH:MM:SS.000 (or as near as damnit) so if you subtract the current millis() from your recorded 1PPS millis() value it gives you the number of milliseconds since the 1PPS pulse. Add that to the current time, and you have 1ms accuracy in the time: HH:MM:SS.iii.

The OP could probably use micros() instead of millis().  Along with using an Input Capture pin for the PPS, he should be able to get sub-millisecond resolution.
And for a non-blocking GPS library, you can't get any better than NeoGPS.  It's smaller and faster than anything else out there.

I doubt anyone has written software for your exact situation but you should be able to cobble something together if we break down the problem.

You want to read a value from an Analog port (or external ADC)
You want to read the time from a GPS.
You want to write these two readings to 'somewhere'.

Looking at the Arduino IDE tutorials there are some Analog ones that would be relevant.  But the only line you need is int sensorValue = analogRead(analogInPin); which reads a value between 0 and 1024 which relates to the output range of your sensor.
Now you want to read from a GPS, looking at the Software Serial Library Examples there is an example of how to setup a second serial port to read the GPS data. The GPS data will arrive once every 2 seconds.  The PPS signal will arrive once every 1 second.  So I'm not sure how you are going to use this to get millisecond accuracy.  To get millisecond accuracy I would use the GPS data to correct a Real Time Clock connected over either the I2C or SPI bus.  There are lots of example programs on reading from an RTC over these busses.
Write them to somewhere, well initially I would write them to the hardware serial port, back to you PC via USB, but then you might want to start looking at writing them to a SD card or via WIFI or GSM to a cloud storage solution.
Here are a list of the examples I looked at:
https://www.arduino.cc/en/Tutorial/AnalogInOutSerial#
https://www.arduino.cc/en/Tutorial/SoftwareSerialExample#
https://www.arduino.cc/en/Tutorial/Datalogger
Hope that helps

I would not recommend SoftwareSerial for this particular application, because it blocks interrupts for an entire character time, about 1ms.  For more information, checkout the AltSoftSerial home page.  AltSoftSerial is the best software serial library, if the required pins are available (depends on which Arduino you're using).  A library I maintain, NeoSWSerial, is the next best choice, and it works on any two pins.

Thank you so much for your reply. This comment also applies to Majenko who answered my question promptly. Since I got your response I have had the help of an able and enthusiastic engineer colleague who wrote a code for using Adafruit GPS logger connected to Arduino Lenonado. The link to the code is: https://github.com/Zapalot/SynchronousSdLogger. The problem is that some data points are lost and my colleague believes it has to do with low SRAM of Leonardo. I will appreciate your opinion on this.


text:
Replacement for #include <pins_arduino.h> on particle photon
I've run into this a couple of times when trying to use libraries written for Arduino on a particle photon. Many have the line:
 #include <pins_arduino.h>

which returns the error on the photon compiler:
 fatal error: pins_arduino.h: No such file or directory

I had similar trouble with:
 #include <WProgram.h>

and found an easy fix was to replace that with
 #include "application.h"

I'm wondering if there's a similar easy fix for pins_arduino?

Are you using the web IDE or using Particle Dev?

Also, why would you want to include pins_arduino.h in the first place? It is specifically made for the Arduino, so I don't expect the Photon will accept it.

There are some Arduino libraries, that just implements functionalities that do not depend on hardware. Example of these are almost all those libraries that deal with data structures/types (strings, arrays, trees, lists, etc), or particular algorithms.
If such libraries do not depend on other Arduino-specific libraries, you can use them almost certainly.
Other libraries, instead, heavily depend on the hardware currently used on the Arduino boards. In those cases, the library must access the hardware, therefore they will include verious headers, such as pins_arduino.h (in particular, pin_arduino.h .
These won't work without heavy modification of such libraries and/or the creation of a wrapper header to "emulate" the required functionalities and define the required macros/constants, according to your hardware.


text:
How to switch on an AC bulb using arduino as well as regular switch?
I'm trying to build a GSM based AC Power ON/OFF switch using Arduino. I've successfully completed the ON/OFF mechanism using SMS with the help of 240v 100amps relay to control the circuit. Apparently I don't want to disturb the regular on/off switch's operation. I want both of them to be operational. When I'm not at home arduino should be the switch control and the regular one should be preferred while at home. I'm actually a noob in this topic, and want your precious help to solve this issue.

This can be done (to a certain extent) using a SPDT (Single-Pole-Double-Throw) relay and an SPDT switch.
The basic principle is the same as when you have two light switches controlling the same light (such as on a staircase - one switch at the top and one at the bottom).  The two switches alternate between one of two different paths for the current. When both switches are routed to the same path the light is on.

Both the Arduino and the switch can turn the light on and off at will. The only problem, though, is that the Arduino has no clue if the light is on or off. To know if the light is on you will need some kind of feedback mechanism.  That might be a simple LDR that looks to see if it's light or dark, or some kind of current monitoring system (current transformer, hall effect current monitor, etc) which the Arduino can use to see if current is actually flowing through the lamp circuit or not.

You could hook the (or another) switch up to the Arduino, so you have total control over what effect the switch will have. So that switching it on/off twice , fast, will enable disco mode ;p (perhaps you can find a better use, but yeah.)

A safer approach is to optically link the Arduino to an IR remote control light switch.  Such an approach is discussed in this thread. The technical specifications appear to be here for the Lutron light switch remote controls.  From this document one could construct an Arduino IR transmitter to send out these code.


text:
Arduino IDE "Tools > Serial Port" grayed out (Ubuntu)
I know this has been asked before, but no one's solutions I've seen have worked so far. I just got started with Arduino and downloaded Arduino IDE from the Software Center. When trying to to set up my Serial Port, the option in the toolbar is gray/unaccessible.
I also downloaded it as a tar.xz instead of from the Software Center and had the same problem.
When I plug in my Uno, the green light turns on so I know it's being connected at least.
One solution I saw said it was a problem with my user group. However, I entered
sudo groups <username>
and came up with <username> tty dialout sudo audio video plugdev input

so I think my groups are okay, right?
Anyway, I would really appreciate some help if anyone knows of a fix. I run 12.04 Ubuntu (I recently re-installed trying to fix this problem; I'm going to update to 14.04) on a Chromebook.

To investigate this, edit the output of ls -l /dev/ttyUSB* and ls -l /dev/ttyACM* (done while the board is connected) into your question.  Also if you recently changed any group memberships make sure you have logged out (or more simply, rebooted) since.

Sorry, can you clarify? I input ls -l /dev/ttyUSB* as well as ls -l /dev/ttyACM* into my terminal and it simply said it was not a directory. Thanks for commenting.

If neither of those is turning up anything, then it sounds like nothing is recognizing your USB serial device.  You can look for differences in the output of lsusb when it is and isn't connected, or you can check for error messages shortly after connection with demsg.  At this point it could be anything - bad board, bad cable, damaged connector, missing kernel modules, or bad/atypical rules for udev or similar.

Within /dev the only "tty" files I have are "tty" and "tty8." Does it seem like I'm missing something?   EDIT: I damaged one of my USB ports last year, though I'm using the other one so I don't think it's that. Thanks anyway

I did what  Chris Stratton's comment suggested,

To investigate this, edit the output of ls -l /dev/ttyUSB* and ls -l /dev/ttyACM* (done while the board is connected) into your question. Also if you recently changed any group memberships make sure you have logged out (or more simply, rebooted) since.
  If neither of those is turning up anything, then it sounds like nothing is recognizing your USB serial device. You can look for differences in the output of lsusb when it is and isn't connected, or you can check for error messages shortly after connection with demsg. At this point it could be anything - bad board, bad cable, damaged connector, missing kernel modules, or bad/atypical rules for udev or similar.

and there was no difference between the output of lsusb with or without the arduino in it (arduino Mega 2560, and my pc is debian 8.6). I tried it with a diffrent cable but that made no difference. I tried it with an other arduino (uno) and then I did saw differnce in lsusb and I could select a port. My mega had the 'on' led on. So even though lights are on and/or binking, it might be that your arduino is broken. If you can, try it with an other arduino. Otherwise you can try an other cable and usb port on your pc.


text:
Two-wire communication (I2C) between Arduino Micros
I am attempting to communicate data via I2C between two Arduino Micros, but can't seem to get the "slave" device to detect a Wire.onRecieve() event.
Per the specification on this site [http://www.takktile.com/tutorial:arduino] (and verified against Arduino's own site) I am using pins 2 and 3 as SDA and SCL for I2C. I have pin2 of Arduino 1 (ARD1) connected to pin2 of Arduino 2 (ARD2), and pin3 of ARD1 connected to pin3 of ARD2.
ARD2 acts as slave, ARD1 acts as master.
I am reading in a text file from SD on ARD1. On ARD1, you then press a button to initiate transfer. ARD1 lights a red LED to indicate the transfer is underway. When I initiate the transfer, it remains solid (indicating it never gets past endTransmission to where the LED is supposed to be turned off).
Here is the code for ARD1:
// include the SD library:
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
// personal debugging routines
#include "debug.h"
/*
 *
 *  THIS IS THE SLAVE RECEIVING MODULE
 *  IT WILL WRITE DATA TO AN SD CARD
 */

// GLOBAL VARIABLES
const int chipSelect = 10; // 10 because this is an Adafruit SD module.
File data;
int buttonA; // the button
char c;

void sd_readstart() {
  unsigned char i = 0;
  // Open serial communications and wait for port to open:
  Serial.print("\nInitializing SD card...");
  if (!SD.begin(10)) {
    Serial.println("Card initialization failed.");
    errorblink();
    return;
  }
  Serial.println("Initialization successful.");

}

void setup() {
  pinMode(11, OUTPUT); // setup for blink
  pinMode(12, OUTPUT); // setup for blink
  pinMode(10, INPUT); // button
  Wire.begin(8); // intitalize this device as a slave on addr .
  Wire.onReceive(receiveEvent); // when data is recieved, run recieveEvent(int).
  Serial.begin(9600);
  sd_readstart();
}

void loop(void) {
  // short blink to confirm this is going down correctly
  buttonA = digitalRead(10);
  if (buttonA == HIGH) {
    // button open
    blink(100,1000);
  } else {
    // button pressed

  }

}

void receiveEvent(int howMany) {
  data = SD.open("testoutput.txt");
  digitalWrite(12,HIGH);
  while (Wire.available() > 0) { // loop through all but the last
    c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
    data.print(c);
  }
  data.close();
  digitalWrite(12,LOW);
}

Here is the code for ARD2:
// include the SD library:
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
// Software Serial library:
#include <SoftwareSerial.h>
// personal debugging routines
#include "debug.h"
/*
 *
 *  THIS IS THE SLAVE RECEIVING MODULE
 *  IT WILL WRITE DATA TO AN SD CARD
 */

// GLOBAL VARIABLES
const int chipSelect = 10; // 10 because this is an Adafruit SD module.
File data;
int buttonA; // the button
char c;

void sd_readstart() {
  unsigned char i = 0;
  // Open serial communications and wait for port to open:
  Serial.print("\nInitializing SD card...");
  if (!SD.begin(10)) {
    Serial.println("Card initialization failed.");
    errorblink();
    return;
  }
  Serial.println("Initialization successful.");

}

void setup() {
  pinMode(11, OUTPUT); // setup for blink
  pinMode(12, OUTPUT); // setup for blink
  pinMode(10, INPUT); // button
  Wire.begin(8); // intitalize this device as a slave on addr 8.
  Wire.onReceive(receiveEvent); // when data is recieved, run recieveEvent(int).
  Serial.begin(9600);
  sd_readstart();
}

void loop(void) {
  // short blink to confirm this is going down correctly
  buttonA = digitalRead(10);
  if (buttonA == HIGH) {
    // button open
    blink(100,1000);
  } else {
    // button pressed

  }

}

void receiveEvent(int howMany) {
  data = SD.open("testoutput.txt");
  digitalWrite(12,HIGH);
  while (Wire.available() > 0) { // loop through all but the last
    c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
    data.print(c);
  }
  data.close();
  digitalWrite(12,LOW);
}

For completeness, here is my debug.h:
void blink(int h, int l) {
    digitalWrite(11, HIGH);
    delay(h);
    digitalWrite(11, LOW);
    delay(l);
}

void errorblink() {
  unsigned char counter = 0;
  while (counter < 4 ) {
    digitalWrite(12, HIGH);
    delay(50);
    digitalWrite(12, LOW);
    delay(50);
    digitalWrite(12, HIGH);
    delay(50);
    digitalWrite(12, LOW);
    delay(50);
    digitalWrite(12, HIGH);
    delay(50);
    digitalWrite(12, LOW);
    delay(1000);
    counter++;
  }
}

void goodblink() {
  unsigned char counter = 0;
  while (counter < 4 ) {
    digitalWrite(11, HIGH);
    delay(50);
    digitalWrite(11, LOW);
    delay(50);
    digitalWrite(11, HIGH);
    delay(50);
    digitalWrite(11, LOW);
    delay(50);
    digitalWrite(11, HIGH);
    delay(50);
    digitalWrite(11, LOW);
    delay(1000);
    counter++;
  }
}

I did attempt to do the minimum working example of Wire from the examples in the Arduino IDE. That didn't work either, which is to say that I didn't see any text in the serial monitor on ARD2 when I uploaded the slave reciever sketch that comes with the IDE (with send master running on ARD1) which makes me wonder if I'm doing something horribly, fundamentally wrong in hardware rather than just in software.
I hope it's not inappropriate to post up the more advanced example in order to get feedback on the larger picture of what I'm trying to accomplish -- moving a text file from the SD card on one arduino to the SD card attached to another.

You don't mention having the external explicit pullup resistors required for I2C.

Indeed I didn't. That may be the horrible, fundamental thing I overlooked. Can you elaborate?

I2c is an open collector setup. The pins go low, or open/input/hi-z, and let the line/bus free. Without a pull up on each line to VCC, the line never goes high. Pull up resistors are required. 4.7k typical.
Op's crudely drawn diagram is the correct way for a 5V I2C bus:

Keep in mind both arduinos/power supplies must have their grounds connected, as a reference ground voltage.

Am I correct in imagining something akin to the crude schematic I drew here:
http://imgur.com/qhO2W4y

@BradleyEvans yup. See https://learn.sparkfun.com/tutorials/i2c

Thanks. This was, indeed, my problem.
With respect to the larger problem, is my intuition correct that the data transferred cannot be very large? I was trying to push a multiparagraph text file through.

@BradleyEvans You can transfer as much data as you want, if you are willing to wait long enough …

@bradleyevans you do it 8 bits at a time, as fast as the library allows you too. Standard i2c is 100 kHz to 400 kHz so that pretty snappy compared to human speed,  but SPI or fat i2c or serial/uart can be faster.

For clarification, what I was wondering after was how the Wire library works in Arduino.
Wire.beginTransmission() starts a transmission.
Wire.write() starts putting bytes together for transmission
Wire.endTransmission() actually tosses the transmission out over the wire.
I was trying to fit a full text file in between begin and end, which was too much for my Arduino Micro's memory. Breaking it up into 10 byte chunks and running it while(data.available()) let me transfer the whole thing.

The I2C protocol and hardware don't care how much data is transferred.
The time you have for the transfer, or the transfer rate is much more important; you might get bored waiting, but it won't.
You might get over 100k bits/second transfer (allowing time to write to the SD card) if that's enough then it's fine.
The significantly faster option, using Arduino's, is SPI to SPI, and you are likely using SPI for the SD card, so I2C is a reasonable alternative, and makes your hardware and software simpler.
The only faster interface on the Arduino, excluding SPI, is the UART. That might be a bit tricky to use while you are developing, testing and debugging your software.

I had initially started with UART but it proved a tad too complex for the short time I have with this project. Thanks for the background.

authors: Женя Сиротенко


text:
Driving single-character alphanumeric (16-segment) displays
I would like to drive three sixteen-segment displays (https://www.sparkfun.com/products/retired/9934) using an Arduino Micro. These displays would output an alphabetic character that a user would scroll through using rotary encoders, and constitute a subsystem of a larger project where the user enters a "combination" made from the three letters to "unlock" functionality in the larger device.
The best option, if it could be called that, is this retired product from SparkFun: https://www.sparkfun.com/products/retired/10103 that would allow me to drive the displays without a huge wiring mess, and spares me a lot of pins on the Micro to use on the rotary encoder. Unfortunately, the product is retired because the A6282 IC it was based on reached end of life, so even the schematics available on the product page aren't much use to me.
I am aware that four-character 16-segment displays are available, but for "aesthetic" reasons I am constraining myself to using single-character 16-segment displays. I do wonder how possible it would be to run three or four individual 16-seg displays from one of those LCD backpacks, but I don't think that would be trivial to do (I'd need to, probably, fabricate some sort of printed circuit board that spaced each display as far out as I need them to be, hook the pins of each display into a key matrix, and then at that point it'd be substantially easier to just get a MAX6954 (https://www.maximintegrated.com/en/app-notes/index.mvp/id/3212) and try to figure that out). It would be very clumsy to prototype.
So, I'm looking for a solid method of prototyping this "combination entry" subsystem and its 16 segment displays without needing to put each dial and alphanumeric display on its own AVR or something.

You mean like with a shift register or LED driver IC?

I sell these. Could be what you want - wire it direct to a common-anode display and communicate with it over I2C. UP to 14 of them can be chained together.

I'd prefer to use some sort of driver IC like the discontinued model I refer to as being formerly available from SparkFun. I feel like if I have to go to shift registers, then what will inevitably happen is that I either have to assign a small AVR to each character display and rotary encoder, then feed all of these into another microcontroller that will assemble all of that into a coherent combination. I'm willing to do that, but it will mean that this little subassembly will cost over $60, which hurts the larger project's reproducability.

@Majenko That actually looks like it would be perfectly suitable. Thank you.

If you need additional IO lines, a typical “LCD backpack” supplies at most eight additional lines of IO; 16-channel TLC59116 LED Driver Board as mentioned by Majenko would be more elegant than using several backpacks.
You might try an approach like the following to see if it works well enough.
Use 16 IO lines to pull down 16 segment lines.  Use three IO lines to drive three digit-select PNP or PFET transistors for digit multiplexing.  Use pin-change interrupts on two IO lines to read rotary encoder (RE) data.  Use one input to read the RE pushbutton.  Use one IO line to notify the bigger unit of success.  Total 23 IO lines.
In operation, your code will need to implement a state machine that frequently refreshes the multiplexed digits while keeping track of digit values, selected digit, etc.  Each time you click the RE have your sketch go on to the next digit.  To tell the user which digit is working, blink the selected digit a couple of times after the RE press.  Each time that selection wraps around to the first digit, check if the combination is correct.
If you feel it's necessary to have three different digit-setting knobs, vs clicking through to each digit, you could use one less IO line by using three pots instead of one RE.  The pots would be read in analog.  A6 and A7, IIRC not usable for output lines, could be used as analog inputs for two of the pots.

The other answers give great suggestions, but to add to them you could consider the MAX7219 driver chip. I have a page about using it. It can drive a 8x8 pixel display (like one alphanumeric character) or 8 x 7-segments displays (a 7-segment display usually has a decimal place so that is really an 8-LED display).
Example of 64-pixel display:

Example of 8 x 7-segment displays:

Those displays come as a unit (2 x 4 digits) but there is nothing stopping you running wires to individual 1-digit displays if you want to.
Here is a possible schematic:

If you are running to individual displays you just parallel-up the anodes (A to G, plus DP) and run a "digit" line to the cathode of each display.

That will only take 3 signals from your processor (MOSI, SCK, SS) plus power and ground.

I notice you are talking about 16-segment displays and not 8-segment displays, but the chip allows any bit patterns to be sent out, so you could consider a 16-segment display to be the same as 2 x 8-segment displays. You would just have to make up a suitable bit-pattern to show each digit.
The MAX7219 also handles the requirement for constant-current driving of the LEDs.


text:
How to connect a SilentStepStick TMC2130 stepper driver?
please excuse the noob question
Am connecting a SilentStepStick to arduino with a stepper, for bench testing.
It requires 5V power, plus I have a 24V power supply for the steppers.
+5V connected to Vio, and +24V connection to VM.
Question: how to connect the grounds?  The device has two GND pins.  Should I just connect one ground, from the 5V power supply, to avoid ground loops?
Or should grounds from both power supplies be connected?
Thankyou for any advice.

Answer: (from Electrical Engineering), yes both grounds must be connected.
In this example, +5V and GND from the arduino would connect to the two top left pins in the diagram (Vio & GND).
The two 24v power lines would connect to the bottom left two pins, Vm & GND

Aren't the grounds connected to each other on the board, and so couldn't you connect either ground to either pin?

According to the .brd file found at Watterotts github, yes, both grounds are connected to the same ground plane on the PCB.


text:
Water pressure an salinity sensor connected to arduino
I am trying to design a project that Arduino would have connected water and salinity sensor, would be packed in a special box be droped into ocean up to 500 meters. What sensors should I use and how should they be conencted. I assume that I would need professional equipment, not chineese stuff from ebay.
Hardware needs to be able to work under 50*C and up to 50bar
Update:
Budget is about up to 400 pounds for sensors.
Resolution of pressure 0 to 100 bar
Resolution of salinity doesnt matter so much. Few percents of mistake, just to measure it somehow

What sort of resolution and accuracy do you need? How long is the deployment? Any communication?

pessure about 1bsi accuracy and accuracy of salinity doesnt matter. just something that measure quite properly under these conditions.

I'm unfamiliar with bsi, it seems like 500m of saltwater would be a pressure of 5 MPa or 750 psi.    The arduino can interface electrically to most things, but for advice on selection of an uncommon, special sensor, you might do better in an engineering forum.

oh I meant bar, sorry. 50 bar, 5MPa

You may find Robotics Stackexchange useful for questions like this.

On "sea water", each 10m you have 1,007 bar. So at 500m you'll get about 50 x 1.007 = 50,35 bars.

I suggest that you look for a sensor from Honeywell. The problem is that the pressure is very high for a board mounted sensor and the atmospheric pressure is varying. The board mounted sensors measure a maximum of 10 bar.  It is not clear what accuracy you require. Is there a connection to the surface? If so you should measure differential pressure between the seabed and the surface.  Can you be content with a maximum depth of 100 m?
I don't think salinity varies much offshore so it might not be worth measuring.


text:
Arduino minimal power usage
I know there is a lot on this subject on the net but i cant seem to be able to join the dots together.
I am trying to make sensor system than can run for as long as possible if not indefinitely using an Arduino, and also to do so very cheaply. I have a £1 Arduino Nano clone that is running with sensor and alarm fine, but currently its runs off USB power from PC.
I have followed this guide to minimize power usage code side: https://www.openhomeautomation.net/arduino-battery/
And I have read that the Vin pin needs at least 7 volts to work properly, so 2 volts would be wasted in heat making a 5V level.
I have a 3.7V lithium cell 4300mAh so I thought I would need a step up boost module.
But it looks like the Nano can run using 3V. But the 3.3V rail is apparently made for external sensors, assuming I want a mixture of cheap/simple and high efficiency. Can i just hook a 3.7 lipo into the 5V rail of the Nano and a 5V solar panel (with diode) up to same point? Will this kill my Nano?
If not, is it worth stepping the 3.7V down to the minimum the Nano can run with?
Underclocking is not an issue, it essentially wakes up every hour reads 5 sensors and if all is well (99% of the time) goes back to sleep for an hour.
Linear voltage regulators seem to burn the excess voltage as heat. And then what will happen when the battery dies off and is no longer 3.7 volts? And if my solar panel is around 5V in good light, if its partly shaded and only has 3.5 volts for example it would not charge my lipo to 100% capacity. Should I step up DC/DC boost the panel voltage to charge my cell.
Guidance please.

I have to agree with @Olin Lathrop about the fact that Arduinos are not really tuned for your goals.
I am doing microcontroller projects for like 20 years, and I found the nanowatt PIC microcontrollers offering the best price/performance/tricks ratio if you need to have something running on batteries for a seriously long time (and has not too much to calculate). There we're talking about nanoamperes in sleep, and there are a lot more tricks you can consider.
You have chosen Arduino for a valid set of good reasons. But which Arduino please? They come with different CPUs and hardware!
If you go with Uno:

power your board directly by batteries, e.g. 3xAA batteries at the 5V pin to bypass power loss on the 5 V regulator (you can also give a try to feed power via the USB socket if you feel that more convenient)
remove the 3.3 V regulator (assume you don't need 3.3 V)
sleep a lot and sleep well, listen to @Nick Gammon and check his page about power saving

Then comes the minor tricks:

do not let any pin float. Before going to sleep, put all inputs to output. I.e. if you have a button input, change port direction to output and set to 0. (assuming that you don't need the button in sleep)
turn off not only all internal peripherals, but also external ones. For example, things like I2C temperature sensors may have remarkable 0.5 mA sleep current. The easiest thing is to power those from a port pin, and set the port to 0 before going to sleep.
turn off all pullups (and all inputs to outputs), don't forget the I2C as well. Although the bus will be idle, there is a serious leakage current (serious means microamperes, and you wanna go to the nanoampere range, right?)

Then if you want to go really to the hard parts:

throw away all hardware you don't need. The power checking comparators (I am referring to this schematics http://brittonkerin.com/annotateduino/arduino_uno_rev3_schematic.png), the USB interface chip altogether
throw away u1 (the 5 V regulator) - also has some leakage current

And the final steps:

I would check the electrolytic capacitors on the power rails, e.g. C2. These also have a leakage.
Although Arduino does not have suppressor diodes to protect anything from any voltage spikes, I have to emphasize that single high capacity unipolar and bipolar suppressor diodes may have a leakage current of 1 uA.

Note about underclocking: this is not necessarily a wise thing to do. It is true that on slower speed the CPU consumes less. However at slower speed the CPU has to stay awake much longer to perform the same tasks.

I found that if you need to perform some complex calculations (not just reading some sensors) it may make sense to switch to a higher CPU speed, and do the calculation in less time and go back to sleep more efficient.
On the other hand, if your CPU is awake just to wait for some sensor readings and just burning cycles while waiting, a slower CPU speed is more beneficial.

The off-the-shelf Arduinos are not suitable, because they have voltage regulators, power LEDs, etc. However the processor (Atmega328P) can sleep at 100 nA (with the watchdog disabled). I'm not sure the PICs are much better. 100 nA is pretty low, batteries discharge faster than that.

Interesting! I have no experience in low powering the Atmega328P, so I did some digging of datasheets.
ATMega328p
3V 4MHz = 1.7mA
5V 8MHz = 5.2mA
PIC18LF1xK50
3V 4MHz = 0.5mA
5V 24MHz = 4.7mA
Atmega power down mode, WDT disabled, 3V = 0.1uA
power down mode, WDT enablede, 3V = 4.2uA, PIC power down, WDT disabled, 3V 0.07uA
power down, WDT enabled, 3V 1.37uA max.
Doh, this formatting! So PIC is 70nA in sleep, and even if it runs with PLL at 24MHz, consumes less than a 8MHz Atmega328P. Of course we're comparing apples to oranges because of different architecture of the cpus.

Nevertheless, as Microchip has purchased Atmel, they're one family now! Time to develop the GRAND microcontroller now :)

So PIC is 70nA in sleep - well I won't quibble over 30 nA, which is all the difference is. It's hard to measure that anyway. as Microchip has purchased Atmel - uh oh.

I have a project along those lines. I am reading temperature, humidity, and light level and logging it, with a timestamp, to an SD card.
Schematic (click for larger image):

Photo:

It was designed with low power in mind. It runs from 3 x AA batteries which I think I have only changed once since I made it (in August 2013).
Also see my page about power saving.
I don't see any problem with running it directly from 3.7V - you would need to slow the processor down to 8 MHz (which I did anyway in that project).
The code (available here) compiles under the Arduino IDE.


text:
printf %s gives gibberish
This Code:
String S0 = "";
String S1 = "1";
String S2 = "12";
String S3 = "123";
String S4 = "1234";
String S5 = "12345";
String S6 = "123456";
String S7 = "1234567";
String S8 = "12345678";
String S9 = "123456789";
String S10 = "1234567890";
String S11 = "1234567890a";
String S12 = "1234567890ab";
String S13 = "1234567890abc";
String S14 = "1234567890abcd";
String S15 = "1234567890abcde";
String S16 = "1234567890abcdef";
String S17 = "1234567890abcdefg";
String S18 = "1234567890abcdefgh";
String S19 = "1234567890abcdefghi";
String S20 = "1234567890abcdefghij";
Serial.printf("(0):%s\n", S0);
Serial.printf("(1):%s\n", S1);
Serial.printf("(2):%s\n", S2);
Serial.printf("(3):%s\n", S3);
Serial.printf("(4):%s\n", S4);
Serial.printf("(5):%s\n", S5);
Serial.printf("(6):%s\n", S6);
Serial.printf("(7):%s\n", S7);
Serial.printf("(8):%s\n", S8);
Serial.printf("(9):%s\n", S9);
Serial.printf("(10):%s\n", S10);
Serial.printf("(11):%s\n", S11);
Serial.printf("(12):%s\n", S12);
Serial.printf("(13):%s\n", S13);
Serial.printf("(14):%s\n", S14);
Serial.printf("(15):%s\n", S15);
Serial.printf("(16):%s\n", S16);
Serial.printf("(17):%s\n", S17);
Serial.printf("(18):%s\n", S18);
Serial.printf("(19):%s\n", S19);
Serial.printf("(20):%s\n", S20);

Gives This Result:
(0):
(1):1
(2):12
(3):123
(4):1234
(5):12345
(6):123456
(7):1234567
(8):12345678
(9):123456789
(10):�H�?
(11):�^�?
(12):_�?
(13):�_�?
(14):`�?
(15):0`�?
(16):�`�?
(17):a�?
(18):@a�?
(19):pa�?
(20):�a�?

Any ideas??
PS: IT IS OBVIOUS that for whatever platform it is being used, it is working for short strings and not for longer strings! And it has been answered in the comments after you have closed it! So if you do not know the answer instead of closing, maybe it is better to leave it for others to answer it...

Please provide a complete compilable code as example.

For what board are you compiling with what core? The standard core doesn't have a printf() function for Serial. The ESP32 core does. And the ESP8266 core doesn't take String as a parameter for it. Please provide way more information about your setup

Well, I was working on making you an answer, but... then someone closed it. So, here: you need .c_str() in your calls. .printf() is a variadic function which doesn't really have access to any sort of destination type to do conversions; it relies entirely on your passing the correct format specifiers. It is just supplying the bytes to the String object, which is not simply a const char * (specified %s). If you're curious, the behaviour difference you're seeing is down to whether "small string optimization" is being used.

@timemage Appreciate the time and effort you put explaining this. I would definitely ACCEPT and UPVOTE your answer if someone hasn't decided to close it just because they simply do not know the answer!!! Just by adding .c_str() to S20 I got what I expected and your explanation was TRUE and invaluable. It also proved that no more explanation was required to clarify this obvious question. MANY REGARD

I guess the question was closed because of its quality. Though in the meantime it was reopened (possibly due to the answer in the comments), so @timemage can now put the comment as an answer.

Looks like short string optimization, where shorter strings are stored directly in the object and for longer strings it's used as pointers. You should use: Serial.printf("%s",Sxx.c_str());

@chrisl If I did that now it would be 95% diatribe fueled by contempt.

@AKTanara If you want you can find me and a small collection of others on libera.chat irc network.

Dear timemage, I'll find you there as soon as I find out how this libera.chat irc network works... Thanks again for the good answer you provided and I wished you could post your comment as answer now that the thread is open again so that I can accept it since you were the first one to mention the solution even when it was closed...

@AKTanara, I'm not worried about that. I've been helping people on IRC for a very long time and there's never been a point system there. RowanP has taken the time to turn it into an answer; it's probably better that you accept that answer so that the question is resolved in a technical sense.

(Community Wiki answer assembled from the comments)
Noting that the standard Arduino core doesn't have a Serial.printf() function. The ESP32 core does.
You need .c_str() in your calls. .printf() is a variadic function which doesn't really have access to any sort of destination type to do conversions; it relies entirely on your passing the correct format specifiers. It is just supplying the bytes to the String object, which is not simply a const char * (specified %s). If you're curious, the behaviour difference you're seeing is down to whether "small string optimization" is being used.
Short string optimization is where shorter strings are stored directly in the object and for longer strings it's used as pointers.
The suggested solution is to use: Serial.printf("%s",Sxx.c_str());