texts:
I was trying to use nodemcu for a project. No issues when uploading the OTA sample code. Added led blink to test. But when trying to upload the second sketch via OTA getting an error

no response from device.

Tried ping to the Nodemcu IP and no issue there. Have the OTA codes in both sketch.
When trying to upload the 2nd second, the led blink will stop for 2,3 seconds and resumes the normal blinking, gets an error in ide after.
How to check if there is any firewall issue?
IDE settings

Attaching code below
const char* ssid = STASSID;
const char* password = STAPSK;

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

  Serial.println("Booting");
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }

  // Port defaults to 8266
  // ArduinoOTA.setPort(8266);

  // Hostname defaults to esp8266-[ChipID]
  // ArduinoOTA.setHostname("myesp8266");

  // No authentication by default
  // ArduinoOTA.setPassword("admin");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
  // ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");

  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH) {
      type = "sketch";
    } else { // U_FS
      type = "filesystem";
    }

    // NOTE: if updating FS this would be the place to unmount FS using FS.end()
    Serial.println("Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) {
      Serial.println("Auth Failed");
    } else if (error == OTA_BEGIN_ERROR) {
      Serial.println("Begin Failed");
    } else if (error == OTA_CONNECT_ERROR) {
      Serial.println("Connect Failed");
    } else if (error == OTA_RECEIVE_ERROR) {
      Serial.println("Receive Failed");
    } else if (error == OTA_END_ERROR) {
      Serial.println("End Failed");
    }
  });
  ArduinoOTA.begin();
  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  ArduinoOTA.handle();

  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
  delay(100);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(100);

  Serial.println("Looping");
}


texts:
I have a project um Visual Studio with a GET method:
http://localhost:4548/Arduino/request?id=12&user=username&pass=password
When I open it in my browser, it works fine
But I want http GET in my Arduino, using the WebClient exemple:

EDIT
I used solution number 1. of @Matt and it worked:
Get a full licensed copy of IIS.
And this is the code after all:

#include <SPI.h>
#include <Ethernet.h>

//Informacoes de endereco IP, gateway, mascara de rede
byte mac[] = { 0xA4, 0x28, 0x72, 0xCA, 0x55, 0x2F };
byte ip[] = { 192, 168, 1, 200 };
byte gateway[] = { 192, 168, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };
byte server[] = { 192, 168, 1, 100 };

EthernetClient client;

void setup() {

  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /myProject/request?id=12&user=username&pass=password HTTP/1.1");
    client.println("Host: 192.168.1.100");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

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

My Serial displays as connected, but the http GET does not work
Am I missing something?


texts: Timer STM32 #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting

texts:
I have installed the library of TimerInterrupt_Generic for ArduinoSTM32 module via Arduino IDE, so i have tried to test the example of library as you can see below:

and i have gotten this error:

TimerInterruptLEDDemo:45:4: error: #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
   #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
    ^
In file included from /home/so/snap/arduino/current/Arduino/libraries/TimerInterrupt_Generic/examples/STM32/TimerInterruptLEDDemo/TimerInterruptLEDDemo.ino:64:0:
/home/so/snap/arduino/current/Arduino/libraries/TimerInterrupt_Generic/src/TimerInterrupt_Generic.h:86:4: error: #error Unsupported Board! Please check your Tools->Board setting.
   #error Unsupported Board! Please check your Tools->Board setting.
    ^
exit status 1
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.

Also, This question is asked here:
https://github.com/khoih-prog/TimerInterrupt_Generic/issues/2


texts: Fluctuating readings of LM35 temperature sensor (+- 5°C) with Arduino UNO

texts:
I am trying to read a LM35 temperature sensor with Arduino UNO which I got as a gift.
The issue is the fact, that my readings of sensor are, well, suspicious at least - they jump with each reading some 5 °C up or down.

I had used several posts how to wire  the thing to Arduino board and for and program the reading (1, 2, 3) and produced the code posted below. The sensor reading fluctuates really a lot - it jumps by some 3 to 7 °C after  each reading regardless of reading frequency (tested with reading each 0.5 s, 1.0 s or 2.5 s). (Unfortunately I do not own a multi-meter to check actual values.) To mitigate the issue I implemented an averager, but underlying problem stays. Expected values are something like 23 or 24 °C as measured by digital weather station and bimetallic thermometer respectively.

Have you met this before ? Do you have any ideas what might be source of this ? I am beginner to electronics as well as to Arduino, trying to learn and mainly understand it.

The complete code:

#include <WString.h>

//Stores read analog values
int readLM35;
const int sensorAnalogPin = 0;
const float voltsToTemperature = 1.1 / 1023 * 100; // (1.1V supply / 10bit resolution) * (10 mV/°C = 1 V / 100 °C)
//Stores the temperature in °C
float temp;
//Averager
float temps[8];
byte position = 0;
float averageTemp;

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

    //For setting internal analog reference voltage to 1.1V
    analogReference(INTERNAL);
}

void loop() {
    digitalWrite(LED_BUILTIN, HIGH);
    delay(50);
    digitalWrite(LED_BUILTIN, LOW);

    //Measure temperature
    readLM35 = analogRead(sensorAnalogPin);
    temp = readLM35  * voltsToTemperature;

    //Save it
    temps[position] = temp;
    if (position == 7) {
        position = 0;
    } else {
        position++;
    }

    //Get average
    averageTemp = 0;
    for (byte i = 0; i < 8; i++) {
        averageTemp += temps[i] / 8;
    }

    //Write
    Serial.println(String(readLM35) + " => " + String(temp, 1) + " deg. C, avg. " + String(averageTemp, 1));
    delay(2500);
}

Example of output (note the first numbers - actual reading):

211 => 22.7 deg. C, avg. 22.5
186 => 20.0 deg. C, avg. 21.9
234 => 25.2 deg. C, avg. 22.7
173 => 18.6 deg. C, avg. 21.9
237 => 25.5 deg. C, avg. 22.6
185 => 19.9 deg. C, avg. 21.9
231 => 24.8 deg. C, avg. 22.4
193 => 20.8 deg. C, avg. 22.2
223 => 24.0 deg. C, avg. 22.3
206 => 22.2 deg. C, avg. 22.6
197 => 21.2 deg. C, avg. 22.1
225 => 24.2 deg. C, avg. 22.8
183 => 19.7 deg. C, avg. 22.1
240 => 25.8 deg. C, avg. 22.8


texts: How do I measure speed and manipulate the speed based on distance covered?

texts:
I'm doing a project on arduino. I'm using a online simulator to design the circuit. I have a dc motor. How do we measure the rpm,speed at that rpm,distance covered by the motor in a given time. For example,

When motor starts, it starts rotating slowly and gradually increases it's RPM. When it covered a distance of 50 meters, the motor slows down and stops. After 10 seconds, the motor starts again at that 50 meter point and goes to 100 meters point and stops. Like this it stops for every 50m. For this we need to keep track of the distance travelled by motor and control it's speed.

How do I achieve the above working. I have tried alot and verified many tutorials but couldn't understand what to do. Please help me out.
(The online simulator I'm using has a L293D motor driver, IR sensor and a ultrasonic distance sensor in it's component list.)


texts: Error conecting raspberry with my arduino in a serial port

texts:
Hi i am trying to make a comunication between theses device but when i am trying to run in my raspberry i have the follow error:

  Traceback (most recent call last):
    File "serial.py", line 1, in
      import serial
    File "/home/pi/Desktop/serial.py", line 2, in
      ser = serial.Serial('/dev/ttyACM0', 9600)
  AttributeError: 'module' object has no attribute 'Serial'

i have the next code:

import serial

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

while 1:

    if(ser.in_waiting >0):
        line = ser.readline()
        print(line)

If any can help me, i will be thankfull


texts:
I am trying to make a production counter for a machine. I want to display production count of the last minute for each seconds. So, display should update every second and should display real value of last 60 seconds.  I have a system for detect real-time product output and get it to the Arduino using digital input pin.
I wrote below codes and for that.
what I have done is count output and get output per second. Then store it on an array as separated value for each seconds. Every second the array updated and added new value for current second. At last add all count value of last 60 seconds and output as production rate of current minute.
My question is, Is there any easy and efficient way for do this without using few variables ?
    #define countSensor 8  //count sensor input

    uint8_t records[60];
    uint8_t countSensorState = 0;
    uint8_t totalCount = 0;
    uint8_t countOfLastSec = 0;
    uint8_t lastCount = 0;
    uint8_t lastMinCount;
    uint32_t preMills = 0;

    void setup() {
      Serial.begin(9600);
      //init sensor input pin
      pinMode(countSensor, INPUT_PULLUP); //change according to sensor type

      //clear random value of memory locations
      for (int i = 0; i < 60; i++) {
        records[i] = 0;
      }

    }

    void loop() {
      //get count at falling edge
      if (digitalRead(countSensor)^ countSensorState) {
        if (!digitalRead(countSensor)) {
          totalCount++;

        }
        countSensorState = digitalRead(countSensor);
      }
      //get count of last second
      if (millis() - preMills > 1000) {
        preMills = millis();
        countOfLastSec = totalCount - lastCount;
        lastCount = totalCount;
        //record last 60s counts
        //--shift back a second in the array
        for (int i = 0; i < 59; i++) {
          records[i] = records[i + 1];
        }
        //--record current second in array at 59th index
        records[59] = countOfLastSec;
        //get last 60s count
        for (int i = 0; i < 60; i++) {
          lastMinCount += records[i];
        }
        Serial.println(lastMinCount);
      }

    }


texts: Triggering the push button on the analog input of the L293D motorshield

texts:
I'm trying to drive a 12v dc motor using three push buttons, one to turn clockwise, the other counter-clockwise and the other to stop the motor completely.

However the code below is not working, apparently it feels like I'm doing something wrong in the code on the connect buttons on the analog part of the engine shield L293D.

The Arduino is powered by a 9v battery and motor shield **L293D with an external power.

#include <AFMotor.h>

    AF_DCMotor motor(1);

    int val;

    #define btnleft A0
    #define btncenter A1
    #define btnright A2

    void setup()
    {
      pinMode(btnleft, INPUT);
      analogWrite(btnleft, HIGH);
      pinMode(btncenter, INPUT);
      analogWrite(btncenter, HIGH);
      pinMode(btnright, INPUT);
      analogWrite(btnright, HIGH);
    }

    void loop()
    {
     val=digitalRead(btnleft);
       if(val!=1)
        {
        Serial.print("LEFT: ");
        motor.setSpeed(255);
        motor.run(FORWARD);
        delay(3800);
        }

     val=digitalRead(btncenter);
       if(val!=1)
        {
        Serial.print("CENTER");
        motor.setSpeed(255);
        motor.run(BACKWARD);
        delay(3800);
        }

     val=digitalRead(btnright);
       if(val!=1)
        {
        Serial.print("RIGHT");
        motor.run(RELEASE);
        delay(3000);
        }
    }


texts: Arduino clone changing its serial port on slight physical displacement, even during an ongoing serial communication

texts:
I'm using an Arduino clone for serial communication. However, as soon as I even touch the board, it resets, and the serial communication stops. When I view the serial port using the 'Tools' menu of Arduino IDE, I observe that it has changed. Sometimes, opening the serial monitor crashes Arduino IDE. I was using MATLAB as well, and observed that it crashed too whenever I initiated serial communication. The setup was working well for a week, when suddenly I encountered this problem.
Do you think that there is a problem with Arduino clone? Any help would be appreciated.


