text:
Capturing images from OV7670 (w/o FIFO) using Arduino Uno?
I want to capture images from my OV7670 (w/o FIFO) and send it to my PC via Wi-Fi (ESP8266) (which I know how to use) using an Arduino Uno. I have read so many blogs and threads on the internet but couldn't find a simple and exact solution for the problem. I am a newbie in this and all I want is the simple wiring schema, code that can be used with Arduino IDE and the direction on how to proceed.
I found this random code. Please see if I can use it.
    #include <Wire.h>
    #include <Ethernet.h>
    #include <SPI.h>
    uint8_t sensor_addr = 0x42;

    //************ REGISTRADORES **********************//

    #define REG_COM1    0x04    /* Control 1 */

    #define REG_COM7    0x12    /* Control 7 */

    #define   COM7_RESET      0x80    /* Register reset */

    #define   COM7_FMT_MASK   0x38

    #define   COM7_FMT_VGA    0x00

    #define   COM7_FMT_CIF    0x20    /* CIF format */

    #define   COM7_FMT_QVGA   0x10    /* QVGA format */

    #define   COM7_FMT_QCIF   0x08    /* QCIF format */

    #define   COM7_RGB    0x04    /* bits 0 and 2 - RGB format */

    #define   COM7_YUV    0x00    /* YUV */

    #define   COM7_BAYER      0x01    /* Bayer format */

    #define   COM7_PBAYER     0x05    /* "Processed bayer" */

    #define REG_RGB444  0x8c    /* RGB 444 control */

    #define   R444_ENABLE     0x02    /* Turn on RGB444, overrides 5x5 */

    #define   R444_RGBX   0x01    /* Empty nibble at end */

    #define REG_COM9    0x14    /* Control 9  - gain ceiling */

    #define REG_COM10   0x15    /* Control 10 */

    #define REG_COM13   0x3d    /* Control 13 */

    #define   COM13_GAMMA     0x80    /* Gamma enable */

    #define   COM13_UVSAT     0x40    /* UV saturation auto adjustment */

    #define   COM13_UVSWAP    0x01    /* V before U - w/TSLB */

    #define REG_COM15   0x40    /* Control 15 */

    #define   COM15_R10F0     0x00    /* Data range 10 to F0 */

    #define   COM15_R01FE     0x80    /*            01 to FE */

    #define   COM15_R00FF     0xc0    /*            00 to FF */

    #define   COM15_RGB565    0x10    /* RGB565 output */

    #define   COM15_RGB555    0x30    /* RGB555 output */

    #define REG_COM11   0x3b    /* Control 11 */

    #define   COM11_NIGHT     0x80    /* NIght mode enable */

    #define   COM11_NMFR      0x60    /* Two bit NM frame rate */

    #define   COM11_HZAUTO    0x10    /* Auto detect 50/60 Hz */

    #define   COM11_50HZ      0x08    /* Manual 50Hz select */

    #define   COM11_EXP   0x02

    #define REG_COM16   0x41    /* Control 16 */

    #define   COM16_AWBGAIN   0x08    /* AWB gain enable */

    #define REG_COM17       0x42    /* Control 17 */

    #define COM17_AECWIN    0xc0    /* AEC window - must match COM4 */

    #define COM17_CBAR      0x08    /* DSP Color bar */

    #define REG_TSLB    0x3a    /* lots of stuff */

    #define   TSLB_YLAST      0x04    /* UYVY or VYUY - see com13 */

    #define MTX1            0x4f    /* Matrix Coefficient 1 */

    #define MTX2            0x50    /* Matrix Coefficient 2 */

    #define MTX3            0x51    /* Matrix Coefficient 3 */

    #define MTX4            0x52    /* Matrix Coefficient 4 */

    #define MTX5            0x53    /* Matrix Coefficient 5 */

    #define MTX6            0x54    /* Matrix Coefficient 6 */

    #define REG_CONTRAS     0x56    /* Contrast control */

    #define MTXS            0x58    /* Matrix Coefficient Sign */

    #define AWBC7           0x59    /* AWB Control 7 */

    #define AWBC8           0x5a    /* AWB Control 8 */

    #define AWBC9           0x5b    /* AWB Control 9 */

    #define AWBC10          0x5c    /* AWB Control 10 */

    #define AWBC11          0x5d    /* AWB Control 11 */

    #define AWBC12          0x5e    /* AWB Control 12 */

    #define REG_GFIX        0x69    /* Fix gain control */

    #define GGAIN           0x6a    /* G Channel AWB Gain */

    #define DBLV            0x6b

    #define AWBCTR3         0x6c    /* AWB (Automatic White Balance) Control 3 */

    #define AWBCTR2         0x6d    /* AWB Control 2 */

    #define AWBCTR1         0x6e    /* AWB Control 1 */

    #define AWBCTR0         0x6f    /* AWB Control 0 */

    #define REG_COM8    0x13    /* Control 8 */

    #define   COM8_FASTAEC    0x80    /* Enable fast AGC/AEC (Automatic Gain Control - Automatic Exposure Control)*/

    #define   COM8_AECSTEP    0x40    /* Unlimited AEC step size */

    #define   COM8_BFILT      0x20    /* Band filter enable */

    #define   COM8_AGC    0x04    /* Auto gain enable */

    #define   COM8_AWB    0x02    /* White balance enable */

    #define   COM8_AEC    0x01    /* Auto exposure enable */

    #define REG_COM3        0x0c    /* Control 3 */

    #define COM3_SWAP       0x40    /* Byte swap */

    #define COM3_SCALEEN    0x08    /* Enable scaling */

    #define COM3_DCWEN      0x04    /* Enable downsamp/crop/window */

    #define REG_BRIGHT      0x55    /* Brightness */

    #define REG_COM14      0x3E

    //*************************************************************************//

    byte mac[] = {
      0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // MAC do arduino
    IPAddress ip(192,168,0,120); // IP do arduino
    byte server[] = {
      192,168,0,105}; //Endereço do servidor

    void setup (){

      DDRC&=~15;//low d0-d3 camera  PORTC (pino A0 ao pino A5) (11110000) A0 a A3 como entrada e A4 (SDA) e A5 (SCL) como saídas - essa linha tem a mesma função de pinMode que declara quem
      //é pino de saída e de entrada. Se for 0 é entrada e se for 1 é saída. O valor é não 15 (acima).
      DDRD&=~255;//d7-d4 and interupt pins PORTD (pino 0 ao pino 7) (0000 d7 ao d4           0=d3=vsync 0=d2=pclock               0=d1=href   1=d0=button)

      DDRB&=~1;

      Serial.begin(57600);
      Wire.begin();

      UCSR0B = (1<<RXEN0)|(1<<TXEN0);//Enable receiver and transmitter (habilita bit 4 e bit 3)

      UCSR0C=6;// B (00000110) async (b7 e b6 = 00); (b3 = 0) 1 stop bit; (b2 e b1 = 1)  8bit char; no parity bits (b5 e b4 = 00); (b0 = 0)clock polaridade

      //set up twi for 100khz
      TWSR&=~3;//disable prescaler for TWI
      TWBR=72;//set to 100khz

      //SET UP CAMERA
      wrReg(0x15,32);//pclk does not toggle on HBLANK COM10 vsync falling
      //wrReg(0x15,0);//pclk does not toggle on HBLANK COM10 vsync falling
      wrReg(REG_RGB444, 0x00);             // Disable RGB444
      wrReg(REG_COM11,226);//enable nigh mode 1/8 frame rate COM11*/
      wrReg(REG_TSLB,0x04);                // 0D = UYVY  04 = YUYV
      wrReg(REG_COM13,0x88);               // connect to REG_TSLB
      //definição para o RGB 565
      wrReg(REG_COM7, 0x04);           // RGB + color bar disable
      wrReg(REG_COM15, 0xD0);          // Set rgb565 with Full range    0xD0

        wrReg(REG_COM3,0);    // REG_COM3

      wrReg(0x32,0xb6);        // HREF
      wrReg(0x17,0x13);        // HSTART
      wrReg(0x18,0x01);        // HSTOP
      wrReg(0x19,0x02);        // VSTART
      wrReg(0x1a,0x7a);        // VSTOP
      wrReg(0x03,0x0a);        // VREF

      wrReg(REG_COM1, 0x00);

      //COLOR SETTING
      wrReg(REG_COM8,0x8F);        // AGC AWB AEC Unlimited step size
      wrReg(0xAA,0x14);            // Average-based AEC algorithm
      wrReg(REG_BRIGHT,0x00);      // 0x00(Brightness 0) - 0x18(Brightness +1) - 0x98(Brightness -1)
      wrReg(REG_CONTRAS,0x40);     // 0x40(Contrast 0) - 0x50(Contrast +1) - 0x38(Contrast -1)
      // wrReg(0xB1,0xB1);            // Automatic Black level Calibration
      wrReg(0xB1,4);//really enable auto black level calibration
      wrReg(MTX1,0x80);
      wrReg(MTX2,0x80);
      wrReg(MTX3,0x00);
      wrReg(MTX4,0x22);
      wrReg(MTX5,0x5e);
      wrReg(MTX6,0x80);
      wrReg(MTXS,0x9e);
      wrReg(AWBC7,0x88);
      wrReg(AWBC8,0x88);
      wrReg(AWBC9,0x44);
      wrReg(AWBC10,0x67);
      wrReg(AWBC11,0x49);
      wrReg(AWBC12,0x0e);
      wrReg(REG_GFIX,0x00);
      //wrReg(GGAIN,0x40);
      wrReg(AWBCTR3,0x0a);
      wrReg(AWBCTR2,0x55);
      wrReg(AWBCTR1,0x11);
      wrReg(AWBCTR0,0x9f);

      wrReg(0xb0,0x84);//not sure what this does
      wrReg(REG_COM16,COM16_AWBGAIN);//disable auto denoise and edge enhancment
      //wrReg(REG_COM16,0);
      wrReg(0x4C,0);//disable denoise
      wrReg(0x76,0);//disable denoise
      wrReg(0x77,0);//disable denoise
      wrReg(0x7B,4);//brighten up shadows a bit end point 4
      wrReg(0x7C,8);//brighten up shadows a bit end point 8
      //wrReg(0x88,238);//darken highligts end point 176
      //wrReg(0x89,211);//try to get more highlight detail
      //wrReg(0x7A,60);//slope
      //wrReg(0x26,0xB4);//lower maxium stable operating range for AEC
      //hueSatMatrix(0,100);
      //ov7670_store_cmatrix();
      //wrReg(0x20,12);//set ADC range to 1.5x
      wrReg(REG_COM9,0x6A);//max gain to 128x
      wrReg(0x11,9);//using scaler for divider
      delay(100);//i2c uses interupts to write data wait for all bytes to be written

      //            #ifdef qqvga || ifdef qvga

      wrReg(REG_COM3,4);    // REG_COM3

      //    #ifdef qqvga

      wrReg(REG_COM14, 0x1a);          // divide by 4

      wrReg(0x72, 0x22);               // downsample by 4

      wrReg(0x73, 0xf2);               // divide by 4

      wrReg(0x17,0x16);

      wrReg(0x1A,0x04);

      wrReg(0x32,0xa4);

      wrReg(0x19,0x02);

      wrReg(0x18,0x7a);

      wrReg(0x03,0x0a);

      wrReg(REG_COM1, 0x00);

      // COLOR SETTING

      wrReg(REG_COM8,0x8F);        // AGC AWB AEC Unlimited step size

      wrReg(0xAA,0x14);            // Average-based AEC algorithm

      wrReg(REG_BRIGHT,0x00);      // 0x00(Brightness 0) - 0x18(Brightness +1) - 0x98(Brightness -1)

      wrReg(REG_CONTRAS,0x40);     // 0x40(Contrast 0) - 0x50(Contrast +1) - 0x38(Contrast -1)

      // wrReg(0xB1,0xB1);            // Automatic Black level Calibration

      wrReg(0xB1,4);//really enable auto black level calibration

      wrReg(MTX1,0x80);

      wrReg(MTX2,0x80);

      wrReg(MTX3,0x00);

      wrReg(MTX4,0x22);

      wrReg(MTX5,0x5e);

      wrReg(MTX6,0x80);

      wrReg(MTXS,0x9e);

      wrReg(AWBC7,0x88);

      wrReg(AWBC8,0x88);

      wrReg(AWBC9,0x44);

      wrReg(AWBC10,0x67);

      wrReg(AWBC11,0x49);

      wrReg(AWBC12,0x0e);

      wrReg(REG_GFIX,0x00);

      //wrReg(GGAIN,0x40);

      wrReg(AWBCTR3,0x0a);

      wrReg(AWBCTR2,0x55);

      wrReg(AWBCTR1,0x11);

      wrReg(AWBCTR0,0x9f);

      wrReg(0xb0,0x84);//not sure what this does

      wrReg(REG_COM16,COM16_AWBGAIN);//disable auto denoise and edge enhancment

      //wrReg(REG_COM16,0);

      wrReg(0x4C,0);//disable denoise

      wrReg(0x76,0);//disable denoise

      wrReg(0x77,0);//disable denoise

      wrReg(0x7B,4);//brighten up shadows a bit end point 4

        wrReg(0x7C,8);//brighten up shadows a bit end point 8

        //wrReg(0x88,238);//darken highligts end point 176

      //wrReg(0x89,211);//try to get more highlight detail

      //wrReg(0x7A,60);//slope

      //wrReg(0x26,0xB4);//lower maxium stable operating range for AEC

      //hueSatMatrix(0,100);

      //ov7670_store_cmatrix();

      //wrReg(0x20,12);//set ADC range to 1.5x

      wrReg(REG_COM9,0x6A);//max gain to 128x

      //    #ifdef qvga

      wrReg(0x11,4);//using scaler for divider

      pinMode(4,OUTPUT);
      digitalWrite(4,HIGH);
      Serial.println("Iniciando conexao");
      Ethernet.begin(mac, ip);
      Serial.println("Por favor, espere.");
      delay(1000);

    }

    EthernetClient client;
    void loop (){

    connectWeb(7000,server);
    foto(480,640);

    }

    byte wrReg(int regID, int regDat )

    {

      Wire.beginTransmission(sensor_addr >> 1);
      Wire.write(regID & 0x00FF);
      Wire.write(regDat & 0x00FF);
      if(Wire.endTransmission())
      {
        return 0;
        PORTB|=32;
        while (1) {
        }
      }
      delay(1);
      return(1);
    }

    uint16_t d;

    void foto(uint16_t linha, uint16_t coluna)
    {
      while (!(PIND&8)) {
      }//wait for high
      while ((PIND&8)) {
      }//wait for low
      //uint16_t a =millis(); //teste de tempo
      if (linha != 0)
      {
        //while (!(PINB&1)) {}//wait for high
        //while ((PINB&1)) {}//wait for low
        //while (!(PINB&1)) {}//wait for high

        while (linha--)
        {

          while (!(PIND&4)) {
          }//wait for high
          while ((PIND&4)) {
          }//wait for low
          //      int a = millis(); //teste de tempo

          uint16_t byte1, byte2;
          uint8_t buf[512];

          uint16_t  coluna_temp=coluna;
          while (coluna--){

            for(int i=0; i<2;i++){
              while (!(PIND&4)) {
              }//wait for high
              if(i==0){
                byte1= (uint8_t)(PINC&15)|(PIND&240); //B 00001111 (A0 a A3) ou 11110000 (d7 ao d4)
              }
              else{
                byte2= (uint8_t)(PINC&15)|(PIND&240);

                //((byte1<<8)|byte2);
               /* for(int x=0;x<512;x++){
                  buf[x]= (((byte1<<8)|byte2),BIN);
                  d+=buf[x];
                }*/
            sendMsg(client, ((byte1<<8)|byte2));
                //Serial.println(d);

                // Serial.println(((byte1<<8)|byte2),BIN); //B 00001111 (A0 a A3) ou 11110000 (d7 ao d4)
                //teste++;
              }
              while ((PIND&4)) {
              }//wait for low
            }

          }
          //                                        int b = millis(); //teste de tempo
          //  Serial.println((b-a)); //teste de tempo
          coluna=coluna_temp;
        }

        //while ((PIND&1)) {}//wait for low

      }
      //uint16_t b =millis(); //teste de tempo
      //Serial.println((b-a)); //teste de tempo
     // return teste;

    }

    void connectWeb(int port, byte ipServer[]){

      if (client.connect(ipServer,port)){
        Serial.println("Conectado");
        //essa e a parte que da erro. Perceba que estou enviando a mensagem
        //aqui, mas a intençao e enviar na funcao de tirar a foto.Aqui e teste
       // sendMsg(client, 800);

      }else{
        Serial.println("Conexao falhou");
      }

       if (!client.connected()) {
        Serial.println();
        Serial.println("disconnecting.");
        client.stop();

        // do nothing forevermore:
        while(true);
      }

    }

    //void sendMsg(EthernetClient client, uint8_t msg){
    //      client.println("valor "+String(msg));
    //}

    void sendMsg(EthernetClient client, uint32_t msg){
          client.println(msg,DEC);
    }

An Arduino is probably the wrong choice for this job - even if you can get it working at all, it will be limited to a small fraction of that camera's capability.

@ChrisStratton If the Arduino acts as a bridge between the ESP and camera then there would be no functionality loss except longer transfer rates. But Arpit it's a better idea to remove the Arduino, use the ESP instead to read the data from the camera and send it via wifi.

You should start from connecting Arduino UNO to PC. For this purpose use the following article: Arduino Uno и камера ov7670 — пример использования. You can disregard the longer text in Russian on top, it discusses why choose exactly this camera.
As listed in that source, the main problems you will find are:

The camera input current is not 100% compatible with the Arduino current. You will need to use resistors. The linked blog includes a schematic how to connect both.

You will need to write code for connecting both. There are examples on the Internet. You can also see the code used in the link. The main gotcha here is that the camera works in YUV mode. Each pixel in that format is coded with two bytes. The first byte codes the grey gradient, the second carries the chroma information. For a simple test, it is sufficient to get a greyscale image, so discard the second byte.

The oscillograms in the linked site show the signal we are expecting, followed by the code needed to read the image information.

The actual program for getting the image can be very simple. The author of the linked article wrote one. It reads from COM9, uses Java communication API and saves in bmp. You can download it here.

This simple test connection has following disadvantages:

Without buffering, the picture smears
There are synchronisation artefacts in the image
You cannot change the focus, the subject has to be kept at the camera's focused distance.

Transferring data via Wi-Fi will be the next step. But it will be hard because Uno and Wi-Fi module are connected via UART interface and maximum speed is limited to 230.4Kbps.
Here is example how to transmit image via bluetooth, Передача картинки с OV7670 через Arduino Uno на Android телефон. It maybe useful to you.
It assumes that you have connected the Arduino and the camera as described above, as step 1.
In step 2, you have to solve the problem of speed mismatch. The HC-06 UART interface and the Arduino Uno have following speeds:

HC-06: 1200 / 2400 / 4800 / 9600 / 19200 / 38400 / 57600 / 115200 / 230400 / 460800 / 921600 / 1382400
Arduino Uno: 2400 / 4800 / 9600 / 14400 / 19200 / 28800 / 38400 / 57600 / 76800 / 115200 / 230400 / 250000 / 500000 / 1000000 / 2000000

The maximum speed common to both is 230400, so you have to use that. You then need to reduce the internal processing speed with wrReg(0x11, 31);. You still cannot send at 230400, because the picture is sent in two steps, first the even rows, then the odd ones. You have to write the Arduino application to capture the image.
Finally, you can write the phone software. It only has to read the picture and show it on the page, nothing more. On a Bluetooth 2.1, the blog author measured more than 1 minute per frame, and the result was highly distorted. On Bluetooth 4.0, the picture quality was acceptable, and sending took less than 15 sec per frame.

Unfortunately, the links that you provide are to blogs written in Russian, and this is an english speaking Q&A site. Could you edit your answer to also provide links to pages written in English?

This is basically a link-only answer which will become useless if the target site goes down. Plus the linked site is in Russian, and this is an English-language site. It would be helpful to post or summarize the information there, in English, in your answer.

unfortunately he didn't read your post and said 'connect to uno' when you clearly stated you are using an esp8266

translation from page: http://privateblog.info/arduino-uno-i-kamera-ov7670-primer-ispolzovaniya/ (consult links in the original link as I couldn't post them because I need at least 10 reputation blah blah blah)
Arduino Uno and camera ov7670 - an example of use
(December 15, 2015)
Currently, the ov7670 is the most affordable image acquisition module for Arduino fans. Once it cost about $ 12, now its price dropped to less than $ 5.
ov7670 ( datasheet ) has good opportunities for its price:

different resolution VGA (640 x 480); - QVGA (320 x 240); - CIF (352 x 240); - QCIF (176 × 144);
transmission speed up to 30 fps,
several ways to encode an image RAW RGB, RGB 565/555, YUV / YCbCr 4: 2: 2
interface interaction I2C.

It would be ideal if not for one problem - connecting and getting at least a test image, as in any more or less complex hardware. There are a lot of discussions on the Internet, articles, recommendations, but it's impossible to find clear steps: someone is lazy to write them, someone lays only a diagram or code, somebody does not spread anything at all, but reports only about successful connection. Especially it would be desirable to note ComputerNerd which has laid out fine example with the small description, but for the beginner it is not enough.
This article is intended to show how to connect, configure and get a test image using a small program on java, which will be an excellent starting point for further experiments.
I conducted my experiments on Arduino Uno, as it was best described - connection schemes and articles. There was an attempt to set up on Arduino Mega, but it ended badly. It turned out that on the scaffold A4 and A5 this board already has a reference voltage of 5v, which burned the camera.
In my example, the camera will be used

AtmelStudio + arduino plugin
ov7670 without buffer, operating mode qvga (320 × 240), encoding YUV
Arduino Uno
2 resistors per 10kΩ
2 resistors at 4.7 kΩ
a computer.

Connection scheme for ov7670 to Arduino Uno

Programming the camera needs to start with the correct connection. The voltage of the camera inputs differs from Arduino voltage in places, so resistors are needed.

Connection scheme ov7670 to Arduino Uno

The program for ov7670 and Arduino Uno

To compile the program, we used an example from ComputerNerd, which had to be cut off a bit and then replaced in places. The code can be downloaded from the link .
The basic steps in the code are as follows:

Setting the Arduino Uno PWM, so that it gives out 8mhz on the 11th leg.

DDRB | = (1 << 3); // pin 11
ASSR & = ~ (_BV (EXCLK) | _BV (AS2));
TCCR2A = (1 << COM2A0) | (1 << WGM21) | (1 << WGM20);
TCCR2B = (1 << WGM22) | (1 << CS20);
OCR2A = 0; // (F_CPU) / (2 * (X + 1))
DDRC & = ~ 15; // low d0-d3 camera
DDRD & = ~ 252; // d7-d4 and interrupt pins

Configuring the I2C Interface

TWSR & = ~ 3; // disable prescaler for TWI
TWBR = 72; // set to 100khz

Configuring RS232.

UBRR0H = 0;
UBRR0L = 1; // 0 = 2M baud rate. 1 = 1M baud. 3 = 0.5M. 7 = 250k 207 is 9600 baud rate.
UCSR0A | = 2; // double speed aysnc
UCSR0B = (1 << RXEN0) | (1 << TXEN0); // Enable receiver and transmitter
UCSR0C = 6; // async 1 stop bit 8bit char no parity bits

Camera setup

....
wrReg (0x12, 0x80);
delay_ms (100);
wrSensorRegs8_8 (ov7670_default_regs);
wrReg (REG_COM10, 32); // PCLK does not toggle on HBLANK.
...

Obtaining an Image

The operating mode of the image transmission camera was set to YUV. In this case, each pixel is encoded with two bytes. The first byte encodes the gradation of gray, the second - color-difference component.

The task for us is to get at least a black and white image, so the second byte can be discarded.
Next, we need to bring an oscillogram from which it becomes clear what signals we expect with high and low values.

oscillogram ov7670
StringPgm (PSTR ( "* RDY *" ));

// VSYNC
while  (! (PIND &  8 )); // wait for high
while  ((PIND &  8 )); // wait for low

y = hg;
while  (y -) {
   x = wg;
   while  (x -) {
      // PCLK
      while  ((PIND &  4 )); // wait for low
      UDR0 = (PINC &  15 ) | (PIND &  240 );
      while  (! (UCSR0A & ( 1  << UDRE0))); // wait for byte to transmit
      while  (! (PIND &  4 )); // wait for high
      while  ((PIND &  4 )); // wait for low
      while  (! (PIND &  4 )); // wait for high
   }
}
_delay_ms ( 100 );

The program on java to get the image from ov7670 via Arduino Uno

The program for obtaining images is extremely simple. It receives data from the COM9 port using the Java Communication API  and saves it as bmp. All variables are set directly in the code, so you'll have to change it to your own.
grabber

Results

On the basis of the images you can immediately draw a conclusion about the shortcomings:

The lack of an internal buffer leads to the blurring of the picture, it is immediately transferred to the computer, and this takes time.
There are artifacts in the form of horizontal stripes - synchronization failure in obtaining a picture. Instead of the gradation of gray sent tsvetraznostnaya component.
The subject must be in the focus of the camera for a clear image

This article can be finished. Waiting for comments and suggestions.


text:
Day-night powered Arduino
What should I do to have an Arduino Pro Mini 5V (clone) powered by a 5V solar panel during the day and by battery during night which will be charged during the day by the solar panels.

is there any guide out there?
is it possible with the 5V version of Arduino Pro Mini or will I have to buy the 3.3V
I prefer to make the circuits by myself rather than buying them (for example: the charging circuit.)

This would be better answered on Stack Exchange Electrical Engineering.
Also see this question and answers. This is not quite the same and the answers there are OK but less than complete or correct, but it adds to the resource available.
You need a battery charging controller, a PV (solar) panel capable of producing somewhat more than maximum battery voltage and enough energy to operate your circuit and a battery with enough voltage to operate the device and enough capacity to store the energy.
Current drain will vary with total circuit. You can measure this will a milliammeter. I'll assume that 50 mA continuous will be enough. Less or much less may suffice. I have a pro mini clone operating at 20 mA on 5V at present and with due care you may be able to operate one with less or much less current depending on application and what your circuit needs are.
Looking at solar current needs at present, the average solar current needed is about Icircuit x 24/SSH mA where SSH = average sunshine hours per day. eg if you had 4 hours of sunshine per day but want to run the circuit for 24 hours a day the sun must provide (24 hours per day)/(4 hours of sun) = 6 x as much current as the circuit needs on average. So if your circuit needs 50 mA continuous the PV panel must provide 6 x 50 mA = 300 mA for 4 hours per day. You will see below that this is not a trivial amount.
Sunshine hours per day may be found for sites worldwide using the excellent www.gaisma.com The average sunshine hours per day for Iráklion may be found at that link and other locations in Greece can be found here but will probably be similar.
For Iráklion the SSH may be found in the 1st line of the 4th chart.
Average hours/day of equivalent full sunshine = kWh/m^2/day = a peak of 8.53 hours in June and a low of 2.08 hours in December.
Wow!
I think that is about as sunny a place in Summer as anywhere on earth not in the polar regions.  In Winter it gets about the same SSH as in my city. You can calculate PV sizing for peak summer - but if you want year round operation you should use the worst case winter month and add a bit for bad days.
For Iraklion us say 2 SSH per day so the panels needs to provide 24/2 = 12 x winter average load. So per 10 mA of load yo need 120 mA of panel and if the mean load is 50 mA you need 12 x 50 = 300 mA panel output.
Battery voltage needs to be > 5V at all times.
An easy cheap available starting solution is to use a 6B lead acid battery.
These are easyish to charge and provide a relatively stable operating voltage.
Vmax_charge is about 7V so an 8V or 9V PV panel is "about right". 9V is a common voltage for hobby applications. An alternative is to use a 12V panel. this is probably more suitable as they are widely available and cost per energy out is often lower. This wastes MOST of the panel output but still MAY be the cheapest option in many cases. (A 12V x 600 mA panel is rated at about 18V x 0.6A ~= 10 Watts. Actual Arduino load = 50 mA x 5V x 12:1 = 3 Watts)
At 50 mA load you need 24/2 x 50 mA = 600 mA PV output in full sun.
PV panel sizing is not as may be expected. It is easiest to get a panel that makes at least enough voltage and enough current. This is because panel RATED voltages are usually higher than the voltages they are used at. eg 12V system PV panels are usually rated at 18V max power voltage- so an 18W panel provide 18V at 1 A BUT if attached directly to a 12V battery the input to the battery = 12V x 1A = 12 Watts. There are ways around this but at first, just concentrate on panel mA.
So, you "need" a 600 mA panel for a 50 mA load.
Or a 60 mA panel for a 5 mA load.
Or a 6 mA panel for a 0.5 mA load.
Obviously, reducing load current is going to help panel sizing.
So knowing what your application really needs is essential.
Batery is easier.
If you use 6V lead acid then for one day you need.
Hours x load = mAh.
Here load=24 hours. mA = 50 in this example.
mAh = 24 x 50 mA =  1200 mAh = 1.2 Ah. This is the capacity of about the smallest LA battery commonly available. In practice you want to discharge your battery by only a small % of its actual capacity so use a 2.4 Ah or 3.5 Ah or larger. 7Ah is not vastly dearer and will last far longer and will have several days of reserve capacity for bad weather.
Charging can now be discussed - but I'll stop here and see what is said about the above. We can add charging and other detail if it seems useful to do so.

An easy battery to use is 2 x LiIon or LiPo cells in series.

Your coverage of solar power usage and calculations was excellent, are you going to continue the discussion with charging?

@KellyS.French 3years - 2 days old answer I see :-). It would perhaps be useful if you ask a specific question, referring to this Q&A. Also - reading what is said on SE EE on LiIon and other charging by me and others would quite possibly cover the subject well enough. | SE EE Battery charging and My 298! battery charging SE EE answer