texts: Multiple shields on one Arduino/Linker base shield

texts: I'm using an Arduino Uno R3 along with an Ethernet shield as well as the linker base shield for interfacing with three linker modules, light, temperature and some LEDs as I believed this would be simpler than using a breadboard and look neater. Are there any problems I'm likely to run into regarding compatibility or power consumption? It's a prototype for a hydroponic garden automation system. As a secondary, are there any c02 sensors under $60 available on the market?


texts:
I have a school project, where I'm going to make a traffic light system on a pls. I want to try it out on an Arduino first, just to get the hang of it.

To make it a little bit more advanced than I have found on the internet, I want to make the lights go in "emergency mode" if the green lights in both directions are on at the same time. It will then go into a yellow blink.

My idea is something like this:

// Yellow blinking if fault in the system or operator activates it
int killState = digitalRead(Kill);
int resState = digitalRead(Res);
if (killState == HIGH /*|| greenlights in both directions */) {
 while (resState == LOW;) { // Yellow blink as long as system is not reset
  BLINK();
 }
}

I guess I need a variable or two that tells what state the lights are in, but I'm stuck. Any good solutions out there?

Another thing is the reset button. I haven't put much effort in it, but I want it to go into the starting point.

The link to the complete script can be found here.


texts: Can't Upload Sketch, Atmel SDM Chip Overheating

texts:
I have a chinese CH340 clone arduino. It was working fine until now. The L light stays always on. The sdm Atmel chip is overheating to the point that I can't even touch it. The card is listed under com ports however I can't upload anything due to:

avrdude: stk500_recv(): programmer is not responding

Should I just throw it away or is there a way to save it?


texts: Running Stepper motors (at least 2) at the same time

texts:
Is there a way to run a Stepper motor with Arduino MEGA 2560 with A4988 driver component.

I am using this https://github.com/laurb9/StepperDriver library and with this code,

Serial.println("Starting motor ALL");
int steps = atoi(third.c_str());
int duration = atoi(fourth.c_str());

BasicStepperDriver stepper1(steps, DIR, STEP, ENBL);
stepper1.enable();
stepper1.setMicrostep(MICROSTEPS);
stepper1.setRPM(MAX_RPM);

BasicStepperDriver stepper2(steps, DIR_2, STEP_2, ENBL_2);
stepper2.enable();
stepper2.setMicrostep(MICROSTEPS);
stepper2.setRPM(MAX_RPM);

int starttime = millis();
int endtime = starttime;
while ((endtime - starttime) <= duration) // mS
{
     stepper1.rotate(90);
     stepper2.rotate(90);
     endtime = millis();
}
stepper1.disable();
stepper2.disable();
Serial.println("DONE");

The problem with this is that each stepper motor in this code waits for each other and not simultaneously like a DC motor. What could be done to make it work simultaneously?


texts: How does one design for the power on transient conditions?

texts:
Following on from the question Reset an Arduino UNO by an command (software) and the excellent answer provided by mpflaga, the comment addressing option (1) suggests that there are design considerations for connecting an output pin to the RESET pin.

  Option 1. or a variant can be a clean enough way to do this as long as
  power on transient conditions are designed for.
  - Russell McMahon

or more ominuously

  From everything I've read, the first option is not recommended. - sachleen

Could someone tell me exactly what those considerations are? Is it that it is not as simple as connecting the two with a jumper cable - is additional circuitry (i.e. an RC timer) required, or is there a software solution?

I find the latter option unlikely as the device is rebooting, so unless the software fix is to ignore hardware interrupts (since a RESET is simply that, and the state of the output pins is unlikely to be known, or stable at reboot) for a few mS after reboot, I presume that a hardware fix is required.


texts: ESP8266 - ESP01S with relay. Toggling the relay with http (GPIO0) and GPIO2 at the same time

texts:
I have an ESP8266 module with a relay like this: https://aliexpress.com/item/4000348370586.html.
I have been able to control the module, I can deactivate and activate the relay by means of an http request, with the following code.
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

#ifndef STASSID
#define STASSID "wifi_name"
#define STAPSK  "wifi_password"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;

ESP8266WebServer server(80);

IPAddress ip(192, 168, 0, 101); //ESP static ip
IPAddress gateway(192, 168, 0, 1);   //IP Address of your WiFi Router (Gateway)
IPAddress subnet(255, 255, 255, 0);  //Subnet mask
IPAddress dns(8, 8, 8, 8);  //DNS
const char* deviceName = "ligth101";

const int relayPin = 0;

void handleOn() {
    digitalWrite(relayPin, LOW);
    setCrossOrigin();
    server.send(200, "text/plain", "Ligth on");
}

void handleOff() {
    digitalWrite(relayPin, HIGH);
    setCrossOrigin();
    server.send(200, "text/plain", "Ligth off");
}

void handlePing() {
    setCrossOrigin();
    server.send(200, "text/plain", "ligth");
}

void configPin(){
    pinMode(relayPin, OUTPUT);
    digitalWrite(relayPin, HIGH);
}

void configWifi(){
    WiFi.setAutoConnect(false);
    WiFi.disconnect();
    WiFi.hostname(deviceName);
    WiFi.config(ip, subnet, gateway, dns);
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    }
}

void setCrossOrigin(){
    server.sendHeader(F("Access-Control-Allow-Origin"), F("*"));
    server.sendHeader(F("Access-Control-Max-Age"), F("600"));
    server.sendHeader(F("Access-Control-Allow-Methods"), F("PUT,POST,GET,OPTIONS"));
    server.sendHeader(F("Access-Control-Allow-Headers"), F("*"));
}

void sendCrossOriginHeader(){
    setCrossOrigin();
    server.send(204);
}

void configServerPaths(){
    server.on(F("/ping"), HTTP_OPTIONS, sendCrossOriginHeader);
    server.on(F("/ping"), HTTP_GET, handlePing);

    server.on(F("/on"), HTTP_OPTIONS, sendCrossOriginHeader);
    server.on(F("/on"), HTTP_GET, handleOn);

    server.on(F("/off"), HTTP_OPTIONS, sendCrossOriginHeader);
    server.on(F("/off"), HTTP_GET, handleOff);

    server.begin();
}

void setup() {
    configPin();
    configWifi();
    configServerPaths();
}

void loop() {
    server.handleClient();
}

Now, I want to use the GPIO2 pin to also turn the relay on and off. The desired behavior is to change the state of the relay regardless of whether it comes from the button or from an http request.
I have tried the following modifications to the code:

const int buttonPin = 2;
int buttonState = 0;

void configPin(){
    ...
    digitalWrite(buttonPin, LOW);
}

void handleButton(){
    buttonState=digitalRead(buttonPin);
    if(buttonState == HIGH) {
        digitalWrite( relayPin, !digitalRead(relayPin) );
        delay(1000);
    }
}

void loop() {
    server.handleClient();
    handleButton();
}

With these modifications to the code, I have tested the following two modifications to the hardware:

Placing a switch between ground and GPIO2. As a result of this, each time I activate the push-button, the relay remains intermittent, going from one state to the other infinitely.
Placing a switch between ground and GPIO2, but adding a resistor between the switch and the GPIO2 pin, but this also does not work.

Is there a way to deactivate / activate the relay using GPIO2 with a push button and via http as well?
Thanks!


texts: How to serially communicate arduino uno to PIC18f4550?

texts:
I am new in PIC programming

my question is, how can i communicate arduino UNO with  PIC18f4550. i am using THIS programmer board for PIC controller and it has a builtin RS232 serial interface.

Can any body tell me how to communicate between them. I want to communicate in such a way that only Rx & Tx pins and the power pins of arduino will be used.


texts: Is it possible to program Arduino UNO with USB/TTL adapter withouth connection Vcc

texts:
For some strange reason my Arduino UNO clone board occasionally cause my Mac to reset, when I connect the usb cable. Possibly a power problem in Arduino or the USB hub.

Is it possible to program Arduino UNO with USB/TTL adaptor withouth conncecting the Vcc and GND pins (RX/TX and DTR only.)


texts: I connected my ArduCam mini to es8266 board and opened serial monitor. Then this message appeared. It started to appear continuously. I used the code in examples "functions of ov2640". What does it mean?  Why that message appears?  Plz help. Thank you.


texts: Coin recognition using Coin Accepter in Arduino Uno

texts:
I'm working on a vending machine project and I'm using CH-926 and an Arduino Uno for that. I've already set the coin accepter for different number of coins and respective output pulses. I'm unable to get the desired output for this. With every coin I insert the output varies even when I put the same coin.

int pulse = 0;

void coin_value() {
  pulse = pulse + 1;
}

void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT);
  Serial.println("Ready to be collected");
}

void loop() {
  if (digitalRead(2) == HIGH) {
    attachInterrupt(0, coin_value, FALLING);

    if (pulse == 3) {
      Serial.println("50");
    }
    if (pulse == 2) {
      Serial.println("20");
    }
    if (pulse == 1) {
      Serial.println("10");
    }
  }

  pulse = 0;
}

For each coin there are different specific pulses which helps to recognize the coin.int pulse=0;.

So when I insert coin 1 then the output should be 10, for coin 2 the output should be 20 and for coin 3 the output should be 50.


texts: Behaviour of tone() not as expected within while loop

texts:
I have a smoke detector with a piezo buzzer. I want to operate the arduino in low power mode so that it will last on a 9V battery. I've attached an interrupt, and when the digital output of the MQ-2 sensor goes high, it switches to a monitor function.

In the while loop, I check to see if the analog sensor has reached the threshold value, and I output to serial to see if I am in the conditional. If I use:

digitalWrite(buzzer, HIGH);

then the piezo sounds, however if I use

tone(buzzer, 1000,200);
delay(200);

it does not. I'm confused as to why this would be the case.

Full code as follows:

#include "LowPower.h"

int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 50;
int smokeD0 = 2;

void setup() {
  pinMode(redLed, OUTPUT);
  digitalWrite(redLed, LOW);
  pinMode(greenLed, OUTPUT);
  digitalWrite(greenLed, HIGH);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
  pinMode(smokeD0, INPUT);

}
void switchToMonitor() {
  Serial.begin(9600);
  int digitalSensor = digitalRead(smokeD0);
  if (digitalRead(smokeD0) == HIGH)
  {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
  }
  else {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
  }
  //This will be updated later to use the analog input
  //Using digital to make debugging easier
  while (digitalSensor == HIGH) {
    int analogSensor = analogRead(smokeA0);
    Serial.print("Pin A0: ");
    Serial.println(analogSensor);
    Serial.print("Pin D0: ");
    Serial.println(digitalSensor);
    // Checks if it has reached the threshold value
    if (analogSensor > sensorThres) {
      digitalWrite(buzzer, HIGH);
      //tone(buzzer, 1000,200);
      Serial.println("here");
      delay(1000);
    }
    else {
//      digitalWrite(redLed, LOW);
//      digitalWrite(greenLed, HIGH);
      noTone(buzzer);
      Serial.println("also here?");
    }
    //delay(100);
    digitalSensor = digitalRead(smokeD0);
  }
  noTone(buzzer);
}

void loop() {
  //delay(100);
  //LowPower.standby();
  attachInterrupt(0, switchToMonitor, CHANGE);
  LowPower.powerDown(SLEEP_FOREVER, ADC_ON, BOD_ON);
  detachInterrupt(0);
}


texts: Receiver xbee receiving data even if the Transmitter is not sending?

texts:
TX code:

#include <SoftwareSerial.h>

const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

SoftwareSerial   Xbee(10, 11);

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

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;
  while( i < length )
  {
    Serial.print(buffer[i]-48);
    Xbee.print(buffer[i]-48);
    i++;
  }
}

RX code:

const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

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

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;

  while( i < length )
  {
    Serial.print(buffer[i]-48);
    i++;
  }
}

NOTE :

1- The Rx xbee is receiving data even if am not sending and even if the TX xbee is powered off

2- When i send data from the TX xbee id didn't get revived by the RX xbee

I need to solve both problems.

*** What i need exactly is to send serial data from my pc to arduino and send it wireless through xbee and then receive to the other arduino connected to my circuit


texts: Turning on controller with button and turning off with a timeout

texts:
I am making a device controlled by an ESP 8266 and am wanting to save power by having it power down when not in use. The desired behavior is for a momentary button press or vibration sensor activation to cause the device to turn on and stay on until it is done being used for a period of time. The ESP 8266 can sense when the device is not in use and can reset a software or hardware timer as necessary to begin the timeout process once the device stops being used. After the timeout is complete, I would like the device to power off with as little current draw as possible.

Some of the options seem to be a circuit like this: https://www.youtube.com/watch?v=L55QrKQQZJk

That would be great but to be honest, if I could find an COTS solution, it would be much better. The best thing I found was this breakout board on Adafruit: https://www.adafruit.com/product/3435. It would take care of the powering on with the button and vibration sensor and be able to power off on command as well. The main issues I would run into is the fact that the device would power on every two hours without needing to and timeout after being on for two hours as well. Even though my software timeout will probably be around 10 minutes, if the device is used for two hours straight, I don't want it to shut off mid-operation. Are there any COTS solutions here better than what I found? Or could I easily modify the TPL5110 to do what I am wanting to do?

Thank you!


texts: SD Library function doesnt work while using second SPI port with ESP32

texts:
i work on a group project with an ESP32. We have a lcd display and a sd card connected via the two SPI ports of the ESP32.

The card gets initialized with no problem using this code:

 bool EKG_recording::initialisation_sd() {

  SPIClass * hspi = new SPIClass(HSPI);

  if (!SD.begin(CS_Pin, *hspi))
  {
    Serial.println("No valid SD card!");
    return 0;
  }

  else if (SD.begin(CS_Pin, *hspi))
  {
    Serial.println("SD card initialized!");
    return 1;
  }
  else return 0;
}

One function i have a problem with is used to count every file on the SD card, simple enough right?

unsigned short EKG_recording::count_files_from_SD(File dir) {
  while (true)
  {
    File entry = dir.openNextFile();
    if (!entry)
    {
      // Serial.println("Anzahl der Daten");
      return counter;
    }
    counter++;
    entry.close();
  }
}

It once worked without a problem, then we integrated the two SPI ports and now i cant figure out why its not working.
This part:
File entry = dir.openNextFile();
returns false on the first call even though i am 100% sure there are 3 files on the SD card.

I call the function like this :

File root = SD.open("/");
EKG_recording_1.count_files_from_SD(root);

But why? Any help is very appreciated.

This is the begin function of the display. Since i didnt write it, i know next to nothing about it.

    void EKG_display_control::begin()
{
  // Backgroundlight off
  pinMode(TFT_LED, OUTPUT);
  disable_display_backlight();

  // Initialise Display
  tft.begin(40000000);
  touch.begin();
  tft.setRotation(ROTATION);

  layout_start_screen();
}


texts: Getting some unknown characters while trying to connect my SIM900A to my PC

texts:
Im trying to connect my SIM900A. While trying to connect I'm getting some junk characters and not able to pass A T Commands

Attached are the screen shot.

Note:- Im getting the blue light blinking.So dont think any issue with SIM900A

Please suggest

Thanks in advance


texts:
I'm trying to use an atmega chip from an arduino on a breadboard, with minimal hardware (using the internal 8mhz clock).  I am using the article in the link provided.  When I reach the final step (burning the bootloader), I get an error telling me the device signature is wrong-

Arduino: 1.8.5 (Windows 10), Board: "ATmega328 on a breadboard (8 MHz internal clock)"

avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

Error while burning bootloader.

I am assuming the error is because the chip is from a uno clone, and uses an atmega328p-pu chip.  How am I able to override this check using -F, as described in the error message?  Or is there maybe some other way i can fix this?  Thanks in advance.

https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard


texts: What does the line "while (! Serial);" do in an Arduino program?

texts:
I'm new to Arduino, and I am trying a couple of tutorials. What does this line do in a program?

while (! Serial);


texts: Atmega328p and cp2102 with error avrdude: stk500_getsync(): not in sync: resp=0x00

texts:
I recently bought a usb/ttl cp2102 converter for testing with a standalone Atmega328p, I made the DTR connection with the pin 1 in the Atmega  using a ceramic capacitor of 0.10uf (104) so that when I send my code to my Atmega standalone it save the code without having to worry about the reset. However, when trying to send it the first time it worked and the other attempts failed, it seems that whenever I restart the computer and turn it on again it sends the code to the Atmega and in the other attempts it fails.
To try to solve I tested with IDE Arduino 1.8.5 and 1.8.9 in Linux Mint and Windows 10 and gave the same problem, I recorded the bootloader again and did not solve.

The error that appears in the output of the IDE is this:

avrdude: stk500_getsync(): not in sync: resp=0x00

From what I read, this error is generic and hardly helps to solve the error.


texts: Powering 24 volt solenoid valve with Arduino uno

texts:
Today I received normally closed solenoid valve which I am going to use in automated pot watering system ,
I realised the valve takes 24 dc volt as input and Arduino has maximum of 5volt , using some power booster I can convert it to some extent but I think 24 volt is too much .

So how should power 24volt solenoid valve from Arduino uno?


texts: USB and UART simultaneous power to Arduino?

texts:
I am connecting an Arduino Mega (Crius) to a Intel Embedded processor (Minnowboard) via the following to Peripherals:

Minnowboard USB            -> Arduino      (to flash the micro-controller)
Minnowbaord Highspeed UART -> Arduino UART (to communicate)

Now both the peripherals are supplying +5V Vcc to the Arduino from the Minnowbaord but via different ports. Both the channels shall always remain connected.

Is it safe to power +5V from different ports to the Arduino (because i am technically bypassing all the voltage regulators available on board) ?

Will this cause any problems for the Arduino in regards to difference in voltage levels?


texts:
I'm having a hard time understanding how the Arduino libraries are defining the address for accessing the registers of the USART modules.

I cant find definition for udr(pointer) as used in the delegated constructor for Hardware Serial. So how does the class gets the underlying address? And what type of declaration is this?

HardwareSerial::HardwareSerial(
  volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
  volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
  volatile uint8_t *ucsrc, volatile uint8_t *udr) :
    _ubrrh(ubrrh), _ubrrl(ubrrl),
    _ucsra(ucsra), _ucsrb(ucsrb), _ucsrc(ucsrc),
    _udr(udr),
    _rx_buffer_head(0), _rx_buffer_tail(0),
    _tx_buffer_head(0), _tx_buffer_tail(0)
{
}


texts: Best practice to declare a 'static' text and save memory

texts:
I'm working on a project where I need to create a JSON to send back state of an object. I created the code to achieve it and all works fine, but I used this to declare the JSON fields:

static const String JSON_FIELD_A;

then in the .cpp file

const String MyClass::JSON_FIELD_A = "field_a";

In this way I can use that in several point inside my class (eg. to create and parse JSON) without needs to write the field name each time which may cause inconsistency after a refactoring.

I'm not sure about this way anyway... is there a more efficient way to achieve that? Using #define may be a solution?


texts: Variable Fan Controller - Properly Sized Transistor

texts:
I would like to a build a temperature sensing variable speed fan controller for my truck. Currently using a purchased 2 speed on/off relay based controller, but my fans are overloading the whole circuit when the controller is powered on during a high speed temperature scenario. On low speed, I have the fans wired in series to spin both slower - works great. Each fan initially draws 100 amps at full 12v. On the low speed (6v/series), they cruise about 20a together. On high speed, they settle in around 25a each.
I am somewhat experienced with arduino and using a few references to build in specific features I want, but here is the main example I am going by.
https://circuitdigest.com/microcontroller-projects/automatic-temperature-controlled-fan-project
My question is around the type and size of transistor that I would need to handle the amount of current these fans draw. Some examples have MOSFET while others have FET or even standard PNP. I am pretty new to working with transistors and can't find any references that make sense. Would love to get a reference to learn this calculation and appropriate type.
Edit: removed picture with incorrect wiring diagram.


texts:
I am working on a small circuit now where I increment the rotation of a servo motor and at the same time blink a LED.

I have used all methods I know to do it but still it does not work or it blinks and then the servo start working but never both at the same time.
This is what i am basically working with:

  for(position=0;position<=90;position=position+5){
    digitalWrite(led_pin,HIGH);
    delay(200);
    digitalWrite(led_pin,LOW);
    delay(200);
    servoBar.write(position);
    delay(15);
  }

But it blinks once and then it stops and the servo start working right after that.

I know I must not use delays in interrupts. I am using a function that I can but just to show you what I am working with.