@KellyS.French ...  and subsets: My Li bat charging answers ...
and LiIon charging and Nimh charging

source: Stack Exchange

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

sort: votes


text:
Converting Random Binary Data to PWM Signal
I am using a Arduino Due. I am doing a project on Visible Light Communication. I need to convert a binary data into a PWM Signal. Can anyone suggest me a method of generating that PWM Signal based on the binary data given?
Thank You.

So, if you simplu has to convert the binary data to PWM signal there are few things you need to cover:

If the binary data that you are receiving from the sensor is linear or non linear.
What is the size of binary byte. Ex: int(16 bits),char(8 bits),long (32 bits).
If it is linear, then if the data is multiplied by some number it will output a value betwen 0-255.
If the data is not linear than you just need to create an giant array with the pwm intensite value direct without any particular mathematical function. Ex: array[1024] = {0,1,1,2,3,4,5,5,6,6,10,9,...}; (1024 values because if you are using analog input. Then you can direct output the values from array:
analogWrite(3,array[x]); //x being your data

Here's the linear Example:
   //map(value, fromLow, fromHigh, toLow, toHigh);
    y = map(x, 0, 1023, 0, 255);

Doing this, y will receive a value from 0 to 255. You just need to first do a simple serial program that prints you through arduino serial window the binary data and see if the data increases or decreases conform your light project.

I don't know about your programming levels or if you are using a digital sensor or analog sensor, but if you are using a digital sensor, so you are probaly using SPI communication or i2c. Then you just need to read that binary data and take where the values bits are with bit wize manipulation.
y=(x & (0xfff<<3))>>3;

Tell me more about the source of data, how this data is and how is the behavior of the data so i can help you a lot more. Thanks

Rather than completely build everything from scratch,
perhaps you can use some already tested and debugged Arduino library designed for free-space optical communication, such as

Ken Shirriff. "A Multi-Protocol Infrared Remote Library for the Arduino".
A1RONZO at Sparkfun. "IR Communication tutorial"
Dave. "EEVblog #506 - IR Remote Control Arduino Protocol Tutorial"
"Multitasked IR transmission"
"Arduino universal remote" (has 2-way communication, both send and receive)
"IR Remote Control Theory" (links to many different "standard" infrared protocols)

Practically all of these systems convert expand arbitrary binary data to structured "frames" or "packets" of information including some sort of checksum.
Each packet is repeated several times; hopefully the receiver catches at least one of them.
Each bit of the packet is expanded to either the "pattern representing a 0 bit" (typically turning the LED off for the full bit time) or the "pattern representing a 1 bit" (typically blinking the LED at 38 KHz for the full bit time, typically using a PWM).
To make the hardware and the software simpler and cheaper, most of these systems transmit only a few dozen bits per second.
A few free-space optical communication systems are designed to run much faster, such as RONJA.

Count the amount of time a signal is high over a certain period, and use the ratio of on time to period as the duty cycle for the PWM signal.

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

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


text:
MG2639 CELL AND GPS LIBRARIES
I'm using a MG2639 Cell Module with the SMS and GPS functionality.
I have a sketch that sends through SMS the location of the arduino UNO.
This is my code:
#include <SoftwareSerial.h> //to communicate with mg2639 cell module.
#include <SFE_MG2639_CellShield.h> //basic librarie of the module.
#include <AltSoftSerial.h>   //to communicate with the GPS module
#include <TinyGPS++.h>    //to acquire the NMEA codes.

TinyGPSPlus gps;

AltSoftSerial ALTS(9, 8);
char celprim[11]="4423337388";
uint8_t GPStatus=0;
long temp=0;

 void configurado()
{
  sms.start(celprim);
  sms.print("Transmitiendo GPS Tracking....");
  sms.send();
  delay (6000);
}

     void GPSTracking()
{
   do
      {
        if (ALTS.available()>0)
          if (gps.encode(ALTS.read()))
      {
        if (gps.date.isValid() && gps.location.isValid() && gps.time.isValid()){
          sms.start(celprim);
          sms.print("Fecha/Hora/Ubicacion: ");
          sms.print(gps.date.day());
          sms.print("-");
          sms.print (gps.date.month());
          sms.print("-");
          sms.print(gps.date.year());
          sms.print(" ");
          if ((gps.time.hour()-5) < 10) sms.print("0");
          sms.print(gps.time.hour()-5);
          sms.print(":");
          if (gps.time.minute() < 10) sms.print("0");
          sms.print(gps.time.minute());
          sms.print(":");
          if (gps.time.second() < 10) sms.print("0");
          sms.print(gps.time.second());
    sms.print("https://www.google.com.mx/maps/dir/19.4161748,-99.1664011/");
          sms.print(gps.location.lat(), 6);
          sms.print(",");
          sms.print(gps.location.lng(), 6);
          sms.print("/@");
          sms.print(gps.location.lat(), 6);
          sms.print(",");
          sms.print(gps.location.lng(), 6);
          sms.print(",19z");
          sms.send();
          GPStatus=1;
        }
    }
      if ((millis()-temp) > 30000 && GPStatus==0)
      {
        GPStatus=1;
        sms.start(celprim);
        sms.print("Imposible ubicar equipo, intente mas tarde...");
        sms.send();
      }
    }while (GPStatus ==0);
}

void setup()
{
  delay (5000);
  int beginStatus = cell.begin();
  if (beginStatus <= 0)
  {
     while(1)
      ;
  }
  delay (10000);
  sms.setMode(SMS_TEXT_MODE);   //Se pone al modulo en modo de recepción y envio de sms
  ALTS.begin(115200); // Or whatever rate the GPS uses
  configurado();
}

void loop()
{
  if (GPStatus==0)
  {
    temp = millis();
    GPSTracking();
  }
}

Is it possible to use only AltSoftSerial to create 2 serial ports and communicate with both cell and GPS in order to reduce program storage and global variables space? If it's possible, what changes should do in the MG2639 library to make it work?
Or what could i do to reduce space.

Is it possible to use only AltSoftSerial to create 2 serial ports and communicate with both cell and GPS in order to reduce program storage and global variables space?

The question is a little vague.
AltSoftSerial only works on pins 8 & 9, so I thought you were asking if you could connect both the cell and the GPS to pins 8 & 9 (using jumper pads on the back of the board), and use one AltSoftSerial instance to talk to both devices.  If it were possible, this would save RAM (just one instance) and program space (you wouldn't need two link in another software serial class, like SoftwareSerial).  However, this is not possible.  Serial connections are always point-to-point.  Although two "things" can listen to one RX line, the TX line cannot be shared by two devices.
If you were asking if you can have two instances of AltSoftSerial on two separate pairs of pins (e.g., 2/3 and 8/9), the answer is again "No", because... AltSoftSerial only works on pins 8 & 9.  Also, the SparkFun library only uses SoftwareSerial to talk to the cell.

what could i do to reduce space.

Use NeoGPS instead, and use the F macro around double-quoted strings that you print:
    sms.print( F("Imposible ubicar equipo, intente mas tarde...") );

That will save several hundred bytes of RAM.
Also, you may be sending multiple SMS's per second.  It depends on what sentences the GPS emits.  As it is, your sketch will send one SMS per sentence (i.e., one for each encode).  Even if you don't use NeoGPS, look at the example program NMEAloc.ino et al for the correct program structure.  The Troubleshooting section also contains some tips.

Huh? It sounds like the original poster already knows that serial connections are point-to-point. Also, he's using the MG2639 Cellular Shield, which connects the "cell module" to Arduino pins 2 and 3; and the "GPS module" to pins 8 and 9, so I don't know why you brought up "shared by 2 devices".

@DavidCary, do you think he means two instances of AltSoftSerial?  I thought he meant one instance shared by two devices.  This board has jumper pads on the back that allow you to connect the devices to other pins.  And because they default to being on two separate ports (2/3 and 8/9), I thought he wanted to wire them both to 8/9, the only port that AltSoftSerial supports.  I'll clarify.

Ok, didn't know AltSoftSerial can only be used at 8/9 pins. What I intend with this project is send an SMS to the MG2639 asking its location, so only in that moment it will acquire a valid GPS fix and reply it with a SMS. So i dont need to be listening the GPS port all the time.       My first sketch was using the hardware serial (0/1 pins) but i didnt get a valid fix, thats why i end up using AltSoft. Meanwhile i'll try to use NeoGPS but i'm not very skilled so it looks a little complex

Yes, NeoGPS is definitely more complex under-the-hood, but I've recently simplified the examples and improved the docs.  BTW, using pins 0/1 for the GPS would be the most efficient and reliable, but I'm not sure what steps need to be taken on the UNO.  The UNO's USB-to-Serial converter is also attached to 0/1.  Three things (UNO, converter & GPS) cannot share pins 0/1.  There might be a way keep the converter from interfering with UNO-GPS comms: disconnect the USB cable? Scratch out a trace?  Regardless, AltSoftSerial is a good alternative, and that's why they connected the GPS to 8/9.

@slash-dev, yes, I think he means two instances of AltSoftSerial or two instances of SoftwareSerial, kind of like how "How to utilize multiple software serial in libraries in Arduino?" uses several instances of SoftwareSerial for the Arduino to communicate to three other devices.

@slash-dev, Meanshile F macro is working great, in the basic sketch it reduced it from 66% of dynamic memory to 57%. I took it to my final program and from 92% reduce it to 69%, leaving behind the instability problems. Next step the NeoGPS library. Thanks for your help.


text:
Will this sketch eventually fail because of integer limit issue?
I am a novice in Arduino programming and I'm setting up an Arduino controlled, underwater time-lapse camera to take a picture every 2 hours.  It's going in the ocean for a month and I want to be sure that the code will not fail because of the upper limit that normal integers can go.
The Arduino simply switches on a relay (connected to the LED_PIN 11) and the camera does the rest, using a script from the awesome Canon Hackers Development Kit C.H.D.K.
I've tried several variations of sketch, some using simple delay, some with millis and some with counters that print what increment the loop it up to.
One of my fast running test sketches, that used a counter, stopped prematurely, I suspect due to hitting the integer limit but I'm not sure if this only occurred due to the fact that it had a counter in the sketch.  So I've gone back to the simplest sketch I can find hoping it will not have this issue.
I think I read that once the integer limit is reached, the sketch will simply restart.  Or maybe it will become unpredictable.  I'd rather the  former than the latter.
Any suggestions would be welcome.
I am sure there are many ways to go about this but I'm looking for the simplest and most robust one I can find, so that I can adjust the async timing easily ie.
loop starts
CameraOn for 10 seconds
CameraOff for 2 hours
Loop repeats
thanks in advance for your consideration
Here's the sketch I'm testing right now.
#define LED_PIN 11
#define LED_OFF 7200000     // 2 hours in millis
#define LED_ON  8000       // 6 seconds in millis

unsigned long ms;        //time from millis()
unsigned long msLast;    //last time the LED changed state
boolean ledState;        //current LED state

void setup(void)
{
    pinMode(LED_PIN, OUTPUT);
}

void loop(void)
{
    ms = millis();
    blinkLED();
}

void blinkLED(void)
{
    if (ms - msLast > (ledState ? LED_OFF : LED_ON)) {
        digitalWrite(LED_PIN, ledState = !ledState);
        msLast = ms;
    }
}

==================================================================
Okay, I've come up with a new, much simpler sketch based on delay.
Can someone please tell me if this is more robust in terms of continued looping for weeks on end?
#define LED_PIN 11

void setup()
{
   Serial.begin(9600);
   pinMode(LED_PIN, OUTPUT);
   digitalWrite(LED_PIN, HIGH);
}

void loop()
   {
       delay(7200000);                 // 2 hours in millis
       digitalWrite(LED_PIN, LOW);
       delay(8000);                    // 8 seconds in millis
       digitalWrite(LED_PIN, HIGH);

   }

#define LED_ON  10000      // 1 seconds in millis      ..... tell me,  what does milli mean? .... hint: it is a prefix, like in millimeter and milliliter  and milliseconds

why are you initializing Serial?

the first seven words of my post introduce me as a novice..I'm hacking and snipping from all over the place and gradually filling in the blanks in my knowledge... Yes, I should probably spend a few days doing tutorials to get the basics but, I think you'd agree this is a simple task, so I have rolled up my shirtsleeves and dived in.

Possible duplicate of How can I handle the millis() rollover?

@Juraj, this is about letting the Arduino run for a long time. No duplicate I think. Hazy, both sketches should work as far as I can tell. When using large numbers I prefer to use "52000UL". The "UL" means it is an unsigned long number. Please update both your sketches and write also how long it is in comments at every large number. For example "52000" is 52 seconds. How is it powered? With a battery? Will that last long enough? The arduino boards are for fast prototyping, it is not protected against a harsh environment.

Thanks @Jot,  I've updated the sketches to the desired inteval (not very desirable for testing mind).
This unit will sit inside an underwater housing, fixed to a seaweed farm tray, roughly 1.5 meters below the surface of the Pacific Ocean, 5km off the north shore of Bali.
Ive

Cont...
I've just purchased a 26,000mAh USB power bank which will power it.  A recent 24 hour run test, measure on a USB Wattmeter showed 0.74W/h , so 26Ah / 0.74W/h = 35.135 days.  It's anybody's guess at what point it will not have enough voltage to drive the camera but, fortunately, we're aiming for as-long-as-it'll-run, rather than trying to hit a definite number of days.

@Jot, this is about "Will this sketch eventually fail because of integer limit issue?". the answer is no, because it correctlly handles the millis rollover

@Hazy, you should not ask more questions at once, here at SE https://arduino.stackexchange.com/tour

If you want any form of accuracy to your timing you should consider an RTC. The internal millis() is not particularly accurate over long periods.

26,000mAh USB power bank...  Good luck with that...  The best 18650 battery packs you can get retail (panasonic) are 13400mAh (4P, 3350/cell). Each one costs £70, so about £18/cell.  To get 26,000mAh you would need 8 cells, totalling about £140. And that is with proper batteries. Stuff off eBay / Amazon you'd be lucky to total 2600mAh from all the cells in it. A typical eBay battery has cells of about 1000mAh in them. You'd need 20+ cells in your battery for that to add up...

Oh, and if the cells are laid side-by-side as most power banks are, it would measure over a foot long.

There's a reason why "high capacity" USB power banks on eBay are so cheap - they aren't. High capacity, that is.  Every single seller out there blatantly lies about the capacity. Usually multiplying it by a factor of 10 or more.  I have seen 50,000mAh power banks with an acutal capacity of just 2600mAh.

@Majenko I hear you about the manufacturer's claims vs reality but this is the only form factor battery that will fit in my housing.  I bought from Amazon and here's a fairly comprehensive YouTube review, including charge and discharge measurements  https://www.youtube.com/watch?v=AqIwb4395SY

No, the sketches will not fail or work incorrectly. The Arduino "delay()" function calls the "micros()" function for timing. The "micros()" function uses the Atmel's TIMER0 clock and waits for 1000 microseconds (1 milliseconds) each iteration. The TIMER0 overflows about every 70 minutes, but the program code used in the "delay()" function handles that overflow correctly.

Actually Timer 0 overflows every 1024 µs.

You are somewhat more correct than I was (I was looking at the 16-bit Timer1) but actually both of us are wrong, since the overflow of the timers are dependent upon the prescaler settings. Nevertheless the timer overflow won't impact the micros() return value and therefore doesn't impact the response to the original question

On the Arduino Uno (that's what the OP is using), the initialization code in the Arduino core library sets the prescaler of Timer 0 to 64. If you mess with that prescaler (the OP doesn't), then all the Arduino's timing functions will be off.

the question was about the millis version of the code, not about later added version with delay()

Thanks for your input..  I feel more confident now to put it in the water.
@Juraj Sorry if I appear to be asking more than one question.  I did only mean to ask one but now I realize that question was not as precise as it could have been.  It should have been phrased "Should I use the 'millis' or 'delay' approach to avoid any issue with the integer limit"
Cheers

@Hazy, did you ever think about delay() overflowing? because this answer is about that. about delay() implementation over micros()

@Juraj I didn't but the helpful answers from Edgar Bonet and Zanshin informed me of the fact that delay 'overflows' but, apparently it shouldn't impact my project because I haven't fiddled with the prescaler - whatever that is.

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


text:
Arduino Mega timeout communication with programmer error
I have an Arduino Mega 2560 and it was working fine until about lunch time when I started getting this error:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

I know it isn't the code I'm running as I tried to load it onto an Uno and it seemed to load without issue. I need to use the Mega as it has more ports, though.
From what I have read this is potentially an issue with the bootloader and is possibly related to the current version of Arduino. I know virtually nothing about the bootloader; all I know is that it is used to upload code to the Arduino (I think...), therefore I have a fear of just messing around with related files unknowingly.
These pages are the ones I've been looking at, but like I said, I don't really know enough to feel comfortable with just messing around with the files.

Mega2560: timeout communicating with programmer....
Upload Timeout Error on Mega 2560 - Not Sure What Changed

I tried uninstalling my Mega totally, then reinstalling it. I also downloaded an older version of Arduino (0022) and neither option seemed to work.
I don't know what to do, or how to change the 'AVR' files if necessary.

possible duplicate of Some dude named avr won't let me upload my program, aka "avrdude: stk500_getsync(): not in sync: resp=0x00"

Ohhh I didn't notice that post. I've tried everything except burning the bootloader... is there a simple way to do this without having to buy software?

usually you just go to the IDE, look under the tools menu, select "Burn Bootloader". Make sure to select the right board first.

@TheDoctor, I've seen that option, but I have no idea what to do afterwards. I presume I have to load it again with a new "bootloader" program? One site (https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader) says I need to buy hardware and download specific software... all to replace the software on the bootloader?! I'm not sure I understand why.

I think the menu item is only for arduinos that have a progrmmer built in, like the Uno and Mega

So if I clicked that menu item... do you know what would happen? I don't want to do anything I don't understand just in case there is a simpler solution. Thanks for help.

This is the super-simple solution. buying hardware is a more complex task. Do you have any other arduinos?

I have an Uno, but I got the Mega because the Uno can't cope as well and doesn't have as many ports (it's used to control a robot vehicle)

You can use the Uno to reprogram the Mega. Look up ArduinoISP

Has something changed that means you can burn a bootloader without an ISP?

I've been having this exact issue with my Mega2560 lately. Click upload -> compiles -> upload begins (serial tx/rx blinking) -> avrdude timeout. But this is an intermittent problem. It uploads correctly maybe 20% of the time.

The bootloader on an arduino is just a piece of software written to enable you to update your sketches using the usb connection. Without the bootloader you can't upload sketches using just the arduino ide.
More information about the bootloader can be found here: http://arduino.cc/en/Guide/Environment?from=Tutorial.Bootloader
Look under the heading entitled uploading which explains the part the bootloader plays in uploading sketches.
When you use the "Burn Bootloader" button in the arduino ide it will attempt to write a new copy of the bootloader onto the attached Arduino board. To do this the board must be attached in a specific manner - that is - using the icsp/isp header rather than the usb cable.
Now to program the avr chip directly you have to use an external (hardware) programmer. Fortunately you don't have to buy one if you have a second arduino because the second arduino can be used as a programmer. Instructions for doing so can be found here: http://arduino.cc/en/Tutorial/ArduinoISP
Even more info about the bootloader: http://arduino.cc/en/Hacking/Bootloader?from=Main.Bootloader

Unfortunately this error refers to many different issues and there are so many posts here and on other platforms none with a definite answer. Maybe Arduino team should try to give better errors to differentiate. But I have tried to answer the same question here in this SO post.
what solved my issue was to go to Tools>Boards>Board Manager... select "updatable" for "Type" on top left and then select the updatable packages below and click on update.

This resolved my issue. I selected the update for the board and that it

I got this same error when my Arduino COM port was busy with other apps. I closed that app and upload Arduino sketch and error disappeared.


text:
I'm looking for a way to serially communicate with a multi mesh Arduino slave network
I have one PC running Visual Studio and a program that will be sending commands to Arduinos via serial COM Ports. So, in 11 Nano MCUs, I will have motor drivers L293D/L298N ICs, while in other Nanos I will have sensors.
What I would like to do is have a program in Visual Studio which sends commands via serial to actuate motors to each and every MCU on board. This is a robotic application and everything I mentioned above will be enclosed within the Humanoid.
Here are some examples of what I'm thinking of doing:
char data = Serial.read();
if (data == 'A')
{
  digitalWrite(13, HIGH);
}

Or something like this:
servodata = Serial.read();
if (servodata == '1') // Single Quote! This is a character.
{
  SERVO.write(pos);
}

As you can see, Arduinos will have something like this running and waiting for Visual Studio to send commands via serial to one or multiple MCUs simultaneously. I'm thinking 30 char dividing/spiting that number across each Rx Arduino.

Does my answer address what you wanted to know?

It's not obvious what the exact query is but answering the subject line question:
You can easily multidrop connect multiple serial / RS232 COM ports by having all slave RX inputs and the master TX output on one line, and all slave TX outputs connected by an OR network to a single line to the master's RX input.   The master 'talks' to all slaves at once. Each slave talks to only the master. Only one slave can usefully talk at once. Message destination assignment and slave-talking arbitration is carried out in software.
As shown below, the OR network at each slave can be as simple as a diode with cathode (bar side) to TX line and anode to common line to master RX.  A single pullup resistor (or an internal pullup in the master on the RX line) pulls the line high when all slave TX lines are high.
This diagram shows how simple multidrop communications can be.
NB - As shown the diodes polarity is for true RS232 with logical 1 = low = negative.
When connecting directly between UART TTL lvel (5V/0V) outputs reverse the diodes.
Also, add a pullup from +5V to the Blue RX line to the master - 10k to 5V is probably OK.

From here - Multidrop network for RS232.
When a slave TX pin is high its diode is "blocked" and it does not affect the common slave to master level. When any slave TX line goes low the common line is pulled low via its diode and the master sees the low. Normal RS232 COMs can occur between slave and master.
When the master sends all slaves see the transmission at once. A basic protocol must be established to allow messages to be handled by the intended recipient. This could consist of, e.g. sending an address word + command word or words. You can have a single slave act on a message or all slaves or a sunset, based on your addressing system.
The slave to master direction allows only one slave to send at one and you must ensure either that only one slave ever sends at a time and/or that collisions are able to be resolved.
Despite the obvious limitations of such a system it can work very well and is cheap and simple to implement. If there are many slaves the loadings should be checked so that e.g. the master TX is able to drive all slave RXs at once. As the circuit is unidirectional it is easy to add a basic buffer.

kind of very vaguely for a noob to understand some of your tech talk but im trying here

@Frank'sDesig'Nature - Look at the circuit above. Reverse the diode directions as you are using 0V/5V and not true RS232. Add a 10k from Master RX (blue line) to =%V. Try it. When Master drives TX line all slave RXs see the data. When any slave transmits the master sees the data but no slave does.

is there a reason why i cant just use one of those USB 3.0 5GBPS extension port? i men i use 2 usb port as in now from a extension of 4 usb all connected to one usb in my tablet and from there i open 2 terminals when i debug Tx and Rx from 2 diff arduinos with no issues SO why do i have to use this format? and not the usb way ? seems like a work out just to tx/rx data when the ide already does this with out extra crap like we been talking about?

[link]http://www.ebay.com/itm/111717351068

RS-485 or RS-422 are the normal industrial ways of having one serial port talk to many devices, especially in noisy environments with lots of motors.  It requires a driver chip for each device to get the right electrical interface.
RS-485 provides bi-directional communication if you want to receive data back from your remote nodes, and RS-422 provides "simplex" or uni-directional communication if you just want to blindly send commands with no feedback.
As for software, my ICSC library would probably be the easiest route to take - it allows you to address individual devices on an RS422 or RS485 bus and send commands to them.

@Russell McMahon thanks for your detail explanation despite the crazy typos i followed enough tho i think your under the impression that the slave arduino's will be tx anything back to the master "computer doing all the Tx" just want to be clear of this cuz you are talking a lot about slaves talking to anything when this will not be happening, the slave all they do is drive motors, thats is nothing else the have a sketch running that is looking for a parameter to be called serially using a long list of break/switch statements

this are the type of command i like to send to each Slave
Serial.println('LT2|LP3|LM5|LR4|LI6'); or 'LT2|LP3|LM5|LR4|LI6'
i want to send this type of block to each individual slave tho keep in mind that the above block is only to activate that slave and its speed, a additional block will follow with direction

like this guys ?

and if so i guess my next question would be if everything is tied common style how would the pc know who to send what to ?
if  send 'LT2|LP3|LM5|LR4|LI6' and i want that to be for one specific arduino i dont want all the arduinos to take those parameters
in this example block 'LT2|LP3|LM5|LR4|LI6' the LT2 go's as follow (L is the mcu while the T is = to the pin on that mcu (pin D7 ect..) and the 2 is speed aka delay(2); )
so as you can see will all the other arduino who aren't 'L' won't use this data in the serial port?
how would i addressing be done ?

The question about getting a particular Arduino to respond to a particular command is also asked by the OP here: How can I get a unique address for all my Arduino boards while in RS485?


text:
Undefined functions send() and receive() on TwoWire/SPI
I have downloaded a sketch that uses SPI.  The sketch includes the Wire library but at compilation time, I am getting errors that TwoWire doesn't have methods called send() and receive()?

This is caused by the sketch you downloaded being old.  In prior releases, the methods called send() and receive() were used to send and receive SPI data.  These were renamed to be write() and read().  If you change your code where there are references to Wire.send() and change to Wire.write() and also change Wire.receive() to Wire.read(), you should find that your applications compile and run correctly.


text:
Performing 32-bit arithmetic on embedded device
I am at the moment working with an Arduino Uno, and am struggling to understand how I perform 32-bit arithmetic using it.
The expression I have to calculate is this: √(2 n/a) in which n is an integer and a constant float.
I am at all not sure how I should do this so any advise would be helpful here.

I am not sure i understand the question...  add, substract, multiply and divide is possible.

the 16 most significant should be accurate.

There was a question about how to calculate square root recently, using integer arithmetic. Search a little bit.

binary.  a is a constant and could potentially be stored as a 32 bit fixed-point number , n is the input for the system,  it keeps incrementing everytime the formula has to computed.. i guess it could also be stored in a uint32_t

Not sure what problem you're trying to solve. All of this is perfectly possible in standard C.

Also note that sqrt(2n/a)=sqrt(n)*(sqrt(2)/sqrt(a)). The fraction is a constant (assuming a>0 and n>=0)

You wrote:

the 16 most significant should be accurate.

Are you absolutely sure about that? Please reconsider. It is easy, when
asking a question, to ask for something better than what you strictly
need... until you realize the cost of fulfilling those expectations.
I have been working recently on a fixed-point implementation of the
square root. It is meant to work with numbers in [0, 1) represented in
0.16 format, i.e. unsigned, 0 bits integer part, 16 bits
fractional part. It is based on the polynomial approximation
√x ≈ 0.1908901 + 1.5392302 x − 1.4475870 x2
+ 1.0217778 x3 − 0.3043110 x4
which is quite good for x ∈ [0.25, 1]. Numbers in (0, 0.25) can be
moved to that interval by successive multiplications by 4, and then
dividing the result by 2. In other words, by using the fact that
√x = √(4 x) / 2
The maximum error is 2.56e-4, i.e. 16.8 ulps (units in the last
place). It takes 298 CPU cycles to execute in the worst case. Note
that, in order to achieve this performance, I had to implement the
multiplication in assembly. Otherwise gcc would give me inefficient
code.
Here is the code:
/*
 * Convert x to a 16-bit fixed point number
 * with n bits after the binary point.
 */
#define FIXED(x, n) ((uint16_t)((float)(x) * (1UL << (n)) + .5))

/*
 * Fixed point multiplication.
 *
 * Multiply two fixed point numbers in unsigned 0.16 format.
 * Returns result in the same format.
 * Rounds to nearest, ties rounded up.
 */
static uint16_t mul_fix_u16(uint16_t x, uint16_t y)
{
    uint16_t result;
#if defined(__AVR_HAVE_MUL__) && defined(__AVR_HAVE_MOVW__)
    /* Optimized ASM version. */
    asm volatile(
        "mul  %B1, %B2\n\t"
        "movw %A0, r0\n\t"
        "ldi  r19, 0x80\n\t"
        "clr  r18\n\t"
        "mul  %A1, %A2\n\t"
        "add  r19, r1\n\t"
        "adc  %A0, r18\n\t"
        "adc  %B0, r18\n\t"
        "mul  %B1, %A2\n\t"
        "add  r19, r0\n\t"
        "adc  %A0, r1\n\t"
        "adc  %B0, r18\n\t"
        "mul  %A1, %B2\n\t"
        "add  r19, r0\n\t"
        "adc  %A0, r1\n\t"
        "adc  %B0, r18\n\t"
        "clr  r1"
        : "=&r" (result)
        : "r" (x), "r" (y)
        : "r18", "r19"
    );
#else
    /* Generic C version. Compiles to inefficient 32 bit code. */
    result = ((uint32_t) x * y + 0x8000) >> 16;
#endif
    return result;
}

/*
 * Fixed point square root.
 * Argument and result in unsigned 0.16 format.
 *
 * If defined(REALLY_ACCURATE):
 *   max error = 7.67e-6
 *   execution time:
 *     937   cycles (worst case)
 *     828.1 cycles (average)
 * else
 *   max error = 2.56e-4
 *   execution time:
 *     298   cycles (worst case)
 *     184.7 cycles (average)
 */
uint16_t sqrt_fix(uint16_t x)
{
    if (x == 0) return 0;
    uint8_t n;
#ifdef REALLY_ACCURATE
    if (x == 0xffff) return 0xffff;
    uint16_t x0 = x;
#endif
    for (n = 0; x < 0x4000; n++) x <<= 2;  // scale the operand
    uint16_t y;
    y = FIXED(0.30435, 15);
    y = FIXED(1.02173, 15) - mul_fix_u16(x, y);
    y = FIXED(1.44754, 15) - mul_fix_u16(x, y);
    y = FIXED(1.53925, 15) - mul_fix_u16(x, y);
    y = FIXED(0.19089, 16) + (mul_fix_u16(x, y) << 1);
    while (n--) y >>= 1;                   // scale the result
#ifdef REALLY_ACCURATE
    y = (y + ((uint32_t)x0 << 16) / y + 1) / 2;  // Babylonian iteration
#endif
    return y;
}

If you really need a very accurate result, you can
#define REALLY_ACCURATE. This will add a single iteration of the
Babylonian method, which is essentially Newton's method applied to
the square root:
y ← (y + x/y) / 2
where y is our approximation of √x. This looks like an easy win:
just a division, an addition and a bit shift. And it makes the result
practically perfect, with a maximum error of 7.67e-6 (0.502 ulps).
But the execution time is increased more than threefold, at
937 cycles in the worst case. This is because the AVR chip has no
hardware support for division, and the software alternative provided by
the compiler is awfully slow.

You could probably specify _Fract as the type in recent (>=4.8) versions of avr-gcc and get at least a little help from the compiler.

@IgnacioVazquez-Abrams: Indeed! I still have to test that feature. It may well solve the issue of inefficient multiplication.


text:
Ramping a stepper motor
I at the moment trying smoothly move a stepper motor. The problem with the stepper motor, is that it makes a high pitch noise while it moves, or sometime a crackling noise from the motor.
So i tried ramping up the frequency of the step signal, which seemed to help a bit but not perfect. Then I tried micro stepping rather than  full stepping, which also helped a bit but still, the noise is very clear.
The motor I am using is a PK244-01A
And the driver it is connected to is this one
I am not at all sure if the ramping I do is either too steep, or completely  incorrect, but here is the code that controls the motor.
void stepper_motor::step_pwm()
{

    digitalWrite(en_pin,HIGH);

    delay(0.005);

    digitalWrite(dir_pin,HIGH);
    //LOW  - Move towards the sensor
    //HIGH -  Move away from the sensor

    delay(0.005);
    int increment = 0;
    int step_count = 0;
    while(step_count <= max_step)
    {
      digitalWrite(step_pin,LOW);
      delayMicroseconds(2000);
      digitalWrite(step_pin,HIGH);
      delayMicroseconds(2000-increment);
      step_count++;

      if(step_count >= 1)
      {
        increment++;
        step_count = 0;
      }
    }

}

Anything I could do to make the noise of the motor less significant?

If you want to figure out if the issue is with your ramping or your operation, decide if the problems are evident only during speedup or slowdown, or if they are also evident while the motor is running at the target speed.

Well... The issue occurs during the ramping up, from the start and up... as you can see in my code, i don't end at a certain point, i just start at a frequency and increases it for each step it moves.   It makes the sound at all time.. I am not sure what i should change? The rate? the start frequency? or something completly different?

Your ramp isn't linear. Your step period is determined by the increment variable, yet how often you increment the increment variable depends on the step period. Shorter steps lead to more frequent increments. I'd use a hardware timer of the ATmega to generate the step signal, an interrupt of said timer to increment the step count on each step, and have the speed control logic running in parallel as the main task, at a fixed frequency. An easier option would be to have a library do all that for you, e.g. accelStepper.

When it comes to noise, that's what steppers excel at producing. You won't be able to eliminate it, but you can take measures to reduce it: Drive the coils with a sinusoidal current waveform (which is exactly what microstepping does), reduce the motor current, reduce the acceleration of the motors and mount the motors with a vibration damping material. The "crackling" is what happens with uneven timing due to bugs in your code.

I had a similar issue once before. It actually matters a lot to properly ramp up your stepper motor. Especially under load if you ramp up too steep you can loose steps.
Since you are already using the arduino environment I suggest you could use the AccelStepper library.
I lets you set the acceleration and max. speed parameters nicely and uses a properly calculated ramp.

How would i know the proper acceleration?.. is it stated in the datasheet? is there a general rule or something like that?

You need to be using the adjusted delay for both the high and the low part of the signal.  Also, what happens when the variable "increment" is larger than 2000?  Nothing good, for certain.  I'd personally like to be able to delay by a negative number and undo some things that are already done, but I don't think yoz can turn back time using an Arduino.

you are right about the above 2000. I don't run the code for that long, usually just check it for 3 seconds an turn it off. so i guess i would have reached a negative delay.   How do i figure out these adjusted delays?

The "adjusted delay" is just the value you've already calculated:  2000-increment


text:
What are the main differences between Arduino and mbed?
I have been working a lot with the Arduino platform over the last year. Arduino makes it very easy for beginners (in my opinion) to get started and has a large community and a lot of libraries for all kinds of peripherals.
Now, I am considering to have a look at mbed, too.
What are the main differences I would face, both practical and conceptually?

As both an Mbed user and an Arduino user, this is my perspective on the differences between the platforms.

The IDEs are completely different. The Mbed IDE is an in-browser compiler that allows you to easily import other people's source code. It is a full c/c++ IDE that saves your code to your online Mbed account. You must be signed in to do any development work (requires internet access). Code completion exists, but is clunky. Project format more closely mirrors c/c++ programming than does Arduino's environment.
Programming the board is different. The Mbed uses a custom boot loader. The Mbed shows up as a flash drive when you plug it into your computer via USB. You compile your code using the online IDE, download the .hex file, and copy it to the Mbed. It's actually pretty neat, but more time consuming than clicking the 'Upload' button in the Arduino IDE.
The Hardware is different. This means different pinouts, as well as different capabilities. Take a look at the Mbed platforms and compare them to the Arduinos. Mbeds are generally more powerful than Arduinos (cpu speed, mem size, build in capabilities).

I use my Mbed when my Arduino isn't powerful enough or fast enough. It would replace Arduinos for me if it wasn't for the online IDE. The IDE is a little awkward to use, and it takes too long to program the board (downloading/copying and pasting is much more inconvenient).
I'm able to use all my same sensors and peripherals that I purchased for the Arduino with my Mbed (Except for shields due to the physical layout differences). I sometimes have to rewrite code to get it to work on the Mbed, but that's a good learning exercise.

Nice answer. What about pricing? mbed seems to be a lot more expensive (maybe because there's no cheap Chinese clones). Is it possible to use a standard build chain instead of the online compiler?

@fuenfundachtzig I'd compare the mbed to the Arduino Due or Mega. In which case, it is more expensive by ~$10. Not too bad. I got my mbed for free by emailing the company and asking to be be 'sponsored' (I was using an mbed for my senior project).
Thats a good question about the standard tool chain. A quick google looks like it is possible ( http://developer.mbed.org/cookbook/Using-mbed-with-gcc-and-eclipse ). I'll have to give it a try

This seems to focus inplicitly on the original mbed board, but by the time you wrote this the focus had really shifted to supported a wide variety of ARM Cortex platforms from a number of vendors, many of them quite inexpensive and no small number accepting Arduino-sized shields.

@ChrisStratton so add another answer?

Just FYI, mbed has had offline support for many years. You can export your code to a variety of offline toolchains. Recently, mbed CLI was also released to compile programs offline without an IDE using GCC, ARMCC and IAR.

You can run mbed offline. I do my development in VSCode using the mbed-cli to compile and pyopenOCD for debugging. The instructions on the website didn't seem to work out of the box on Windows. Wasn't too difficult to set-up, though.

Mbed is so cool.The code is written everywhere that can get internet access. You doesn't like online IDE, you can get offline IDE such as Keil, GCC. You can get other kind of interface such as Matlab and LabView. Component and library is express together at main website. We can import lib: directly to workplace. If you have an idea, it is good to implement your idea quickly and best for prototyping.
I also like Arduino but I like mbed than Arduino.

There are a lot of good points here, but you could do a better job of stating them.

Please rephrase your text: Sentences like "The code is written everywhere that can get internet access" and "Component and library is express together  at main website" are totally incomprehensible.


text:
How to get weight data from glass electronic bathroom scale sensors?
I am doing a small project with a bathroom scale but I run into some problems. I am using an Arduino Uno V3, HX711 module amp and a scale.
Scale:

HX711 amplifier:

I disassembled the scale to get to sensor wires and I am a bit confused. These sensors have three wires each. So they are half bridge sensors. The scale is using 4 sensors so when the scale is measuring it is measuring with a full bridge. And these 3 wires are RED, BLACK, BLUE. I don't know what is black (GND or Positive) and blue (same guess). Four red wires are given names E+, E-, S+ and S-. I will provide a picture of the disassembled scale.

Two blue wires are soldered together on each side. I guess red wires are signal (S+, S-, E+ and E-) but what are Blue and Black? Then I soldered the wires to these wires to get sensor readings but I don't know what is what.

The sensor is looking like this:

I tried:

Two different libraries for this project both named HX711 (for this module)
Changing A+ for A- on module

// Hx711.DOUT - pin #A1
// Hx711.SCK - pin #A0

#include "hx711.h"

Hx711 scale(A1, A0);

void setup() {

  Serial.begin(9600);

}

void loop() {

  Serial.print(scale.getGram(), 1);
  Serial.println(" g");

  delay(200);
}

with no success. I get 0.0g on the serial monitor when calm, and the same when load is on.
My questions are:
How to know which wire is GND, +5V and which is signal? How to connect 4 of these sensors to read data? How to use HX711 libraries available and HX711 module? And, most important, how to read data from this scale on serial?

The sensorsare quite posibly configured as in Fig1 in the data sheett If so there should be +5 and 0V across two points and weight signal between two others. Use a DMM to Check for 5V (probably 5V =  E+). So find two leads with Vdd (5V or similar) . Other two probably at Vdd/2 abov ground. Connect meter on LOW V range between other two and see if reading varies with weight change. | Report back. ||  As jwpat7 says  - you may need to repower sensors off HX711 supply to get correct readings. | HX711 looks nice.

What Fig1? I know where is GND and VDD on HX711 module, and where goes the signal wires(A-,A+,B-,B+). That is clear. I dont know which colors of wires from sensors is GND VDD and Signal.
I will do this. I will put back the power on the scale (3v from battery) and I will try to measure wires to determine what is what (i will put some load on the scale). I have a multimer so i will try to determine which wires are signal, and which wires are GND and VDD. I will report back. Tnx Russell.

Sorry - Fig 1 here in HX711 data sheet

Please, I did exactly as it is explained. I am having a strange reading but when I pressed the sensor, the value is decreasing instead of increasing! Can you help please??

Your four half bridge load cell sensors can connect into a full wheatstone bridge as in https://electronics.stackexchange.com/a/199470/30711
If your sensors are like this 50kg load cell from SparkFun's https://www.sparkfun.com/products/10245  or Ebay's http://www.ebay.com/itm/4pcs-Body-Load-Scale-Weighing-Sensor-Resistance-Strain-Half-bridge-Sensors-50kg-/251873576571 they might have a compression and tension gage both on the top surface. The Ebay site has a diagram like:

... which indicates a positive strain gauge on the red-white, and a negative strain on the red-black. (note that the coloring order in this diagram does not match the coloring order in this picture.  I have a similar gauge with blue-red-black colors, and the positive strain gauge is the right pair, negative on the left.) The gauged surface on the center bar between the face-to-face coupled 'E's in the sensor should act like a parallel bar and has portions under compression and under tension, rather than purely under tension.  In cross-section, the gauged bar in the center is sort of the cross-piece in a Z-shaped spring. In this case, the strains oppose each other, and, if manufactured well, the reduction of resistance in the negative strain portion will offset the increase in resistance in the positive strain portion and the total white-black resistance should be constant.  One still needs to set up the bridge so that the voltage dividers move in opposite directions with added load, and 4 devices wired in a white-to-white and black-to-black loop should work as above.
If you wire four of these up carefully by flipping them around so the stress sensitive portions unbalance the bridge constructively, you can use all four sensors without any extra resistors.
Basically, two diagonally-opposite sides of a wheatstone bridge are each formed by the compression elements of two gauges wired in series, while the remaining two sides of the bridge are each formed from two tension elements from two cells.  With load on all the sensors, the compression resistances are reduced, while the tension resistances are increased and it pulls the bridge out of balance.
To get this, wire all four sensors in a big ring with maximum resistance, matching colors and initially ignoring the red center tap wires.  (This is the function of the soldered-together blues and blacks are in your scale.)  Choose two opposite (red) center taps as E+ and E-, and the remaining two (red) center taps as S+,S-.  Put the excitation voltage on the E+/E- from the diagram above and read a force-sensitive voltage difference across S+/S-, and this is what you feed into your HX711 as A+ and A-  (Ignore B+/B- as a second, unused channel.)
Here's a schematic with gauges 1-4 as G1 G2, G3, G4 per the above specs, applying an excitation on the G1 and G3 reds, and reading the signals off the G2 and G4 reds.  The G4 gauge is loaded a bit with some positive strain increasing the G4+ resistance, and some negative strain reducing the G4- resistance.  Ideally, loading G4 with 25kg would produce 0.5mV/V times its 2.5V excitation voltage, producing 1.250mV across Sig+/Sig-, and stretching R8 to be 1001 ohms and compressing R7 to 999 ohms as shown.   (The schematic/simulator thing on electronics.stackexchange.com is pretty cool.)

simulate this circuit – Schematic created using CircuitLab
Instead of the "White" wires in the diagram and like on my gauges, consider it the "blue" wires from your scale's sensors.
With only two of these half-bridge sensors, one should not match the end colors and hook white-to-black (blue-to-black) and black-to white, (black-to-blue) imposing an excitation voltage from between these two junctions, and read the differences across the reds, as increased load pulls one side high and the other side low.  This will look like the plain 4-resistor wheatstone bridges in the common datasheets, rather than the 4-half-bridge/eight-resistor scheme above.

The HX711 provides power to a bridge and amplifies the bridge's differential voltage.  The scale's original circuit board (which drives an LCD readout) also  provides power to a bridge.  You are unlikely to get any useful readings while both circuits are applying power to the bridge.

(You could cut the existing wires and attach connectors to allow changing back and forth between the original board and your Arduino circuit.)

Some scales like the one shown use a 9 V battery to run the electronics.  That voltage, if used, is likely to be incompatible with connecting an Arduino (typically powered by 3.3 V or 5 V) or an HX711 (powered with VDD in the range 2.7 V to 5.5 V) at the same time as the original board.

The scale have 3V litium battery that is powering the system. I cut that wires, look at the picture above. So i am not using any power except from arduino.

The sensor you have in your scale are a simple voltage dividers. Each consist of one resistor and one extensiometer, both connected in series. One wire (E+) is VDD another (E-) is GND and the third is divider output(S). You can not directly use it with HX711 which needs a bridge sensors not just dividers. You can try to set a 1/2vdd on S- and connect the signal from the sensor to S+. In case you get a negative weight, simply swap these connections. Your assumption that your scale uses full bridge, because it has four sensors, is completly wrong. You can read the signals  from the scale sensors using analog inputs in you arduino (without HX711) but you should amplify it before to get reasonable resolution. Good luck!
Greg

Text mainly from my comments with some additions - with image added.
The sensors are quite possibly configured as in Fig1 in the data sheet.
 If so there should be +5 and 0V across two points, and weight signal between two others.
Use a DMM to Check for Vdd (probably 5V if pV battery, ~= 3V with Lithium battery). Find two leads to bridge with ~= Vdd on. Other two probably at Vdd/2 above ground. It is likely there are 4 wire effectively so each of the red wires on one side may be conncted tpo one on the other side - an Ohm-meter will tell you. Connect meter on LOW V range between other two and see if reading varies with weight change. Report back.
As jwpat7 says - you may need to repower sensors off HX711 supply to get correct readings.
HX711 looks nice. Under $1/module in modest volume on Alibaba and under $US/0.50 / IC in hundreds.
What Fig1? I know where is GND and VDD on HX711 module, and where goes the signal wires(A-,A+,B-,B+). That is clear. I dont know which colors of wires from sensors is GND VDD and Signal. I will do this. I will put back the power on the scale (3v from battery) and I will try to measure wires to determine what is what (i will put some load on the scale). I have a multimer so i will try to determine which wires are signal, and which wires are GND and VDD. I will report back. Tnx Russell. –
See fig  of HX711 Data sheet for larger view of this image.


text:
Do gyroscopes purposefully show erroneous data?
I tested an MPU-6050 (GY-521) using an Arduino Nano. I used the I2CDevLib and opened the MPU6050_DMP6.ino with the Arduino IDE. I opened the MPUTeapot.pde Processing-file with Processing. A few changes was necessary to make it work:
MPU6050 mpu;

was changed into:
MPU6050 mpu(0x68);

Additionally I commented out this line:
#define OUTPUT_READABLE_YAWPITCHROLL

and uncommented this line:
#define OUTPUT_TEAPOT

When turning everything on, the arrow (Processing) would turn with 5 degrees/s clockwise around the z-axis (plus a very small amount around the other two axes). After about 20 seconds, it would stop, and turn around the x-axis pretty fast for 3 seconds. Then it would stop. Now, the gyroscope+accelerometer would work perfectly. This happens every time I test it.
This happens only when the gyroscope is perfectly still on the ground. It does not stabilize if I move it around. Only after it is left completely still, it'll stabilize after 23 seconds.
Is this how it should work, or is it a problem with the gyroscope? Could it even be caused by the I2CDevLib? Can anybody else confirm this?

According to the datasheet, that was conveniently linked in your question, there is a temperature sensor in the device. Does your code compensate for temperature, because it does seem to be heating up. What happens when you warm the device with your finger once it is stable?

@jippie I'll check.

@jippie It doesn't do anything even if heated up. There is a lot of code to read through for me who is new to Arduino and don't know much C++. But it claims to use some processor inside the chip to process the raw data from the gyroscope and accelerometer and temperature sensor..

@jippie: How did you see that link before I edited it into the question?

MPU6050 is a chip that has an intenal (closed and unknown) algorith to calculate orientation. Because you ar reading ANGLE, that means you are using that algoritm, and that "time" may be the time needed for the calibration.
what do you have as output on the serial?

It happens every time I close and reopen the serial on the computer. So it would be strange if it is actually it heating up. What do you mean by output on the serial?

every time you open/close the serial you are resetting the arduino (see autoreset feature) so yes, it reinforce the "warm up" theory. Track on the serial the time used by every step!

Do you imply that the Arduino is trying to compensate for the heating up which does not take place because it's already turned on?

no, i think the algoritm used by the chip is doing some reading to calibrate itself. Many chip has internal activable BIAS, for example on Accelerometer activating this bias you add a -+1G, so you can calculate the real value of G, linearity of value, if it is stable, and a lot of thing used to compensate for real world "noise". Fixing "warmup" to "calibration" in the answer, so it will be clear


text:
LED's won't light up when LCD/RNG hits 2 || 3 of a kind
I am a true beginner here. Trying to build a "slot machine" type game and am in the beginning stages. Found a RNG for LCD code and tweaked it a bit to get three digits to display randomly. Worked just fine. But what I'm trying to accomplish is getting a red LED to blink when none of the RN match, blue when 2 RN match, and green when 3 RN match. What is happening now, is that the LCD will no longer generate random numbers when I press my button UNless I hold the button in for a couple of seconds. As soon as the random numbers appear my green led flashes briefly then the red and blue blink opposite of each other (red on 1 sec, off 1 sec, blue on 1 sec, off 1 sec, repeat......green only briefly when random numbers change). So after hours and hours of searching goggle and trying to figure this out on my own I am turning the folks who know what they are doing :)Please tell me what I am doing wrong.... Any help would be greatly appreciated. So why did the RNG stop working with a single press of my button, and where is my code wrong that gets the correct lighting operation? Here is my code so far
#include <WProgram.h>
 #include<Arduino.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

/* pin laayout of the LCD with the arduino:
arduino pin = LCD pins
7=RS
8=E
9=D4
10=D5
11=D6
12=D7
RW=ground
*/

int inpin=2; //switchpin
int reading; // stocks switchpin

int inpin2=4; //switchpin
int reading2; //stocks switchpin

int inpin3=6; //switchpin
int reading3; //stocks switchpin

int ran; //stocks random number for dice roll 1
int ran2; //stocks random number for dice roll 2
int ran3; //stocks random number for dice roll 3

int outpin=LOW;
int LED1=0; // red LED

int outpin2=LOW;
int LED2=1; // Blue LED

int outpin3=LOW;
int LED3=3; // Green LED

void setup()

 {
 lcd.begin(16,2);
   pinMode(LED1,OUTPUT);
   pinMode(LED2,OUTPUT);
   pinMode(LED3,OUTPUT);
 }

  void loop()
  {

    //reading of switch

    reading=digitalRead(inpin);
    reading2=digitalRead(inpin2);
    reading3=digitalRead(inpin3);

    //random numbers generation

    ran3=random(6);
    ran2=random(6);
    ran=random(6);

    {
    if (reading != reading2 != reading3);
      digitalWrite(LED1, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);               // wait for a second
      digitalWrite(LED1, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);               // wait for a second
  }

  {
    if (reading3 == reading2 || reading);
      digitalWrite(LED2, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(500);               // wait for a second
      digitalWrite(LED2, LOW);    // turn the LED off by making the voltage LOW
      delay(500);               // wait for a second
  }

  {
    if (reading==reading2==reading3)
      digitalWrite(LED3, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(250);               // wait for a second
      digitalWrite(LED3, LOW);    // turn the LED off by making the voltage LOW
      delay(250);               // wait for a second
  }

    // Set the screen for the PL1 and PL2 label on the top.

    lcd.setCursor(0,0);
    lcd.print("RL 1");

    lcd.setCursor(6,0);
    lcd.print("RL 2");

    lcd.setCursor(12,0);
    lcd.print("RL 3");

    //display of random number.

    if (reading==HIGH){
        lcd.setCursor(2,1);
        lcd.print(ran);
       delay(250);} // not really clean but used as a debouche founction. That way the µC can read only once the inpin within 250ms. i'll try to improve that.

   if(reading2==HIGH){ //same as the player , only the location of the result on the screen is different
       lcd.setCursor(6,0);
       lcd.print("RL 2");
       lcd.setCursor(8,1);
       lcd.print(ran2);
      delay(250);}

      if(reading3==HIGH){ //same as the player , only the location of the result on the screen is different
       lcd.setCursor(12,0);
       lcd.print("RL 3");
       lcd.setCursor(14,1);
       lcd.print(ran3);
      delay(250);}

And here is the original code I found: http://www.desiquintans.com/articles.php?page=randuino (which also shows how it is wired up).
Tweaked to get the 3 random numbers and not just the two that it was set to:
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

/* pin laayout of the LCD with the arduino:
arduino pin = LCD pins
7=RS
8=E
9=D4
10=D5
11=D6
12=D7
RW=ground
*/

int inpin=2; //switchpin
int reading; // stocks switchpin

int inpin2=4; //switchpin
int reading2; //stocks switchpin

int inpin3=6;
int reading3;

int ran; //stocks randoms for player 1
int ran2; //stocks random for player 2
int ran3;

void setup(){
  lcd.begin(16,2);
}

void loop(){

    //reading of switch

    reading=digitalRead(inpin);
    reading2=digitalRead(inpin2);
    reading3=digitalRead(inpin3);

    //random numbers generation

    ran3=random(6);
    ran2=random(6);
    ran=random(6);

    // Set the screen for the PL1 and PL2 label on the top.

    lcd.setCursor(0,0);
    lcd.print("RL 1");

    lcd.setCursor(6,0);
    lcd.print("RL 2");

    lcd.setCursor(12,0);
    lcd.print("RL 3");

    //display of random number.

    if (reading==HIGH){
      lcd.setCursor(2,1);
      lcd.print(ran);
      delay(250);} // not really clean but used as a debouche founction. That way the µC can read only once the inpin within 250ms. i'll try to improve that.

   if(reading2==HIGH){ //same as the player , only the location of the result on the screen is different
       lcd.setCursor(6,0);
       lcd.print("RL 2");
        lcd.setCursor(8,1);
        lcd.print(ran2);
      delay(250);}

      if(reading3==HIGH){ //same as the player , only the location of the result on the screen is different
       lcd.setCursor(12,0);
       lcd.print("RL 3");
        lcd.setCursor(14,1);
        lcd.print(ran3);
      delay(250);}
}

reading != reading2 != reading3 doesn't work. Use reading != reading2 && reading != reading3. I don't get what the buttons are supposed to do.

Thanks for replying Gerben :) will try that right away.. There is only one button and when it is pressed the random numbers are generated and displayed on the LCD, well at least that's what it did before I tried to add the lights. Thanks again

1 button? But you have 3 digitalReads?

Did you have the button when your code was working with the LCD? Do you have a pull down resistor or any way to handle debouncing the switch?

Yes.. one button and 3 digitalReads. I was under the impression that the digitalReads was the signal to the lcd from the arduino to generate 3 different random numbers when one button was pushed.

Thanks for commenting Doowybbob. Yes, I did have the button with the original code when the LCD was working. Here is a copy of that before I started trying to add all the LED's.

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
/* pin laayout of the LCD with the arduino:
arduino pin = LCD pins
7=RS
8=E
9=D4
10=D5
11=D6
12=D7
RW=ground
*/
int inpin=2; //switchpin
int reading; // stocks switchpin
int inpin2=4; //switchpin
int reading2; //stocks switchpin
int inpin3=6;
int reading3;
int ran; //stocks randoms for player 1
int ran2; //stocks random for player 2
int ran3;
void setup(){
lcd.begin(16,2);
}
void loop()
{

reading=digitalRead(inpin);
reading2=digitalRead(inpin2);
reading3=digitalRead(inpin3);
ran3=random(6);
ran2=random(6);
ran=random(6);
lcd.setCursor(0,0);
lcd.print("RL 1");
lcd.setCursor(6,0);
lcd.print("RL 2");

lcd.setCursor(12,0);
lcd.print("RL 3");

//display of random number.

if (reading==HIGH){
  lcd.setCursor(2,1);
  lcd.print(ran);
  delay(250);}

if(reading2==HIGH){
lcd.setCursor(6,0);
lcd.print("RL 2");
lcd.setCursor(8,1);
lcd.print(ran2);
delay(250);}
  if(reading3==HIGH){
   lcd.setCursor(12,0);
   lcd.print("RL 3");
    lcd.setCursor(14,1);
    lcd.print(ran3);
  delay(250);}
  }

@SWTORguy Maybe edit your question to add the initial working code. It isn't readable in the comments. Also, what exactly are pins 2, 4, and 6 connected to. You do a digitalRead() on them but never set their pinMode()

Good idea Doowybbob. Did as suggested... Pins 2 4 and 6 are connected in series on the breadboard then jumped to the negative side of my button. Also that negative side of the button has a resistor to it and a jumper that goes to a5 on my uno.

http://www.desiquintans.com/articles.php?page=randuino  the code and "diagram"

So after a ton more research I figured out what I was doing wrong. For anyone who reads these answers, I found two web sites to be an enormous help. They are http://playground.arduino.cc/uploads/Main/arduino_notebook_v1-1.pdf  and  http://mikrohw.wz.cz/HakDuino/Arduino_Cookbook.pdf   Good luck to you and have fun with your project. Thank you Gerben & Doowybbob for responding and trying to get me to look in the right direction. Turns out that a lot of my code was correctly heading in the right direction. But in my if statements, I wasn't addressing all the possible states. So now the LEDs light up at the appropriate time and I also added a buzzer. Here is my final code...... Thanks and Cheers, SWTORguy
#define PIEZO 5 // pin 5 is capable of PWM (Pulse width modulation) output to drive tones
#include <WProgram.h>
#include<Arduino.h>
#include <LiquidCrystal.h>
  LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

/* pin laayout of the LCD with the arduino:
arduino pin = LCD pins
7=RS
8=E
9=D4
10=D5
11=D6
12=D7
RW=ground
*/

const int button = A5;  // changes 2 to an integer from a constant
int buttonState;
int prevButtonState;

int inpin=2; //switchpin (rolling of dice1)
int reading; // stocks switchpin

int inpin2=4; //switchpin (rolling of dice2)
int reading2; //stocks switchpin

int inpin3=6; //switchpin (rolling of dice3)
int reading3; //stocks switchpin

int ran; //stocks randoms for dice 1
int ran2; //stocks random for dice 2
int ran3; // stocks random for dice 3

int outpin=LOW;
int LED1=13; //red LED

int outpin2=LOW;
int LED2=1; //blue LED

int outpin3=LOW;
int LED3=3; //green LED

int outpin4=LOW;
int BUZ=5; //piezio Buzzer

int del = 500; //buzzers delay time for inbetween LED flashes

void setup(){
   lcd.begin(16,2);
   pinMode (PIEZO, OUTPUT); //pin mapping
   pinMode(LED1,OUTPUT); //pin mapping
   pinMode(LED2,OUTPUT); //pin mapping
   pinMode(LED3,OUTPUT); //pin mapping
   pinMode (button, INPUT); //pin mapping
   pinMode (reading, INPUT); //pin mapping
   pinMode (reading2, INPUT); //pin mapping
   pinMode (reading3, INPUT); //pin mapping
}

void loop(){
    buttonState = digitalRead (button);
    if (buttonState != prevButtonState && buttonState == HIGH) //pushing the button
    {
    //reading of switch
    reading=digitalRead(inpin);
    reading2=digitalRead(inpin2);
    reading3=digitalRead(inpin3);

    //random numbers generation
    ran3=random(1,7); // #'s 1 through 6
    ran2=random(1,7); // #'s 1 through 6
    ran=random(1,7); // #'s 1 through 6

    // Set the LCD screen for dice 1-3 label on the top.
    lcd.setCursor(0,0);
    lcd.print("die");

    lcd.setCursor(5,0);
    lcd.print("die2");

    lcd.setCursor(11,0);
    lcd.print("die3");

    //display of random number.
    if (reading==HIGH){
        lcd.setCursor(2,1);
        lcd.print(ran);
        delay(250); // not really clean but used as a debounce function.
    }

    if(reading2==HIGH){
       lcd.setCursor(5,0);
       lcd.print("die2");
       lcd.setCursor(8,1);
       lcd.print(ran2);
      delay(250);
    }

    if(reading3==HIGH){
       lcd.setCursor(11,0);
       lcd.print("die3");
       lcd.setCursor(14,1);
       lcd.print(ran3);
       delay(250);
    }

    /*the logic that tells which LED to blink and when to sound the buzzer
      dependent upon which state the random numbers dispayed are in*/
    if (ran == ran2 && ran2 == ran3) // random number state (3 of a kind)
    {
      for (int c=0; c <= 2; c++) // variable defining how many times the green LED will blink and buzzer sound
      {
          digitalWrite(PIEZO, LOW); // buzzer off
          delay(del); // wait for .5 second
          digitalWrite(LED3, HIGH);   // Green - turn the LED on (HIGH is the voltage level)
          delay(100);               // wait for a second
          digitalWrite(LED3, LOW);    // turn the LED off by making the voltage LOW
          delay(100);               // wait for a second
          analogWrite(PIEZO, 128); //Buzzer on
          delay(del); // wait for .5 second
      }
      digitalWrite(PIEZO, LOW); //buzzer off
    }else{
        if(ran == ran2 || ran2 == ran3 || ran == ran3) // random number state (2 of a kind)
        {
            for (int b=0; b <= 2; b++) // variable defining how many times the blue LED will blink and buzzer sound
            {
                digitalWrite(PIEZO, LOW); // buzzer off
                delay(del); // wait for .5 second
                digitalWrite(LED2, HIGH);  //Blue - turn the LED on (HIGH is the voltage level)
                delay(100);   // wait for a second
                digitalWrite(LED2, LOW);  // turn the LED off by making the voltage LOw
                delay(100);   // wait for a second
                analogWrite(PIEZO, 128); //Buzzer on
                delay(del); // wait for .5 second
            }
            digitalWrite(PIEZO, LOW); //buzzer off
        }else{
            for (int a=0; a <= 10; a++) // variable defining how many times the red LED will blink.
            {
                digitalWrite(LED1, HIGH);   // Red - turn the LED on (HIGH is the voltage level)
                delay(100);               // wait for a second
                digitalWrite(LED1, LOW);    // turn the LED off by making the voltage LOW
                delay(100);               // wait for a second
            }
        }
    }

  }
}

On behalf of the Stack exchange community, thank you for posting a follow-up message explaining the solution you found (voted.) That turns a newbie question into an asset that others can learn from. BTW, parts of your answer are missing code tags, making it harder to read. You might want to edit your answer and clean it up.