texts:
I am having a little trouble with a program of mine. My circuit consists of (mainly) an arduino UNO, two RGB LEDs, and a photoresistor. My current code(programmed in c#) operates the hardware as so: When the lights in the room are on, the two LEDs alternate blue/off once per second in a loop. When the lights are off, or the photoresistor is not sensing any light, both LEDs turn on, and stay on, red.
My code:

int prPin = A0;

void setup()
{
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(prPin,INPUT);
  Serial.begin(9600);
}

void loop()
{
  int prVal = analogRead(prPin);
  Serial.write(prVal);
    if(prVal>450)
    {
      digitalWrite(5,HIGH);
      digitalWrite(6,HIGH);
      digitalWrite(7,HIGH);
      digitalWrite(8,LOW);
      digitalWrite(9,HIGH);
      digitalWrite(10,HIGH);
      delay(1000);
      digitalWrite(5,LOW);
      digitalWrite(6,HIGH);
      digitalWrite(7,HIGH);
      digitalWrite(8,HIGH);
      digitalWrite(9,HIGH);
      digitalWrite(10,HIGH);
      delay(1000);
    }
    else
    {
      digitalWrite(5,HIGH);
      digitalWrite(6,HIGH);
      digitalWrite(7,LOW);
      digitalWrite(8,HIGH);
      digitalWrite(9,HIGH);
      digitalWrite(10,LOW);
      delay(10);
    }
}

The problem I am having is when the lights turn off, the LEDs will not operate according to the "else" statement/loop until it finishes going through the "if" statement/loop.
Any suggestions or answers are appreciated. I'm an open book, so I'll take anything you guys give me.


texts:
Background: When working on the 2 modules separately they were working perfectly.

Problem: In the code attached we tried integrating them but Lora wouldn't receive any data unless we commented out parts of the SDC function. Is there a fix to this?

This is where the problem occurs:

Serial.print("Data received: ");
 Serial.print(received);

 if(received=="ANEMO"){

No matter how much we feed it with TRUE data from another Lora with these codes it simply shows blank and false.

Please Help this poor lamb. This for our school project. Hopefully, you can spare me some of your time. Thank you so much in advance.

for the CS pins:
Lora: pin 10,  SD: pin 5

other SPI pins follow the standard pins.

PS: In the code, we have commented out some of the lines within the SDC function as based on our observation:

myFile = SD.open("HG.txt", FILE_WRITE);
   myFile.close();

These 2 lines are the ones causing our Lora to not display the data it is receiving in the (String receive variable).

Thank you, good sir/ma'am, once again hopefully you can assist me.

Here is the complete code:

#include <SPI.h>
#include <SD.h>
#include <RH_RF95.h>
#define RFM95_CS 10
#define RFM95_RST 9
#define RFM95_INT 2
#define RF95_FREQ 868.0
RH_RF95 rf95(RFM95_CS, RFM95_INT);
unsigned long millisecs;
int cnt;
float valu;
String jh;
int code=1;
String received;

File myFile;

void setup(){
 Serial.begin(115200);
 if (!SD.begin(5)) {
    Serial.println("Card failed, or not present");
    while (1);
  }
  else{
  Serial.println("card initialized.");
  }

  delay(100);

 pinMode(RFM95_RST, OUTPUT);
 digitalWrite(RFM95_RST, HIGH);
 while (!Serial);
 Serial.println("Arduino LoRa RX Test!");
 digitalWrite(RFM95_RST, LOW);
 delay(10);
 digitalWrite(RFM95_RST, HIGH);
 delay(10);
 while (!rf95.init()) {
 Serial.println("LoRa radio init failed");
 while (1);
 }
 Serial.println("LoRa radio init OK!");
 if (!rf95.setFrequency(RF95_FREQ)) {
 Serial.println("setFrequency failed");
 while (1);
 }
 Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);
 rf95.setTxPower(23, false);
}

void lorA(){
  while(code==1){
if (rf95.waitAvailableTimeout(1000)){
 Serial.println("dayun ");
 uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
 uint8_t len = sizeof(buf);
 if (rf95.recv(buf, &len)){
 cnt++;
 Serial.print("Data number: ");
 Serial.println(cnt);
 received=(char*)buf;
 Serial.print("Data received: ");
 Serial.print(received);

 if(received=="ANEMO"){
 uint8_t data[] = "And hello back to you";
 rf95.send(data, sizeof(data));
 rf95.waitPacketSent();
 Serial.println("Sent a reply");
 code=0;
 }
 }
 else{
 Serial.println("Receive failed");
 }
 }
 }
 }

void SDC(){
  while(code==0){
  Serial.println("SDC");
//  File dataFile = SD.open("HG.txt", FILE_WRITE);
//  String dataString="Hans";
//  if (dataFile) {
//  dataFile.println(dataString);
//  dataFile.close();
//    Serial.println("closed");
//    Serial.println(dataString);
    code=1;
//  }
//  else {
//    Serial.println("error opening datalog.txt");
//  }

  }
  }

void loop(){
  Serial.println("loop");
  lorA();
  Serial.println("mid");
  SDC();
}


texts: Problems in calculating and printing long unsigned integers

texts:
I have this code which provides an erroneous unsigned long number.
CODE:
char buff[100];

int unsigned long bytes;

bytes = 48 * 70 * 144;

sprintf(buff,"%lu bytes\n", bytes);

BTPort.print(buff);

OUTPUT:
20088 bytes
BUT: The correct value is 483840


texts:
I am using an infrared sensor and a flex sensor to read values from the serial monitor in arduino, however after maybe ten seconds or so it seems the serial monitor breaks and the printed values start to print out rapidly. Does anyone have any suggestions on why this might occurring. Any information would be highly appreciated.

Thanks.

int previousMillis = 0;

long interval1 = 300;
long interval2 = 350;

void setup() {

    Serial.begin(9600);
}

void loop() {

    unsigned long currentMillis = millis();

    if ( currentMillis - previousMillis >= interval1 ) {
        previousMillis = currentMillis;

        Serial.println( "TIMER IS DONE!" );

        int val1 = analogRead(0);
        Serial.print("Sensor Value 1 is ");
        Serial.println(val1);
        delay(5);
    }
    if ( currentMillis - previousMillis >= interval2 ) {
        previousMillis = currentMillis;

        int val2 = analogRead(1);

        Serial.print("Sensor Value 2 is ");
        Serial.println(val2);
    }
    delay(10);
}


texts:
I’m working on a robot with a club at my school. So far, our team has an H-bridge shield (https://www.freetronics.com.au/products/hbridge-dual-channel-h-bridge-motor-driver-shield#.WwI9omh_WEc) to drive motors in a toy tank. The H-bridge is powered by 6 AA batteries and the arduino is powered through the H-bridge shield with these batteries also.
 When everything is connected up and  code uploaded to make the motors run forward, nothing happens - the motors don’t run. So far to debug, I’ve used a multimeter to check the voltages being output to the H-bridge from the arduino controller. These are all as expected. I’ve touched the motors to the positive and negative terminals of the battery and they run as expected. Lastly, I’ve substituted the H-bridge shield for a known working one. This did not fix the problem. I disconnected the motors and tested the voltage being output, which measured as +6V for both terminals of the motor relative to the negative terminal of the battery as well as relative to the ground pin. I also disconnected the jumper powering the arduino from the H-bridge shield and instead powered the arduino from my laptop. This did not fix the problem either. This seems completely contradictory. Any ideas on what the problem could be? Thanks so much ❤❤


texts: Need help in the problem with analog input readings and RTC DS3231

texts:
I have 3 analog input(0-1024). I want two outputs based on levels of analog inputs. Eg. inputs have 2 levels. for A0 at 300,digital output pin3 turns ON; and A0 at 500, digital output pin 4 turns ON. Similar for all analog inputs have two levels. Digital output pin 3 turns ON for 1st level and for 2nd level, pin 4 should turn ON. Both should not turn ON at same time. Also, pin 3, should turn ON for specific time in a day for 1 hour.

Problem Facing: (1) I tried this program but outputs doesnt switch according to levels of analog inputs. Once Pin 3 turns ON, it doesnt let pin4 to turn ON. Also, after removing analog inputs, LED remains ON as it is  (2) RTC doesnt turn ON on correct time.

#include<DS3231.h>
#include<Wire.h>
DS3231 rtc(SDA,SCL);
Time t;
const int OnHour=15;  // specified time to turn pin3 ON
const int OnMin=26;
const int OffHour=15;
const int OffMin=28;
int CO2=0;
int Temp=0;
int Humidity=0;

void setup() {

Serial.begin(115200);
rtc.begin();
for(int i=2;i<6;i++){
  pinMode(i, OUTPUT);
}
 }

void loop() {
  t=rtc.getTime();
  delay(1000);
  CO2=analogRead(A0);   //analog input 1
  Temp=analogRead(A1);   //analog input 2
  Humidity=analogRead(A2); //analog input 3

  if((CO2>500)&&(CO2<700)) //500 is low level and 700 is high level
  {
    digitalWrite(2,HIGH);  //indicator LED for low level
    digitalWrite(4,HIGH);  //actual output for low level
    digitalWrite(3,LOW);   //indicator LED for high level
    digitalWrite(5,LOW);   //actual output for high level

  }
  else if(CO2>700) //700 is high level
  {
    digitalWrite(3,HIGH);
    digitalWrite(5,HIGH);
    digitalWrite(2,LOW);
    digitalWrite(4,LOW);

  }

  if((Temp>450)&&(Temp<600))
  {
    digitalWrite(4,HIGH);
    digitalWrite(2,HIGH);
    digitalWrite(3,LOW);
    digitalWrite(5,LOW);

  }
  else if(Temp>600)
  {
    digitalWrite(3,HIGH);
    digitalWrite(5,HIGH);
    digitalWrite(2,LOW);
    digitalWrite(4,LOW);

  }

  if((Humidity>300)&&(Humidity<850))
  {
    digitalWrite(4,HIGH);
    digitalWrite(2,HIGH);
    digitalWrite(3,LOW);
    digitalWrite(5,LOW);

  }
  else if(Humidity>850)
  {
    digitalWrite(5,HIGH);
    digitalWrite(3,HIGH);
    digitalWrite(2,LOW);
    digitalWrite(4,LOW);

  }

  if (t.hour==OnHour && t.min==OnMin)
  {
    digitalWrite(2,HIGH);
    digitalWrite(4,HIGH);
    digitalWrite(3,LOW);
   digitalWrite(5,LOW);

  }
  else if(t.hour==OffHour && t.min==OffMin)
  {
    digitalWrite(2,LOW);
    digitalWrite(4,LOW);
    digitalWrite(3,LOW);
    digitalWrite(5,LOW);

 }
}


texts: Can't get deep sleep to work on Wemos D1 ESP8266

texts:
I have a Wemos D1 (ver. 2015-08) and I am trying to get it to sleep. I've managed to get it generally up and running/got wifi to work etc, but the deep sleep function is beyond me.

I tried connecting RX<-D0 pin to RESET, also tried with a 10k resistor. Neither worked. I then tried D2 (listed as gpi016 on the back of the board) to RESET, this also didn't work. Any ideas? It seems like this would be an incredible chip if I could get it to sleep. The example sketch below uploads fine and contacts the serial monitor, up until the point it sleeps.

 /* Deep Sleep - Blink
 *
 * Blinks the onboard LED, sleeps for 10 seconds and repeats
 *
 * Connections:
 * D0 -- RST
 *
 * If you cant reprogram as the ESP is sleeping, disconnect D0 - RST and try again
 */

// sleep for this many seconds
const int sleepSeconds = 5;

void setup() {
  Serial.begin(9600);
  Serial.println("\n\nWake up");
  pinMode(BUILTIN_LED, OUTPUT);
  // Connect D0 to RST to wake up
  pinMode(D0, WAKEUP_PULLUP);
  // LED: LOW = on, HIGH = off
  Serial.println("Start blinking");
  for (int i = 0; i < 20; i++) {
    digitalWrite(BUILTIN_LED, LOW);
    delay(100);
    digitalWrite(BUILTIN_LED, HIGH);
    delay(100);
  }
  Serial.println("Stop blinking");
  Serial.printf("Sleep for %d seconds\n\n", sleepSeconds);
  // convert to microseconds
  ESP.deepSleep(sleepSeconds * 1000000);
  Serial.println("sleep finished");
}

void loop() {
}


texts: Creating global webserver without port forwarding

texts:
I'm setting up a "Smart House" project with Arduino+Esp01F(Serial Communication).
But I want to make it global server. For it I use WiFiEsp library. But for it I must Get any port (neither 80 nor 443), then make port forwarding on router. But there are no port forwarding in my router. I think how can I do it?
Code:

#include "WiFiEsp.h"

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif
 String response = "";
char ssid[] = "Nazim";            // your network SSID (name)
char pass[] = "eminmamedov1";         // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status
int reqCount = 0;                // number of requests received

WiFiEspServer server(5000);

 WiFiEspClient client;

void setup() {
Serial.begin(115200);
  // initialize serial for ESP module
  Serial1.begin(9600);
  // initialize ESP module
  WiFi.init(&Serial1);

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }

  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  Serial.println("You're connected to the network");
Serial.println(WiFi.localIP());

WiFi.config(IPAddress(192,168,0,165));
  // start the web server on port 80
  server.begin();

}

void loop() {
   WiFiEspClient client = server.available();
   if(client){
    String res = "";
     Serial.println("New client");
      while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        res+=c;

        if (c == '\n') {
          Serial.println("Sending response");
           client.print(
            "HTTP/1.1 200 OK\r\n"
            "Content-Type: text/html\r\n"
            "Connection: close\r\n"  // the connection will be closed after completion of the response
               "\r\n");
               if(res.indexOf("on?") >=0){
               int s = res.indexOf("on?")+7;
               int f = s+2;
               String ss = res.substring(s,f);
                  int i = ss.toInt();
                 if(i != 6 && i != 7&& (i>=2)&&(i<=13)){

                  pinMode(i,OUTPUT);
                  digitalWrite(i,HIGH);
                  bool s = digitalRead(i);
                  String state = s ? "OFF\r\n" : "ON\r\n";
                  client.println(state);
                 }else{
                  client.println("ERROR\r\n");
                 }
               }else if(res.indexOf("off?") >=0){
                 int s = res.indexOf("off?")+8;
               int f = s+2;
               String ss = res.substring(s,f);
                  int i = ss.toInt();
                 if(i != 6 && i != 7&& (i>=2)&&(i<=13)){

                  pinMode(i,OUTPUT);
                  digitalWrite(i,LOW);
                  bool s = digitalRead(i);
                  String state = s ? "OFF\r\n" : "ON\r\n";
                  client.println(state);
                 }else{
                  client.println("ERROR\r\n");
                 }
               }else if(res.indexOf("state?") >=0){
                 int s = res.indexOf("state?")+9;
               int f = s+2;
               String ss = res.substring(s,f);
                  int i = ss.toInt();
                 if(i != 6 && i != 7&& (i>=2)&&(i<=13)){

                  bool s = digitalRead(i);
                  String state = s ? "OFF\r\n" : "ON\r\n";
                  client.println(state);
               }
               }

                   client.stop();

      }
      }

   }

}


texts: Can I use an RF Receiver to any pin on an Arduino?

texts:
I have a project that uses a nodemcu and it includes an rf receiver, I created the pcb board already etc etc... so I've already chosen D7 (GPI013) before reading on connecting the rf receiver and found that a lot of people are saying to connect it to the interrupt pin and for the case of an Arduino it was pin 2 and for the nodemcu it's D3 (GPIO0).

UPDATE: the pin in question is the data pin for the rf receiver, this would be connected to D7 (GPIO13) because of the trace on the board. it is purely used for receiving the data it picks up and giving it to the nodemcu to handle.

Can I just use a different pin which in my example is D7 (GPIO13) or does it HAVE to be an interrupt pin?

Side note: I'm aware of the advantage of using an interrupt pin where that it takes priority over code running.


texts: Problem in defining a variable as multiplication

texts:
I have a simplest code to turn on and off a led. The variable holding time definition is onTime, using Arduino Nano.

When it is written as: onTime=1000*30, all is good.

When onTime is greater than this, if loop does not return true value when needed ( see code below ).

BUT when writing it implicit as onTime=60000, and not onTime=1000*60 code run OK.

I'm guessing that value of 30*1000 - has to be something with int value.

CODE:

int enbPin = 10;
bool onState = true;
unsigned long onPeriod = 60*1000; // <----
unsigned long startTime = millis();
void setup() {
  // put your setup code hee, to run once:
  Serial.begin(9600);
  pinMode(enbPin, OUTPUT);
  digitalWrite(enbPin, onState);
  Serial.println("START");
}

void loop() {
  // put your main code here, to run repeatedly:
  if (millis() - startTime >= onPeriod ) {
    onState = !onState;
    startTime = millis();
    digitalWrite(enbPin, onState);
    Serial.println(onState);
  }
}


texts: Send Strings via SPI both ways using two Arduino UNOs(Master to Slave & Slave to Master)

texts:
I need to create a two way String exchanger via SPI with two Arduino UNOs. Strings and their lengths are independent variables of the main loop and they can change with every iteration. I need both of the Arduinos to communicate with each other regardless of what the strings contain. I want to see basically the same screen with the serial monitor.

It is kind of working. I am not sure how to explain it, I'll just show it below.

Basically the main idea for both of the Arduino's is like this:

Master: hey
Slave: hi

Instead I get this on the master:

Slave:
Slave:
Master: hey
Slave: y
Slave:
Slave:
.
.
.
Slave: i
Slave:
Slave:
.
.

And the slave displays only itself:

Slave: hi

I have created for loops to transfer every char of the string seperatly and respectively but this is still the case. I couldn't find any sample code online for independent string transfering via SPI. I know I probably have many mistakes but how can I fix them to work just as I intend to?

Connections:

Arduino1.pin13 --- Arduino2.pin13

Arduino1.pin12 --- Arduino2.pin12

Arduino1.pin11 --- Arduino2.pin11

Arduino1.pin10 --- Arduino2.pin10

Master Code

//MASTER

#include<SPI.h>

String textSend="", textReceive="";

void setup(){

  Serial.begin(115200);

  SPI.begin();
  SPI.setClockDivider(SPI_CLOCK_DIV8);    //Sets clock for SPI communication at 8 (16/8=2Mhz)
  digitalWrite(SS,LOW);
}

void loop(){

  textSend=""; textReceive="";
  textSend = Serial.readString();
  if(textSend != ""){
    for(int i = 0; i < textSend.length(); i++){
      delayMicroseconds (20);
      SPI.transfer(textSend[i]);
    }

    Serial.print ("Master: ");
    Serial.println (textSend);
  }else{
    int i = 0;
    char c;
    do{
      delayMicroseconds (20);
      c = SPI.transfer(1);
      textReceive += c;
      i++;
    }while(textReceive[i] != 0);

    if(textReceive[i] == 0){
      Serial.print ("Slave: ");
      Serial.println (textReceive);
      textReceive = "";
    }
  }
}

Slave Code

//SLAVE

#include<SPI.h>

String textSend="";
String textReceive="";

void setup (void){
  Serial.begin(115200);
  pinMode(MISO, OUTPUT);
  SPCR |= _BV(SPE);
  SPCR |= _BV(SPIE);
  SPI.attachInterrupt();

}

ISR (SPI_STC_vect){ //Interrupt Service Routine

  byte c = SPDR;

  if(c != 1){ //Slave receives
    for(int i = 0; i < textReceive.length(); i++){
      textReceive += SPDR;
    }
    if(textReceive.length() > 0){
      Serial.print("Master: ");
      Serial.println(textReceive);
      textReceive = "";
    }
  }else{
    for(int i = 0; i < textSend.length(); i++){
      delayMicroseconds(20);
      SPDR = textSend[i];
    }
    if(textSend != ""){
      Serial.print("Slave: ");
      Serial.println(textSend);
      textSend = "";
    }
  }
}

void loop() {
  if(textSend == "")
    textSend = Serial.readString();

}


texts:
I turn on the transmission of one key that works to open the door, but after a certain time I need to close the door, and for this I need to use the second key. I want to do without additional buttons, so it is required to emit key 1 when power is applied, and after 20 seconds, for example, switch and emit key 2. What is the most simple and correct way to do this?
Apply a timer or emit key 1, for example 1000 times, and after overflow 1000, start emitting key 2.
This sketch only constantly sends the first key to the digital pin, without switching to the second.
You need to figure out how you can switch to the second key.
const int KEY_LEN = 54; //Number of characters in the key
const char key1[KEY_LEN] = {"SSSSSS001101001001110001000000000000000000000011001010"}; // Open
const char key2[KEY_LEN] = {"SSSSSS001010111010000000000001000000000000010000000000"}; // Close

int Preamble = 1000; // Preamble duration in microseconds
int zero= 200; // Duration of zero in microseconds
int One= 440; // Duration of a unit in microseconds

const int LED_PIN = 13; // Used digital pin 13 of the arduino to connect the transmitter
void setup()
{
  pinMode(13, OUTPUT);
}

void loop()
{

    for (int n = 0; n < KEY_LEN; n++)
    {
      if (key1[n] == '1') //execute if bit value == 1
      {
        sendSignal(One);
      }

      else if (key1[n] == '0')//execute if bit value == 0
      {
        sendSignal(zero);
      }
      else
      {
        sendSignal(Preamble); // Стартовый импульс
      }

    }
  }

void sendSignal(int duration)
{
  digitalWrite(LED_PIN, HIGH);
  delayMicroseconds(duration);
  digitalWrite(LED_PIN, LOW);
  delayMicroseconds(duration);
}


texts: First of all Thank you for reading my broblem.Before coming this erro I did a project in my Uno board by using a Bluetooth module.after that; when I powered the board to uploade another programe ;4 LEDs (l,tx,Rx,on) were went red without blinking.so now ,at the all time when I powered my Uno board without any connection with any of pins previously mentioned 4 leds were red coloured at all the time.looking for quick response.


texts: I'm new here. Where to look for documentation for my specific board

texts:
sorry if this isn't the done thing. I have a little red space invader shaped board that has an arduino chip on the back from a conference. There is an LCD display and I've just got it to function correctly (there was a power issue.

ATE1 E
0
ATE
1

The above is what the screen is displaying and I can't make heads or tails of it. Any ideas?

I've tagged this with arduino-micro because I think it may be that although I've had relative success using 'SparkFunProMicro' board in arduino IDE

EDIT: I've been able to get some more board info from arduino IDE. VID:1B4F, PID:9204, BN:unknown board, SN:Upload a sketch to get it.


texts:
I've got an electret microphone and I understand that I need quite some amplification to get it to be read by an Arduino (0-5V input). So I seeked the web, but answers are as different as people on the street. Some use Op-Amps, some only a transistor cicruit or the like. This guy is using 2 amps before and after his filters Video, LM386 and this guy claims, that exactly this amp isn't good for the job: recommends NOT using LM386.

I really only want to have a threshold switch, so I need no filters whatsoever and not a super duper amplification. What is the simplest solution, with which I can read a voltage with the arduino? With a transistor alone (seems easiest to me so far) - how can I know how much it amplifies (or as I understand it modifies the "other voltage" to look the same)?

I found many different schematics using various op-amps, but regarding them I don't really need another tutorial, but rather a rule of thumb for a "readable" amplification. Is 100 times enough? I found circuits with 1000 times amplification, so I'm really wondering which one works fine.

However the really simple thing would be this: video at 17sec. At second 17 and 50 or so, they show an extremly basic circuit, which would be exactly what would work best for me... However the question is, if this is enough amplification for the ADC in an arduino.

If I can't get a satisfying answer I think I'll build both and see how they compare/work for me.


texts: How do I print multiple variables in a string?

texts:
Say I have some variables that I want to print out to the terminal, what's the easiest way to print them in a string?

Currently I do something like this:

Serial.print("Var 1:");Serial.println(var1);
Serial.print(" Var 2:");Serial.println(var2);
Serial.print(" Var 3:");Serial.println(var3);

Is there a better way to do this?


texts: Need to set a FAILSAFE in an if else loop

texts:
This works but I would like to have a timed failsafe...

If the FLOAT_PIN goes LOW for more than 3 seconds, it will turn SOLENOID_PIN to LOW.

I can't figure out how to incorporate it into my loop. I tried delay() and started playing with millis() but all I keep finding is LED blinking samples...

I'm not very good with C++ - still learning.

const int FLOAT_PIN = 8; // Pin connected to FLOAT switch
const int SOLENOID_PIN = A0; // SOLENOID pin - active-high

void setup() {
  Serial.begin(9600);
  // Since the other end of the FLOAT switch is connected to ground, we need
  // to pull-up the FLOAT switch pin internally.
  pinMode(FLOAT_PIN, INPUT_PULLUP);
  pinMode(SOLENOID_PIN, OUTPUT);
}

void loop() {
  int floatswitch = digitalRead(FLOAT_PIN); // Read the state of the float switch

  if (floatswitch == HIGH) {
    // If the pin reads high, water is OFF.
    Serial.println("Switch closed");
    digitalWrite(SOLENOID_PIN, HIGH); // Turn the SOLENOID on
  } else {
    digitalWrite(SOLENOID_PIN, LOW); // Turn the SOLENOID off
  }
}


texts:
I am using ATmega8A standalone but analog pins (Port C) have not been use.

Due to ATmega8A does not have a PRR (Power Reduction Register) to disable ADC and TWI.

I would like to know, is it a work around solution to reduce the power consumption if AVcc is not connected?


texts: I bought ATmega328p with bootloader and I can't erase it

texts:
I bought an online deal which had 10x ATmega328p with bootloader installed. I thought I can erase the bootloader once I got the order (I want to write custom task without a bootloader) but my programmer does not seem to find the ATmega328p. I know it is the problem of the microcontroller because I have another ATmega328p which works fine and I can upload code to it. Is there a flag or switch I am missing when trying to overwrite the bootloader on the microcontroller?

Here are the components I am using:

ATmega328p with bootloader
SparkFun Pocket AVR Programmer (usbtiny)

Here are the commands I am using:

To compile: avr-gcc -std=c11 -mmcu=atmega328 -O -o main.o main.c
To generate hex: avr-objcopy -O ihex main.o main.hex
To upload: sudo avrdude -c usbtiny -p m328p -U flash:w:main.hex

Here is the output of the avrdude command:

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

avrdude done.  Thank you.

Anyone encountered similar situation before? How did youu managed to fix it? I appreciate any help :)

Thank you

Edit #1 I tried setting the -B flag to various values but nothing seems to solve the problem.

Edit #2 Here is the circuit I am using while programming the ATmega328p

2x Capacitors 22pf
1x Crystal oscillator 16Mhz
1x Resistor 10K ohm
1x ATmega328p
1x SparkFun Pocket AVR Programmer


texts: I am building an robotic arm by using flex sensor, servo and 2 xbees

texts:
Rx Code:

#include <Servo.h>
Servo myServo;

void setup() {
Serial.begin(9600);
myServo.attach(9);
delay(5000);
myServo.write(0);
}

void loop() {
  while(Serial.available()==0);

    int d = Serial.read() - '0';
    if(d>0)
    {
      int pos = map(d,0,9,0,180);
      pos = constrain(pos,0,180);
      myServo.write(pos);
      Serial.println(d);

      delay(50);
      }
      else
      {};

}

Tx code:

int sensorValue = 0;         // the sensor value
int sensorMin = 1023;        // minimum sensor value
int sensorMax = 0;           // maximum sensor value
int SensorMid = 0;
const int POWER_OF_TWO_TO_AVERAGE = 6;

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

  while (millis() < 10000) {
    digitalWrite(13,HIGH);
    sensorValue = analogRead(A1);
    if (sensorValue > sensorMax) {
      sensorMax = sensorValue;
    }
    if (sensorValue < sensorMin) {
      sensorMin = sensorValue;
    }
  }
  SensorMid = (sensorMin + sensorMax )/2;
  digitalWrite(13,LOW);
  }

void loop() {
int val = map(analogRead(A1),SensorMid,sensorMax,0,9);
Serial.println(val);
delay(100);
}

I am building a robotic arm and I am facing some problems regrading to the servos stability with the flex, I am using the flex as the transmitter and the servo as the receiver, and when I press my finger my servo doesn't move properly.

Any suggestions?


texts:
I am trying to implement cascaded control system, with velocity inner loop and position outer loop.

Separately and without cascaded control, I have implemented position control and velocity control easily, thanks to the "pid library."

I have no idea how to convert position output from position pid to reference velocity.

Any help would be appreciated, since I am blank on this topic.
Thanks and best regards


texts:
I would like to use my FSi6 transmitter but not the receiver that comes with it (I´m trying to save weight), for that I was planning to get one of this NRF24L01 breakout boards. The problem is, how do you interpret the incoming traffic? After some googling, I couldn´t find any information from flysky.

I would think that this is a common thing to do, as you could pair the transmitter with another receiver (perhaps other brand) so there must be a standard protocol.

Any ideas?
Thanks!


texts: why can Arduino variables of int type contain a value such as A2

texts:
How come the following statement is true:
int inputPin = A2;

I thought int variables can only hold integer numbers. Is the A just a representation of a number?
Thanks for any help


texts:
This problem doesn't seen to be very common around the Arduino community.

Basically, what's happening is that as soon as I click the upload button, the Arduino IDE tells me that my Arduino board is not connected. What's strange though is that the python application ino is able to upload my code just fine, so my only guess is that there is something wrong with the IDE itself.

Here's a copy of the error message I am getting at the time of uploading the sketch:

  Binary sketch size: 444 bytes (of a 32,256 byte
  maximum)processing.app.SerialException: Error opening serial port
  '/dev/ttyACM1'.at processing.app.Serial.(Serial.java:178)at
  processing.app.Serial.(Serial.java:77)at
  processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)at
  processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:174)at
  processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)at
  processing.app.Sketch.upload(Sketch.java:1671)at
  processing.app.Sketch.exportApplet(Sketch.java:1627)at
  processing.app.Sketch.exportApplet(Sketch.java:1599)at
  processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)at
  java.lang.Thread.run(Thread.java:744)Caused by:
  gnu.io.UnsupportedCommOperationException: Invalid Parameterat
  gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:213)at
  processing.app.Serial.(Serial.java:163)... 9
  moreprocessing.app.debug.RunnerException: Error opening serial port
  '/dev/ttyACM1'.at
  processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:101)at
  processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:174)at
  processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)at
  processing.app.Sketch.upload(Sketch.java:1671)at
  processing.app.Sketch.exportApplet(Sketch.java:1627)at
  processing.app.Sketch.exportApplet(Sketch.java:1599)at
  processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)at
  java.lang.Thread.run(Thread.java:744)

I am expecting to hear a few questions regarding this issue, so I'll go ahead and answer all the questions I can think of.

  Is this the first time you trying to connect to the Arduino from this computer?

No. In fact, I was able to upload the same source code just fine less than two hours ago.

  Did you try a different USB cord?

Yes, I did.

  Can you upload the source code from a different computer?

Yes, I can.

  Have you tried removing and reinstalling the IDE?

Yes, I have.

  Have you tried a different USB port?

Yes, I have.

What seems to be the problem here?


texts: How to determine what resistor value to use for LED strip

texts:
I'm trying to use an ESP8266 powered by my computer through USB cable to control a WS2812B LED strip. I've read online that you're supposed to put a resistor before the data channel to help prevent noise but I'm struggling to figure out what the resistor value should be.
I've figured out so far that the LED strip will use a MAXIMUM of 25.8W and that the Vin pin that is powering the LED strip is outputting 5V. I also plan on putting a 470uF capacitor across power and ground.


texts: Error in defining Ticker in ESP32 library

texts:
I'm using the exact piece of code in my ESP8266 library (which works OK ), but when used in a ESP32 library- I got an error:

This is the relevant code snip:

void myIOT32::_feedTheDog()
{
  _wdtResetCounter++;
  if (_wdtResetCounter >= _wdtMaxRetries)
  {
    sendReset("Dog goes woof");
  }
}
void myIOT32::_startWDT()
{
  wdt.attach(1, std::bind(&myIOT32::_feedTheDog, this)); // Start WatchDog
}

void myIOT32::sendReset(char *header)
{
  char temp[150];

  sprintf(temp, "[%s] - Reset sent", header);

  if (useSerial)
  {
    Serial.println(temp);
  }
  if (strcmp(header, "null") != 0)
  {
    pub_msg(temp);
  }
  delay(1000);
  ESP.restart();
}

and this is the error:

/home/guy/Documents/git/Arduino/libraries/myIOTesp32/myIOTesp32.cpp: In member function 'void myIOT32::_startWDT()':
/home/guy/Documents/git/Arduino/libraries/myIOTesp32/myIOTesp32.cpp:333:55: error: no matching function for call to 'Ticker::attach(int, std::_Bind_helper<false, void (myIOT32::*)(), myIOT32*>::type)'
   wdt.attach(1, std::bind(&myIOT32::_feedTheDog, this)); // Start WatchDog
                                                       ^


texts: Powering Motor doesnt work from Digital Pin, but works on 5V power

texts:
I am building a little car project, and I have come across an issue that has made me go mental.
I have a single motor (3V-5V), that on direct 3.3V & 5V output works fine. However, when I connect this to a digital port, it for some reason doesn't power. Of course, I first thought it was not supplying correct power, so I got myself a voltage meter and tried that. 3.3V outputs, well 3.3V, all fine. The digital port outputs 4-5V (when it is coded to). So here is my question: Why aren't my motors powering/turning?


texts: Interfacing with TC5564APL-15 paralell static ram

texts:
I've found a Z80 processor and a TC5564APL-15 8K static ram chips, and I want to test the RAM chip, because it's really old and I'm not sure that it's not damaged. I do not have any experience with Z80's and RAM chip's, I'm not even sure that I didn't damage it while desoldering. I found THIS forum link, where a guy wanted to use a different RAM chip, but the code looked OK and I've took it. I did some modifications:

I only own one 74HC595, so I used that, I've connected the remaining address lines to 5V via 200Ohm resistors
I did not use any capacitors.
I've changed some connections.

Here's the modified code:
https://pastebin.com/9nfTQY8X
(Sorry for PB)

So it SHOULD print "0 0 0 8 / 0 0 0 8" to the serial, but it prints "0 0 0 8 / 8 8 8 8". The reason is unknown. Every other number works, I only found that specific bit not working correctly.
I'm not sure. Can my RAM chip be broken, or the circuit causes the problems?


texts: Neo 6m outputting something i as a noob can't understand

texts:
So i connected my ublox neo 6m gps breakout board GY-GPS6MV2 to the arduino software serial and got this result, i used resistors and only supplied 3.3v to the board, gps encode library couldn't give me anything out of this. if possible please help and if this is the wrong forum please suggest a better one. also the board thinks that the date for some reason is Mar 17 2011 16:18:34*59. which is pretty wierd.

$GPTXT,01,01,02,HW UBX-G60xx 00040007 FFF9FFFFp*5D

$GPTXT,01,01,02,ROM CORE 7.03 (45969) Mar 17 2011 16:18:34*59

$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20

$GPTXT,01,01,02,ANTSTATUS=DONTKNOW*33

$GPRMC,,V,,,,,,,,,,N*53

$GPVTG,,,,,,,,,N*3⸮$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$GPTXT,01,01,02,HW UBX-G60xx 00040007 FFF9FFFFp*5D

$GPTXT,01,01,02,ROM CORE 7.03 (45969) Mar 17 2011 16:18:34*59

$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20

$GPTXT,01,01,02,ANTSTATUS=DONTKNOW*33

$GPRMC,,V,,,,,,,,,,N*53

$GPVTG,,,,,,,,,N*3⸮$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$⸮$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$GPTXT,01,01,02,HW UBX-G60xx 00040007 FFF9FFFFp*⸮$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$⸮$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$GPTXT,01,01,02,HW UBX-G60xx 00040007 F⸮$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$GPTXT,01,01,02,HW UBX-G60xx 00040007 FFF9FFFFp*5D

$GPTXT,01,01,02,ROM CORE 7.03 (45969) Mar 17 2011 16:18:34*59

$⸮$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$GPTXT,01,01,02,HW UBX-G60xx 00040007 FFF9FFFFp*5D

$GPTXT,01,01,02,ROM CORE 7.03 (45969) Mar 17 2011 16:18:34*59

$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20

$GPTXT,01,01,02,ANTSTATUS=DONTKNOW*33

$GPRMC,,V,,,,,,,,,,N*53

$GPVTG,,,,,,,,,N*30

$GPGGA,,,,,,0,00,99.99,,,,,,*48

$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30

$GPGSV,1,1,00*79

$GPGLL,,,,,,V,N*64

$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

Here is the full unedited output after 40 mins
https://drive.google.com/file/d/148W_6shE0U2lprimApvtvG1i3Vf2-Izx/view?usp=sharing
edit:- i also connected the tx pin to the rx and vice versa and used a resistor as told by an tutorial on the tx pin from the arduino or the rx pin of the board. it is also sending many gptxt messages which some say on other forums are usally send when some error occurs or the board restarts. idk why it is coming on my board.


texts: CH340 chip getting fried after connecting Arduino to a powerful 12V souce

texts:
I'm using a 120 W DC power supply connected in parallel with ESC and Arduino nano through Vin. However, somehow the Arduino get fried near the CH340 chip, i.e. around the big black square chip near the micro usb port on the back of the board, kept getting fried. It's working for a while, until it melted.

This didn't quite make sense, since Arduino Vin can take voltage from 6V to 12V. The ESC also had a maximum current consumption of over 30A, equivalent to 360W. Thus there wasn't an obvious reason for which Arduino ought to get fried at all.

Why CH340 chip getting fried after connecting Arduino to a powerful 12V source?


texts: Transforming from analog output to speed and acceleration with gy-61

texts:
Maybe it's a simple question but I'm unable to get what I need.

My task is this:
Get the acceleration and speed of each axis of the accelerometer.

I thought of something like:

const int VCCPin = A0;
const int xPin   = A1;
const int yPin   = A2;
const int zPin   = A3;
const int GNDPin = A4;

// variables
int old_x = 0;
int old_y = 0;
int old_z = 0;

int new_x = 0;
int new_y = 0;
int new_z = 0;

void setup() {
  // pin A0 (pin14) is VCC and pin A4 (pin18) in GND to activate the GY-61-module
  pinMode(A0, OUTPUT);
  pinMode(A4, OUTPUT);
  digitalWrite(14, HIGH);
  digitalWrite(18, LOW);

  // activating debugging for arduino UNO
  Serial.begin(9600);
}

void loop() {
  new_x = analogRead(xPin);
  new_y = analogRead(yPin);
  new_z = analogRead(zPin);

  Serial.print("Difference in X=");
  Serial.println(abs(old_x - new_x));

  Serial.print("Difference in Y=");
  Serial.println(abs(old_y - new_y));

  Serial.print("Difference in Z=");
  Serial.println(abs(old_z - new_z));

  old_x = new_x;
  old_y = new_y;
  old_z = new_z;
}

Unfortunately, the analogRead will give me a value between 0 and 1023 and I don't know how to convert this to speed and acceleration.

Any ideas on how to get this convertion?


texts: What is the maximum number of sensors that can be operated on a single Aurdino unit

texts:
I currently have an Aurdiuno uno and a motor driver shield: (http://www.hobbytronics.co.uk/arduino-motor-shield).

Now, I would like to run the following mechatronic devices:
3 bi-direction motors,
1 servo,
1 hall effect sensor (digital),
2 infra-red sensors,
1 magnetometer,
1 ultrasonic sensor,

Will the Aurdiuno uno paired with the motor sheild be able to run these components or will I need to buy an Aurdiuno mini? Could I please gain some insight into how you figure out what pins are required and how would i connect the sensor pins to the motor sheild since it does not have any direction slip on connections like the Aurdiuno Uno. Will I need to solder the sensor connections on?

Thankyou


texts: SIM800C, CPIN: NOT READY (ERROR CODE : +CME ERROR: 10)

texts:
I'm using a SIM800C module, and usually it works fine, but lately it has started giving the error "+CPIN: NOT READY" with ERROR CODE : +CME ERROR: 10(SIM NOT INSERTED). As soon as I get this message, the voltage on SIM_VDD drops to 0V. The problem is intermittent (i.e. it happens only sometimes).

I have read all related posts on here. Here is some info on my setup:
-Schematics is designed according to SIM800C documentation.
-I use 6-pin SIM connector.
-Adding decoupling caps on SIM_VDD, on input power, and on VBAT (for SIM900) does not help.
-Signal strength is fine (about CSQ=20).
-I tried reinserting different SIM cards, nothing helped

The "+CPIN: NOT READY" is sent at different times, however, often quite soon after power on.After removing battery & attaching it again, starts working again. why this issue is occuring..?


texts:
Simple spec question I couldn't figure out, what is, practically speaking and ballpark, the maximum wattage of LED you can drive with an ESP32 (I guess about the same as an arduino?).
Conditions:

using a boost converter for higher voltage: Yes
using ESP32 pin as output and power: Yes
use mosfets/external power circuit: no
no other load is connected to the ESP32 board

My silly calculation:

GPIO allows for 12mA output (source)
cheap and small voltage boost elements go to about 9-12V

i.e. (12 milliamperes) * 12 volts = max 0.144 watts.
Is that about right (orders of magnitude)?


texts: ESP8266 - does it really have terrible wifi range by default?

texts:
ESP8266  - does it really have terrible WiFi range by default??

First time to try this module out and we're disappointed with the range.. as per our testing we can only get max 5m WiFi range line of sight (LOS) to our regular WiFi router (TPlink and other routers we tried)

LOS Distance (Test results based on RSSI):

at 6 meters NO CONNECTION
at 5 meters  -77
at 4 meters -70
at 1 meter -56
at 3 meters -59

We also tried using different WiFi Channel from 1-11
We also tried removing wifi password (no password) and WEP password
We tried also using different modes B G N

NO change ..

Are we doing something wrong here?  Or is this module just that bad?

Any solution not requiring hardware change? (because we already bought a lot)

here's our little module

Interestingly, I saw these guys test the module and it seemed to work well .. Could we have a fake chip?

https://www.youtube.com/watch?v=7BYdZ_24yg0

We have really hit a stumbling block. hope you guys can help


texts: What is the maximum of bits that an Arduino can read on the digital input, which model in the Arduino range can read the most bits?


texts: ArduCam ESP8266 and (Not-Mini) OV2640 Camera Module interface?

texts:
I bought ArduCam ESP8266 and a OV2640 Module. However it is not the mini-version. At the time it didn't seem like it was necessary.

I might have made a big mistake here.

The board has 8 female pins specifically for the camera module. But the OV2640 module has 20 male pins. A mini-version of the same camera leaves 8 pins, and has a nice interface.

I might have to send this back and get that one, but I want to know if it's possible to simply use this one and wire it up with certain pins instead?

Links to the two products to be specific:
http://www.arducam.com/camera-modules/2mp-ov2640/ (Camera)
http://www.arducam.com/arducam-esp8266-uno-board-arduino-camera/ (Board)

Thanks for your help,

Fred


texts: Nano + ESP8266 control pins with REST API

texts: I connected and flashed successfully an ESP8266 module to a Nano. Now I want to control pins values with a REST API, but all the libraries I found are for using standalone ESP8266 modules (without Arduino) or for Arduino with some other modules like CC3000 etc. Can anybody recommend a library please?


texts: How to handle low temperatures using Arduino Uno?

texts:
I want to create a simple electronic temperature sensor using the Arduino Uno.

The environments I want it to handle is inside a fridge and near a heater.

Although I am sure the Arduino can easily handle a heater; my issue is that the Arduino may not be able to handle a fridge.

A fridge also has the added problem of causing water vapor (and we all know water + electronics is never a good idea).

So my question is:

How would I create a temperature sensor using my Arduino Uno, that I can put in my fridge?
Are there any other problems I have not considered and how do I solve them?
Will I need a special type of casing? If so, which type?
Is an Arduino Uno even the best tool for this task?


texts:
I am working thru the Exploring Arduino text mostly with success up until chapter 4. I have most of the parts required but for Figure 4-3 I used the following:

100nF Capacitor, (In place of 1uF Capacitor)

1N4007 Diode Rectifier, (In place of 1N4004 Diode)

S8050 NPN Transistor, (In place of PN2222 NPN)

DC Motor rated for 3V with a Reference Current of 0.35 to .4 Amps (Text lists "DC Motor")

Im aware that the Capacitor was undersized, Diode was a 4 series (so I assumed it was compatible), and the Transistor also the same but of a different manufacturer. Im also aware that the motor is underrated compared to the 9v input, but I didnt think this would cause a problem for a small time period.

My problem is that after about 10 seconds of running (both with the motor free spinning as intended, and sometimes just staying put but making a high pitched noise) the bread board started smoking. So, I disconnected everything and gave up for the day.

What was it that caused the breadboard to start smoking? Do you think I damaged my Arduino?

Link to companion site with diagrams: http://www.exploringarduino.com/content/ch4/


texts: Is Roboteq motor driver compatible with Arduino?

texts:
I'm planning use Roboteq motor driver for 24V brushed DC motor but I can't be sure that it's true or wrong. You know, Roboteq controller is too expensive and I don't want to spend money in vain. Have you any experience this controller? Are they compatible with Arduino?

http://www.roboteq.com/index.php/roboteq-products-and-services/brushed-dc-motor-controllers/mdc2230-detail  Roboteq Controller Link

I also think, Pololu RoboClaw driver. https://www.pololu.com/product/1499 I don't know is it enough for wheelchair. Because, I already have used Pololu VNH5019 and it is not enough. (synchronicity and noise problems etc.)

If you have any ideas, I will be glad. Thank you.


texts: How to make arduino show cpu usage with 10 leds?

texts: So i want to make arduino show my computer cpu usage with leds, for example if 10% then 1 led will light, if 50% then 5 leds, if 80% then 8 leds...


texts: Is Arduino reliable for serious tasks, such as medical machines?

texts:
I'm just getting started with Arduino, and it has a LOT of uses, however, I would like to know how reliable is it? Can it be used for medical purposes (Measure vital signs, or to help surgeons perform surgeries), if it depends on the board, which one is the most accurate and reliable?

I know most robotic tasks will rely on the quality of the servo to interpret the Arduino commands, and sensors, and even the coding/logic, but we can replace/recode all of those things, but when it comes to the main board it gets more complicated


texts: bluetooth module with stk500_recv() error

texts:
I am trying to dow what is demonstrated in this tutorial. I have altered the original setup a little by adding a level converter to not fry the Bluetooth module and resistors for the LEDs, as well as using only 2 instead of four LEDs (which I adjusted for in code later). other than that I am using the exact same setup, code,and procedure. Yet when I try to run my code on the Arduino. I get the error below. I believe it is due to using Tx/Rx and serial at the same time but I really don't know anything about this. Should I add more libraries?
Should I change the wiring shown in the tutorial link? It seems like I need to use Tx/Rx

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xce
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xce
avrdude: stk500_recv(): programmer is not responding

Here is the code I used from tutorial:

//Coded By: Angelo Casimiro (4/27/14)
//Voice Activated Arduino (Bluetooth + Android)
//Feel free to modify it but remember to give credit

String voice;
int
led1 = 2, //Connect LED 1 To Pin #2
led2 = 3, //Connect LED 2 To Pin #3
led3 = 4, //Connect LED 3 To Pin #4
led4 = 5, //Connect LED 4 To Pin #5
led5 = 6; //Connect LED 5 To Pin #6
//--------------------------Call A Function-------------------------------//
void allon(){
     digitalWrite(led1, HIGH);
     digitalWrite(led2, HIGH);
     digitalWrite(led3, HIGH);
     digitalWrite(led4, HIGH);
     digitalWrite(led5, HIGH);
}
void alloff(){
     digitalWrite(led1, LOW);
     digitalWrite(led2, LOW);
     digitalWrite(led3, LOW);
     digitalWrite(led4, LOW);
     digitalWrite(led5, LOW);
}
//-----------------------------------------------------------------------//
void setup() {
  Serial.begin(9600);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
}
//-----------------------------------------------------------------------//
void loop() {
  while (Serial.available()){  //Check if there is an available byte to read
  delay(10); //Delay added to make thing stable
  char c = Serial.read(); //Conduct a serial read
  if (c == '#') {break;} //Exit the loop when the # is detected after the word
  voice += c; //Shorthand for voice = voice + c
  }
  if (voice.length() > 0) {
    Serial.println(voice);
//-----------------------------------------------------------------------//
  //----------Control Multiple Pins/ LEDs----------//
       if(voice == "*all on") {allon();}  //Turn Off All Pins (Call Function)
  else if(voice == "*all off"){alloff();} //Turn On  All Pins (Call Function)

  //----------Turn On One-By-One----------//
  else if(voice == "*TV on") {digitalWrite(led1, HIGH);}
  else if(voice == "*fan on") {digitalWrite(led2, HIGH);}
  else if(voice == "*computer on") {digitalWrite(led3, HIGH);}
  else if(voice == "*bedroom lights on") {digitalWrite(led4, HIGH);}
  else if(voice == "*bathroom lights on") {digitalWrite(led5, HIGH);}
  //----------Turn Off One-By-One----------//
  else if(voice == "*TV off") {digitalWrite(led1, LOW);}
  else if(voice == "*fan off") {digitalWrite(led2, LOW);}
  else if(voice == "*computer off") {digitalWrite(led3, LOW);}
  else if(voice == "*bedroom lights off") {digitalWrite(led4, LOW);}
  else if(voice == "*bathroom lights off") {digitalWrite(led5, LOW);}
//-----------------------------------------------------------------------//
voice="";}} //Reset the variable after initiating


texts:
I have researched this a lot, but haven't found anything on which I can trust.
I want to use a particular ESP board to play audio. To play audio, I2S support is required. But, I know that not every ESP board break out the I2S pins from the chip. According to me, buying an ESP32 only to use the I2S would be a waste of money. So, my question is, if I just want to use I2S, which board is would be suitable? Please provide some references if you can.


texts: Issue in installing Arduino unit library and running with Firmata test application

texts:
I am trying to update the Arduino library via the library manager and I tried to download it from the link given in the firmata_test program:

  WARNING: Category '' in library ArduinoUnit is not valid. Setting to
  'Uncategorized'
  C:\Users\SAURAB~1\AppData\Local\Temp\arduino_c8217a5b56c170d64dfe4c80a1a205dc\firmata_test.ino:
  In member function 'virtual void test_beginPrintsVersion::once()':

  C:\Users\SAURAB~1\AppData\Local\Temp\arduino_c8217a5b56c170d64dfe4c80a1a205dc\firmata_test.ino:32:3:
  warning: narrowing conversion of '249' from 'int' to 'char' inside { }
  [-Wnarrowing]

  };

  ^

  Multiple libraries were found for "Firmata.h"  Used:
  C:\Users\saurabh2836\Documents\Arduino\libraries\Firmata  Not used:
  C:\Program Files (x86)\Arduino\libraries\Firmata

I'm getting this error. I searched but found no conclusive answer. I'm using Windows 8 64bit and Firmata downloaded from http://www.firmata.org/.

Am I doing something wrong?


texts: Does any one know how to use Gas Sensor module in Proteus. I wanna use Gas Sensor but I am unable to find it in Proteus. So, does anyone know any way of adding Gas Sensor Library for Proteus software. Thanks in advance.


texts: Is it possible to combine a HC-05 Bluetooth module and a shrinked arduino ATtiny45/85 to control a motor, LEDs, or other components?

texts:
I'm thinking of making a tiny RC toy project that is controlled through Bluetooth with most components at its tiniest size. I'm a complete beginner in this area so i'm not completely familiar with lots of components so please don't mind me if i sound dumb and uneducated. Anyway...

If it's possible: how many components can i use with the ATtiny45/85? or should i go with the atmega8.

I have a m20 mini motor, a micro servo and a few leds. This doesn't include other components that i havent purchase such as dc driver module and HC-05 Bluetooth module.

If not possible: what other options I can do to create my project.


texts: How do I create a 9 bit number based on values from 9 digital inputs?

texts:
I have 9 pins that are inputs from 9 IR LEDs. I want to combine all their results into one 9 bit number.

example:
pin1 = high,
pin2 = high,
pin3 = high,
pin4 = low,
pin5 = high,
pin6 = low,
pin7 = low,
pin8 = high,
pin9 = low

9 bit number = 111010010


texts: How to actually concatenate two Strings?

texts:
I'm using the SPISlave library, and I have the following code snippet:

String arg;

SPISlave.onData([arg](uint8_t *data, size_t len) {
  data[len] = 0;
  arg += String((char *)data);
  // ...
}

The compiler doesn't like my string concatenation, though:

  /home/lars/sketch_apr01a/sketch_apr01a.ino: In lambda function:
  sketch_apr01a:65:12: error: passing 'const String' as 'this' argument
  of 'String& String::operator+=(const String&)' discards qualifiers
  [-fpermissive]
         arg += String((char *)data);

I've tried other versions as well, with similar results:

arg.concat((char *)data)
arg = arg + String((char *)data)
arg += String((const char *)data)

So how exactly do I write this unusual operation?


texts: Okay, so I'm using an Arduino Uno R3 and I wanted to start of my own home automation project. I have a 4 channel 12V relay board and I normally connect it to a 12V 500mA adapter. What is the maximum wattage bulb (or CFL) that I can power with this configuration?


texts: Arduino serial comm writing data in win32 program

texts:
I am passing in a data buffer from Arduino Uno to a C++ win32 program, but UNO is sending data too slowly.
I am trying to send 128 character bytes but the win32 is receiving the bytes after like 92 places are filled 0, then it goes 1,2,3,4.....
com.read_n_data(data, 128); this line of code is receiving the data slowly from the UNO to the HOST.

// main.cpp : This code is for a console application.
//
// This code writes a character to COM2 and then reads from COM2 a character which is displayed.
// It is to work with a UNO board on the other side of COM2 that echos back whatever the UNO
// board receives from COM2.
//
// The COMport class is based on the code in http://members.ee.net/brey/Serial.pdf
//

#include "stdafx.h"
#include <atlstr.h>
#include <iostream>
#include "COMport.h"

// needed when cin , cout are used
using namespace std;

int _tmain(int argc, _TCHAR* argv[]) // This is the entry point of a Visual C++ Console Application
{
    char data[128], mychar, char_skip;
    COMport com(_T("COM2")); // works only for COM1 to COM9
    // COMport com(_T("\\\\.\\COM11"));  // This "\\\\.\\" part is necessary for COM10 and up

    for(int i=0; i<128; i++){
        cin.get(mychar); // this will read a character from keyboard, including a space character
        //cin >> mychar; // this will read a character from keyboard, but skip a space character
        cin.get(char_skip);  // ignore the "Enter" key
        //char b[100];
        //cin.getline(b, 100); // this will read a whole line from keyboard

        com.write_and_read(mychar); // this is used to see if the other side (UNO) is echoing back the char
        cout << mychar;
    }

    com.write_n_data(data, 128); // write 128 bytes to COM port
    com.read_n_data(data, 128);  // read 128 bytes from COM port
    // Note that Arduino Serial.println("...") appends at the end of the string a "carrige return" character
    // followed by a "new line" character.

The uno is not sending the data fast enough, the buffer in the host have series of '0's at first 92 spots.
Here is the uno code
int const BUFSIZE = 128;
char ibuffer[BUFSIZE] ;
char obuffer[BUFSIZE] ;

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

void loop() {
  if (Serial.available() > 0 ){
    for(int i= 0; i < 128; i++){
    ibuffer[i]=Serial.read();
    }

    Serial.write(ibuffer, BUFSIZE);
  }
}


texts:
I'am new to Arduino and c++

i get his code from the INTERNET

void setup() {
    Serial.begin(57600);
    pinMode(13, OUTPUT);
}
int f = 0, pos;
void loop() {
    boolean has_request = false;
    String in = "";
    if (Serial.available()) {
        in = "";
        while (true) {  // should add time out here
            while (Serial.available() == false) {}
            in += (char)(Serial.read());
            if (in.endsWith("\r\n\r\n")) {
                has_request = true;  break;
            }
        }
    }
    if (has_request) {
        int i1 = in.indexOf("GET /blink?f="), i2;
        if (i1 != -1) {
            i2 = in.indexOf(" ", i1+13);
            f = in.substring(i1+13, i2).toInt();
        }
        Serial.println("HTTP/1.1 200 OK\nContent-Type: text/html\nConnection: close");
        String sr = "<!DOCTYPE HTML>\n";
        sr += "<html>\n";
        sr += "LED frequency: ";
        sr += f;
        sr += "Hz.</html>";
        Serial.print("Content-Length: ");
        Serial.print(sr.length());
        Serial.print("\r\n\r\n");
        Serial.print(sr);
        has_request = false;
    }
    if (f>0) {
        static unsigned long t = millis();
        if (millis() > t + 1000/f) {
            digitalWrite(13, 1-digitalRead(13));
            t = millis();
        }
    }
}

see this link if you cant see the code formated here in the site

this code is used for the Arduino uno wifi shield
it is working perfectly except it is too complicated for me
while loop inside a while loop

and i don't want to do frequency i only need to send turn on or off
without any complexity

anyone could help me ?


texts:
I have a Velleman VMA101 Arduino Mega 2560.

https://www.velleman.eu/products/view/?id=435498

When I connect it to my computer, I can see it on Port COM18 with a yellow triangle, which means something is wrong. On IDE I had COM3 available, so I went to device manager and chaged the port to COM3.

The drivers are installed correctly when I installed the Arduino IDE 1.8.7.

I tried to get the board's info and I got this:

BN: Unknown board
VID: 04E8
PID: 6860
SN: Upload any sketch to obtain it

After that, I tried to upload an empty project to see whether it will work or not. It didn't work and I got this error message:

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Desktop\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
An error occurred while uploading the sketch
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

What's wrong with my board?

How can I solve this problem?

  The board was working perfectly for months