texts: Why Smart Plugs don't require setting port forwarding on router and how to accomplish this with NodeMCU (ESP8266)

texts:
I have a NodeMCU (ESP8266) board that I use to control some devices over the internet. To be able to access it I have to enable port forwarding on my router and set the port manually like in the image below:

But with Smart Plugs (that use a cloud based app) I don't have to set up anything on my router. I am only required to type my Wi-Fi password. So my question is how Smart Plugs are accessed over the router (why they don't need manual port forwarding setting), and how to apply this to my NodeMCU so I don't have to set port forwarding manually.


texts:
I'm currently using an Arduino UNO with a raspberry pi 3b. I'm using the USB connector for both power and comms, i.e. the arduino is powered by the RPI via the USB cable, and also i use the same cable for serial communication between the pi and the UNO.

My question is, could i use the same code, and wiring if i were to change the UNO with a NANO or MICRO?

So for example, on the RPI side of things, could i still simply setup the arduino in my python code as

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

and send commands with something like

arduino.write('2')

and on the arduino side of things, just check if there is serial data coming in and read it, like

if (Serial.available()) {
    command = Serial.read();

I know this may be a very stupid question, but to wrap it up, would anything change other than number of analogues, digitals etc, if i were to switch from an UNO to a MICRO or NANO?


texts:
i am trying to interface pc8563 with arduino uno . I have small doubt related to RTC slave address reading

RTC datasheet says page no 14
where device slave address is A2 for write and Read A3
i would like to know how A2 /A3

Example code from website device id mentioned as 0X51

My question how to config exact slave address ??

#include "Wire.h"
#define PCF8563address 0x51

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
String days[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };

byte bcdToDec(byte value)
{
  return ((value / 16) * 10 + value % 16);
}

byte decToBcd(byte value){
  return (value / 10 * 16 + value % 10);
}

void setPCF8563()
// this sets the time and date to the PCF8563
{
  Wire.beginTransmission(PCF8563address);
  Wire.write(0x02);
  Wire.write(decToBcd(second));
  Wire.write(decToBcd(minute));
  Wire.write(decToBcd(hour));
  Wire.write(decToBcd(dayOfMonth));
  Wire.write(decToBcd(dayOfWeek));
  Wire.write(decToBcd(month));
  Wire.write(decToBcd(year));
  Wire.endTransmission();
}

void readPCF8563()
// this gets the time and date from the PCF8563
{
  Wire.beginTransmission(PCF8563address);
  Wire.write(0x02);
  Wire.endTransmission();
  Wire.requestFrom(PCF8563address, 7);
  second     = bcdToDec(Wire.read() & B01111111); // remove VL error bit
  minute     = bcdToDec(Wire.read() & B01111111); // remove unwanted bits from MSB
  hour       = bcdToDec(Wire.read() & B00111111);
  dayOfMonth = bcdToDec(Wire.read() & B00111111);
  dayOfWeek  = bcdToDec(Wire.read() & B00000111);
  month      = bcdToDec(Wire.read() & B00011111);  // remove century bit, 1999 is over
  year       = bcdToDec(Wire.read());
}

void setup()
{
  Wire.begin();
  Serial.begin(9600);
  // change the following to set your initial time
  second = 0;
  minute = 28;
  hour = 9;
  dayOfWeek = 2;
  dayOfMonth = 13;
  month = 8;
  year = 13;
  // comment out the next line and upload again to set and keep the time from resetting every reset
  setPCF8563();
}

void loop()
{
  readPCF8563();
  Serial.print(days[dayOfWeek]);
  Serial.print(" ");
  Serial.print(dayOfMonth, DEC);
  Serial.print("/");
  Serial.print(month, DEC);
  Serial.print("/20");
  Serial.print(year, DEC);
  Serial.print(" - ");
  Serial.print(hour, DEC);
  Serial.print(":");
  if (minute < 10)
  {
    Serial.print("0");
  }
  Serial.print(minute, DEC);
  Serial.print(":");
  if (second < 10)
  {
    Serial.print("0");
  }
  Serial.println(second, DEC);
  delay(1000);
}

RTC datasheet


texts:
I have a server on my arduino (WiFi) and want to save the clients that connect, so that I can send to them (to each separately) data later.

Is the best data structure a linked list? How can I see if this client connected already (if there is already a connection to this ip) to avoid doubles? How can I detect when they disconnect in order to delete them?

Of course, I read the ref; but I cannot find the answers there.
Here is my minimal example (The maximum number of simultaneous connections is 5):

EDIT Keep in mind, that I just want to have a simple connection using the WiFiClient/ WiFiServer class and not a HTTP-Webserver

#include <WiFi.h>

WiFiServer server(23);
void setup() {
  server.begin();
}

void loop() {
  WiFiClient client = server.available();

  if (client) {
    //if not seen yet, add to a linked list (?)
  }
}


texts: Need to power Arduino Mega 2560 with 3.3V

texts:
I found an LCD for my Arduino Mega 2560 that's parallel (I like that, I don't like SPI), but it works at 3.3V and isn't 5V tolerant. That's why I'd need to use level shifters, but that would use too much space and I'd like to power the microcontroller with 3.3V. But that would cause problems because the USART communication is set to be on 5V and that can't be changed.

Is there a way to power my Arduino at 3.3V? Is there an alternative Arduino for that?

Also, if there is, I'd need to have a 16MHz crystal on it. I know it's overclocking, but Gamebuino works at 16MHz on 3.3V and I would like to do the same.


texts:
I have 2 Arduino UNO R3 nodes communicating using NRF24L01+ transceivers with the TMRh20 library.

Setup I have original as well as cheaper but 'compatible' arduinos. One of the nodes uses an original arduino Uno whereas the other uses the cheaper one.

Observation

The node with the cheaper Uno can transmit data (sucessfully received by the other node) but is unable to receive data.
I have a number of Rf modules and UNo boards. The observation is similar across.
Using the same configuration (rf module, connection and code) , the original uno board receives data but noot the other types.
Another thing that i observed is that the cheaper uno comes with a 12MHz oscillator on the board whereas the original one has a 16 Mhz one.Can it be the source of problem?

This article mentions something that I could not get but am suspicious of it being a possible direction to the solution to the problem, only if someone could help.

  On Arduino UNO boards SPI pins are connected with some digital pins. While using modem you most remember that these digital pins won't be available.


texts:
Im working on a project where I will be using multiple Arduino (pro mini)'s which emit sensordata through LoRa.

The problem I am currently facing is, when I have multiple sensors, how do I know what data is coming from which Arduino (given they all have exactly the same source-code)?

Does the arduino have a UID like some sort of MAC code?
What could be a solution to give the Arduino a UID?
Do you guys have any other solutions for my issue?

In order to answer #2, I could add a random number calculator to create, but this doesn't feel right to me.


texts:
I have a web service that returns timestamps in ISO 8601 format, e.g., "2021-06-25T12:00:00"
I'm trying to turn the timestamp string into a tm type struct from the ESP8266 library <time.h>, to perform time calculations using the difftime() function.
I've been referring to the Redhat time functions https://sourceware.org/newlib/libc.html#time, as it seem to be compatible with the ESP library, though all i can find are functions converting tm structs to timestamp strings. Are there any functions to convert a string timestamp into a tm struct and then back into epoch? Or what would be the best way to approach this kind of conversion on the ESP8266 platform?


texts: Accessing digital pins from the Atmega 16u2 on the Uno

texts:
I'm running a custom firmware on the ATmega16U2 (Switch-Fightstick).
Is it possible to access the digital pins of the UNO from the ATmega16U2?


texts:
I have the following load cells:

I'm using the following HX711 amplifier

Every guide i can find on the internet describes how to connect a load cell with four wires to the amplifier. How can i connect a load cell with three wires to the amplifier?

Thanks in advance.


texts: ESP8266 Supply Voltage dropping below 3.3V

texts:
I am trying to power an ESP8266 with a 3.3V regulator (this one, can supply ~ 1A). I've been struggling for days to get the ESP to work – it will occasionally boot, occasionally connect, but then not work again for hours. What I mean by "not working" is that it will often have trouble communicating over UART; or, upload my code, but not run it; or, run my code and crash on an Exception 0.

Now I have noticed that my voltage rail is dipping severely, sometimes below 3V. If I press my reset button, the level returns to 3.3V, but then when the ESP "boots" (but often not running any code, or crashing), it dips back to 2.9V. It is also fine while programming.

Does this suggest my ESP is simply fried? It's possible I briefly misconnected a wire when I first got the unit.


texts:
I am using the Arbotix-M (Atmega644p). I am trying to program it using an ISP from Pololu. Until yesterday, everything seemed to be working okay and we were able to upload to it without problems. However, recently our board intermittently returns the error.

  "avrdude: stk_500() initialization failed, rc =-1,
    Double check connections and try again or use -F to override this check"

Most of the other people who get this error appear to have damaged the microcontroller in some way, but our board appears to still be functioning because it can still run the code that is already installed on it. At the moment, it basically always fails to upload, so we aren't able to change the code on the board very easily.

I have checked the voltage outputs from the device and they seem to be right. (12.5 from the main line and 5V from the auxiliary one). I don't have an oscilloscope to check the signals with, but it seems to be able to output commands fine. Thanks for reading.


texts: How to start a block of code after a certain time?

texts:
I'm using a ATMega328P-PU on a breadboard as an arduino. How do you start a code after say 20 seconds have elapsed since startup?
Example code:-

if(condition)
{
     //Start sending morse code!
}

My current code uses millis() and fails miserably. The speaker does not get activated. I'm using the standard circuit mentioned at the Arduino website
My current code:-

time = millis();
  if(time>=20000)
      txEnable=true;
      val = analogRead(analogPin);
  if(val!=0)
  {
    standby=false;

  }
  else
  standby=true;
  if(txEnable==true && standby==true)
 {

  if(!callsignSender->continueSending())
    {
        callsignSender->startSending();
    }

 }


texts: How to attach Arduino MKR1000 to a shield meant for Arduino UNO?

texts:
I have an Arduino MKR1000 and need to interface it to an Adafruit Music Maker shield, which has pinouts for an Arduino UNO.

Maybe I'll have to attach female headers, and then jumper pins over.
Which pins on MKR go to which pins on Music Maker?

I have to use the MKR1000 because I'm getting the audio from wifi (using MKR1000) and then sending it to Music Maker.


texts: esp8266-12e Nodemcu 1.0 board not starting uploaded data sketch from Arduino IDE

texts:
I've uploaded a sketch from the Arduino IDE to my (Amica) esp8266-12e board with the sketch data upload tool (ESP8266FS). This goes without any errors or problems. However, the code is never executed, it's like that the code isn't even on the board, it does nothing. I've tried flashing the firmware several times but this does not help. Depending on the installed firmware I get different messages on the serial monitor such as

NodeMCU 0.9.5 build 20150318  powered by Lua 5.1.4
lua: cannot open init.lua

or

Ai-Thinker Technology Co.,Ltd.
invalid

So installing different kinds of firmware is not the problem here. What did I do wrong which causes the board to 'ignore' the uploaded data sketch?


texts: How can I connect antenna to GPS Module ET314AC?(it is not on a breakout board). I have an antenna like this one GPS Active Antenna and Here is the datasheet of ET314ACET314AC Datasheet.I want to connect it manually without any connectors or other things in fact I want to cutoff the connector from antenna.


texts: Atmega 32U4 doesn't show on device manager after fuse bits reset

texts:
I am finally ready to try setting fuse bits on my ATMega32u4-AU custom board (8Mhz Ceramic Resonators, 3.3V), however, after I set the fuse bits and plug my board to computer, the device manager appears nothing (seems there is no device been connected). I am not sure which step I did wrong, so I’d like to post the details, please kindly point out my mistake, thanks a lot!

I used Fuse High Byte: 1001 1001 (0x99) Fuse Low Byte: 0101 1110 (0x5E) Extended Fuse Byte: 1111 0011 (0XF3)
This is the command I entered into avrdude: avrdude –b 19200 –c usbasp –p m32u4 –v –e –U efuse:w:0XF3:m –U hfuse:w:0x99:m –U lfuse:w:0x5E:m
I am able to see the result from command
But after setting the fuse, when I read the fuse in avrdude, I dont know what the reason is but I got different efuse data

After all of these steps, I connected my board to windows 10 computer, the computer shows nothing...

Someone online told me that it could because the clock divider get changed. So, I added a step of setting lock bit to 0x2C through typing “avrdude –b 19200 –c usbasp –p m32u4 –v –e –U lock:w:0X2C:m” But it didn't fix the preblem.

Later, I was thinking maybe I set the low fuse wrong, because the bit0..3 (1110) in lfuse means "Low Power Crystal Oscillator"; So, I set bit0..3 to (1010) and CKDIV8 to 1, which means "Low Frequency Crystal Oscillator" and "unprogrammed divide clock".

All of these didn't fix the problem, please kindly point out which step I did wrong, your help would be greatly appreciated.


texts: Where can I find a hardware manual (or documentation) for Arduino board?

texts:
Where can I find a hardware manual (documentation or a book) for Arduino board?

As far as I know, all hardware details are dispersed (or scatter) in different tutorials.


texts: How to keep warm arduino uno board with 12v dc supply

texts:
I have an arduino uno board with ESP8266 module and i have done all connection using breadboard.

Now when i run arduino uno with USB cable for long time then its not getting hot ! but when i supply power with 12v dc adapter in black barrele then its getting too much hot (i cant touch with my fingure).

Now when i remove the ESP8266 module power and test it again with 12v dc power supply then its not getting hot !

So what is the problem with ESP8266 module ? Is my wiring creates heat ?


texts: Converting a message received in char buffer to integer

texts: I am receiving a message from my mobile to my microcontroller via GSM. The message is in a char buffer, but I want to convert it to an integer as I want to perform some mathematical operations on it. I tried many functions such as atoi, toint but it's not working. Please let me know if there is any way in which I could do this conversion.


texts:
Hi I am using Arduino Nano to gamify my experience on Unity3D. I know that Update() in Unity3D runs every frame per second but I because I'm not an electronics guy I don't know how loop() function runs on Arduino.

Does it depends on number of CPU cycles(or micro processor chip in case of Arduino) or what? Please explain. I facing some lags in my game. I can fix them only if know how is loop() function running on Arduino

There ain't a lot of information about loop() in arduino documentation


texts: Arduino Yun - Sensor Data logging to MYSQL on External Server

texts: I want to log data from Sensors (Say Temperature, moisture or humidity) to a MYSQL database (provided by a online hosting company). Is it possible to establish communication between Arduino Yun and that database and log the data to it


texts: Can I power two 5V with Arduino powered with 9V power adapter?

texts:
I have a setup where I have a 5V IR receiver and 5V relay board and Arduino Uno.

I am currently powering the Arduino from the PC USB and both the IR receiver and the relay board from the Arduino. And it works fine.

Now I want to know how it would work when I power it with a 9 volts wall adapter. Will the voltage be enough for both the IR receiver and the relay board? And will Arduino work fine?


texts: Arduino and ESP8266 communication over wifi

texts: I need to same advice, how to realize communication between ESP and arduino over wifi. I have connected temperature and pressure sensor to ESP, and I need to get this data from sensor to arduino. ESP will be connected to battery, so it should be also low power solution. I thought about something like every 2 minutes read the data and send to arduino, and then deepsleep. However I don’t know, how to realize that communication. I need webserver on arduino and client at ESP? Could someone help me?


texts:
Are there sensors that can detect the color of an LED?

I am working on an Arduino project that needs to detect the color of an LED on an external device. I am trying to identify a light sensor that can be connected to the Arduino's input that can tell me the color of light the LED is currently emitting. The LED is capable of displaying red, green and yellow.


texts:
I'm trying to change values such that the arduino uno outputs comes from what is input, with the code,
int PinOutput = 11;
int PinInput = A0;
int inph;
int inpl;
int input;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(PinInput, INPUT);
pinMode(PinOutput, OUTPUT);
delay(100);
}

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

  {

    input = Serial.read();

  }

 else
{

    input = 255;

}
    inpl = analogRead(PinInput)/4;
    Serial.println(inpl);
    analogWrite(PinOutput,input);
    delay(10);
    inph = analogRead(PinInput)/4;
    Serial.println(inph);
    analogWrite(PinOutput,input/2);
    delay(10);

}

Where pin 11 is connected with an RC circuit to pin A0. Will this code take a value through pin 11 and output it to pin A0? I'm checking if this should work right, so I can then check the python code that goes with it. As of now it mostly stalls, but maybe it's a problem with the python code. I'm trying to make it sustain the number put in. Python code I've tried with is,
import serial
import time

ser = serial.Serial('COM3', baudrate = 9600, timeout = 1)
time.sleep(1)

while 1:

    userInput = input('Get data point? ')

    ser.write(userInput.encode())

    for i in range(5):
        arduinooutput = float(str(ser.readline().decode().split('\r\n')[0].strip('\x00')))
        print(arduinooutput)
        time.sleep(0.01)

The numbers printed out are somewhat random, around 100, it seems, no matter the value put in.


texts:
I am using the attached code.
What I am trying to do is:

Test if there is a personalized "board serial number" written in the EEPROM (by previous code run)
If data found was not 7 characters (e.g SN-XXXX), then generate a serial number and save it to EEPROM

Problem is: it generates a serial correctly, it even stores and reads it a few times, but when I disconnect the USB cable and reconnect to test again, it returns some bad data from the EEPROM, like: ⸮^R⸮y⸮| which seems to pass my 7 characters test and it doesn't generate a new one.

What am I doing wrong ?

#include <EEPROM.h>

// board SERIAL number
char serial_characters[] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};
// will be filled as SN-A2KH
String serial_number;

void setup() {

  Serial.begin(9600);

  // Get the float data from the EEPROM at position 0
  EEPROM.get(0, serial_number);

  // serial from EEPROM valid
  if (serial_number.length() == 7) {
    Serial.println("Found valid serial in EEPROM");
    Serial.println(serial_number);
  }

  // serial from EEPROM not valid (e.g not: SN-XYZ5)
  if (serial_number.length() != 7) {

    Serial.println("Serial from eeprom is NOT 7 chars, generating a random serial");
    Serial.println(serial_number);

    // if analog input pin 0 is not connected, use noise from it in order to generate a random seed, otherwise random is not so random
    randomSeed(analogRead(0));

    // serial might be empty now, set a "SN-" prefix
    serial_number = "SN-";
    for (int i = 1; i <= 4 ; i++) {
      serial_number = serial_number + serial_characters[random(0, 35)];
    }
    Serial.println("Generated serial now: " + serial_number);

    // save to eeprom if format is valid
    if (serial_number.length() == 7) {
      EEPROM.put(0, serial_number);
      Serial.println("Written serial to EEPROM");
    }

  } // <<< serial from eeprom not correct, generated one

}

void loop() {}


texts: Receiving partial messages when using VirtualWire and ServoTimer2

texts:
I'm writing a project where an Arduino board that is connected to a servo engine receives commands from another Arduino. The possible commands are:

Move 10 degrees
Reset position
Sweep until you're told to stop

My problem is with the sweep-mode, when I get the sweep command, I get into a while loop, that first checks for a sweep-terminator and then sweeps.

} else if (message == sweep) {
  Serial.println("sweep");
  while (msg1 != sweep_term) {
    // set the direction for the servo to move
    if (val == 750){
      val = 2250;
    } else {
      val = 750;
    }

    // move the servo
    myservo.write(val);
    // wait for the servo to move
    delay(15);

    // wait for a message
    if (vw_get_message(buf1, &buflen1)) {
      buf1[buflen1] = '\0';
      msg1 = (char*)buf1;
      memset(buf1,'0',VW_MAX_MESSAGE_LEN);
      Serial.print(buflen1);
      Serial.print(" [sweep] Got: ");
      Serial.println(msg1);
    }
  }
}

For some reason, when I'm in this loop I don't get the sweep terminator message, or I get a part of it. I suspect that the servo is responsible for this, since when I run the same program without myservo.write()s I do receive those terminators.


texts:
I am looking to purchase the correct hardware to be able to control 5 DC Motors from an Arduino (UNO preferred, MEGA if necessary).

The Specs of the Motors are as follows: 12 V nominal, 3 → 12 V dc, 794 gcm, 100 rpm, 0.394 W

What would be your recommendations for how to set this up? As I am fairly new to circuitry a circuit diagram would be helpful along with the recommendation of what shield or drivers to use. Thank You


texts: What kind of USB cable do I need for my Arduino NANO 33 BLE W/ HEADERS?

texts:
I have recently purchased an Arduino Nano from the main site, but it did not come with a USB cable for programming it. I have also checked out the Arduino site and there was no reference for what type of cable I needed. I saw that there was a USB 2.0 CABLE TYPE A/B on the site but I'm not sure that it is the one that I require.

Does anyone know which cable I should buy? Thank you in advance!

Edit: To clarify, I checked out the Arduino Store https://store.arduino.cc/usa/


texts: How to use Arduino Nano with Arduino Uno

texts:
I am using an Arduino Uno and have used up all it's pins so I have plugged up a Nano to a couple of the Uno's pins and using the Uno's 5v and ground to power the Nano. Is this ok?

It's been working fine until recently. My Uno will no longer allow me to upload code but everything still powers fine and runs on the existing code I had uploaded before. The reset button on the Uno does not work so I assume it's bricked, but it does still operate fine on the code it has, as I said.

Anyway, my question, is it ok to run the Nano like this? Is it using too much of the Uno's current... because the Nano's pins are also all being used. I'm no good at regulating current and just want to make sure that the Nano isn't eating up a bunch of current from the Uno by lighting it's LED's and it's other operations.


texts: Why doesn't my 1602A LCD display text with this code?

texts:
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>
#include <Servo.h>

#define RST_PIN 9 // Configurable, see typical pin layout above
#define SS_PIN 10 // Configurable, see typical pin layout above

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Servo myservo; // create servo object to control a servo

String read_rfid;
String ok_rfid_1 = "6722323b";
String ok_rfid_2 = "99be859e";
int posClosed = 180; // variable to store the servo position for locked
int posOpen = 0; //same for open...

/*
  Initialize.
*/
void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
  SPI.begin(); // Init SPI bus
  mfrc522.PCD_Init(); // Init MFRC522 card
  lcd.begin(16, 2);
  lcd.clear();
  lcd.print("Scan your card:");
  Serial.println("Scan your card:");
  //Choose which lock below:
  myservo.attach(7); // attaches the servo on pin 7 to the servo object
}

/*
  Helper routine to dump a byte array as hex values to Serial.
*/
void dump_byte_array(byte *buffer, byte bufferSize) {
  read_rfid = "";
  for (byte i = 0; i < bufferSize; i++) {
    read_rfid = read_rfid + String(buffer[i], HEX);
  }
}

void open_lock() {
  //Use this routine when working with Servos.
  lcd.print("Servo Unlocking");
  myservo.write(posOpen);
  Serial.println("Servo Unlocking");
  delay(10000);
  myservo.write(posClosed);
  lcd.clear();
  lcd.print("Servo Locking");
  Serial.println("Servo Locking");
}

void loop() {
  lcd.clear();
  lcd.print("test");
  // Look for new cards
  if (!mfrc522.PICC_IsNewCardPresent())
    return;
  // Select one of the cards
  if (!mfrc522.PICC_ReadCardSerial())
    return;
  dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
  if (read_rfid == ok_rfid_1) {
    open_lock();
    lcd.clear();
    lcd.print(read_rfid + " (FRED FARMER)" + " -Access Granted");
    Serial.println(read_rfid + " (FRED FARMER)" + " -Access Granted");
    delay(10000);
    lcd.clear();
    lcd.print("Scan a card:");
    Serial.println("Scan a card:");
  }
  if (read_rfid == ok_rfid_2) {
    open_lock();
    lcd.clear();
    lcd.print(read_rfid + " (JOHN DOE) " + " -Access Granted");
    Serial.println(read_rfid + " (JOHN DOE) " + " -Access Granted");
    delay(10000);
    lcd.clear();
    lcd.print("Scan a card:");
    Serial.println("Scan a card:");
  } else {
    lcd.clear();
    lcd.print(read_rfid + " -Access Denied");
    Serial.println(read_rfid + " -Access Denied");
    delay(10000);
    lcd.clear();
    lcd.print("Scan your card:");
    Serial.println("Scan your card:");
  }
}

I have tried running the Arduino library's "Hello World" example, and it successfully runs the text onto the screen. Therefore I have determined that it is not a hardware problem, rather a code problem. It occasionally does display "ff" on the LCD, but that's it.


texts: Arduino, RS232 and SIM800L EVB 2.0 (not responding on AT command)

texts:
I buy a SIM800L EVB 2.0 modul for Arduino (https://www.aliexpress.com/item/SIM800L-V2-0-5V-Wireless-GSM-GPRS-MODULE-Quad-Band-W-Antenna-Cable-Cap/32465337183.html).

First I tested modul with all pins connect to Arduino. Modul successfully response on AT commands (but not register on network).

Next day is the same. So I connect modul +5V and GND to external power supply with 1000uF capacitor (as in comments on Aliexpress). Modul successfully connected to the network - my GSM number was accessible) (additional GND pin on modul I connect to Arduino GND on digital GND pin).

But modul is not longer respoding on AT command.

So I tested with USB - serial cable (pin 2 and 3 with GND 5) - modul register on network, but not response on AT command (tested via Putty with different baud speed) - no answer.

What else can I try? How to tested if Rx and Tx on modul works or how to know if I accident burned pins on modul or Arduino or USB-serial cable.

Thanks for every reply.


texts: 4.7v as HIGH on digital output instead of 5v

texts:
I'm new to Arduino, just got my starter kit, and I noticed that digital outputs 3 & 4 have 5v as HIGH level while 5 to 13 have 4.7v as HIGH level.
Is it as it suppose to be?


texts:
I've connected my NodeMCU to GSM module using GND, RX and TX.

I use At Comand Tester. When I try to get sim status or something I get error for example:

  Unable to get Sim status.

Only AT comand returns

  AT

  OK

When I send any AT comand to GSM module I can see that the diode on the module blink.

How can I solve this problem?

Let me know if you need more informations to help me.


texts: Arduino controlled LCD 16x2 is very very dim

texts:
I was testing out whether my 16x2 LCD works. I hooked it up to the arduino.

Some white box appeared which probably meant it works fine, but the box and the blue background looked very dim even when the potentiometer was turned to the maximum, and did not have the bright blue background which I saw on google.

FYI I soldered copper wire on the LCD and shoved them onto the breadboard since I did not have any pin headers. Would this be a cause of the problem?


texts: Can someone explain how to program i2C communications without using the library?

texts: I am starting to get into i2C, SPI, and other forms of communication. I have read about them and have a fuzzy idea of how they work electrically, but can someone explain how I would turn the electronic portion into the coding/controlling portion? I really want to get a great understanding of it.


texts: Serial communication between a single Android device and multiple Arduino boards

texts:
I am thinking about a project, but I will need let's say two Arduino Uno. I can see that we can just use different USB ports on a PC, but what about an Android device?

I want to "run commands" from it on both Uno boards. Is it possible to connect it as it is single board, just both in parallel? I do not need communication between the boards, just with the smartphone.

For example, let's say that one of the boards will control a green LED and the other a red LED. I want to send from my phone on the serial "toggle green" or "toggle red" and both the boards will change the state of the LED connected to it accordingly to the "command" received. Will both boards be able to receive the "command"?

Thank you!

EDIT:
I see that I forgot to add that I may need to receive on the phone from any of the boards. Something like feedback.


texts: detecting presence inside - PIR or ultrasound?

texts:
(I am professionally a software guy working in the GCC compiler with MELT, so I am fluent in software, but much less in hardware - I did use a solder for a 74LS00 nand gate based stuff in the 1990s. This is my first Arduino project)

My first Arduino project would be to automate the lights and the fan in my inhouse WC toilet in Paris (France) suburb. I bought several Arduino Nano v3 boards. I'm thinking of driving with a relay a low voltage 12v LED lightbubble. I want to detect human presence in the toilets. I'm thinking of some PIR sensor, but I am afraid that PIR won't detect anything if the temperature is above 37°C (or about 100F), which is unusual in Paris (France) but may happen a few days per year (I've got no air conditioning). Is my worry correct, or can a PIR still work with very warm outside temperature? Should I use an ultrasound detector instead?


texts:
I am experiencing issues sending serial data via bluetooth with my ESP32. When the device is plugged in, I am able to call bluetooth, and connect to PC and even obtain the serial data via the registered bluetooth COM port after connecting. Though, once I remove the USB power, and power the ESP32 with a battery, I am still able to connect to the PC, but the COM port disappears therefore leaving me unable to choose the port to send data over.
I've tried adding this device to COM port but when I try to add my ESP connected device, I am returned with "parameter is incorrect".

.
.
Usually the COM port is listed here

I know others have posted about this to other forums but none of seemed to solve the problem cut and dry. I also experienced this issue with HC-05 on Arduino Nano
Would appreciate any help I can get with this. I'm sure there is a simple solution that I just haven't come cross yet, as I'm relatively new to all this
Thx in advance


texts: Transfer 10-bit via Arduino-to-Arduino SPI protocol

texts:
The task I need to accomplish is as follows:

I have an analog/digital converter that sends out a 10-bit signal. This signal needs to be transferred to an Arduino Uno using the SPI protocol. Because the SPI protocol works with a 16 bit pattern I need to expand the incoming signal. The slave Arduino then needs to put out the transferred number in decimal.

I imitated the ADC with another Arduino Uno, setting it as master, but unfortunately at the time I only had one Arduino so I couldn't test my code. Furthermore, I don't really have a clue how to "expand" a 10-bit signal to a 16-bit one. Can someone please explain it to me and have a look at my code?

Code for the master Arduino:

#include <SPI.h>
#define SS 10
#define MOSI 11

void setup() {
  pinMode(SS, OUTPUT);
  pinMode(MOSI, OUTPUT);
  SPI.beginTransaction(SPISettings(62500, LSBFIRST, SPI_MODE0));
}

void loop() {
  byte x=0000001101;
  byte y=0011111111;
  digitalWrite(SS,LOW);
  SPI.transfer(x,y);
  digitalWrite(SS,HIGH);
  delay(1000);
}

Code for the slave Arduino:

#include <SPI.h>
#define SS 10
#define MOSI 11

void setup() {
  pinMode(SS, INPUT);
  pinMode(MOSI, INPUT);
}

void loop() {
  byte x=SPDR;
  byte y=SPDR;
  printf(x,DEC);
  printf(y,DEC);
  delay(1000);
}


texts: Connecting OV2640 with 17 Pins Binocular Camera module, to any microcontroller (System clock on module pin 18 -NC)

texts:
These pins are on the module:

3.3V
GND
VSYNC
SCL
SDA
HREF
D0-D7
DCLK
PWDN
I have tried many codes and connections of the OV7670 Monocular cameras, none seem to work(Instructables ,  Circuit Digest , Youtube).
The binocular cameras seem to be just daisy-chained using the I2C SCCB interface. I cant get any image reading on any of their codes provided. Some other guides mention programming the XCLK on board using SCCB PLL, but I'm not sure how to do it as I don't have much background in this domain.

Edit:-
1.Another resource
2.Wiki with datasheet and schematic (the module is a copy of this camera)


texts: How to interpret analog values sent to Arduino from line scanner?

texts:
So I have a line scan camera attached to my Arduino Mega and I'm trying to send it a digital clock impulse and get an analog output back. The line scan camera is supposed to return 128 pixels.

So far I've been able to send the impulses and get analog values back which I am printing out. However, the values are different every time, which doesn't make sense because the camera didn't move so I assume that it should give back similar numbers.

Also, is there a way to determine what these numbers mean? Is there some way of turning analog signals into color pixels? My ultimate goals is to be able to determine if something has moved through the vision of the line scanner

Here is the datasheet for the line scanner: http://www.farnell.com/datasheets/315815.pdf

Here is my code:

void loop() {

  int delayTime = 20;
  digitalWrite(syncPin, HIGH);
  delayMicroseconds(delayTime);
  digitalWrite(clockPin, HIGH);
  delayMicroseconds(delayTime);
  digitalWrite(syncPin, LOW);
  delayMicroseconds(delayTime);
  digitalWrite(clockPin, LOW);
  delayMicroseconds(delayTime);

  for (int i = 0; i < 128; i++)
  {
    digitalWrite(clockPin, HIGH);
    pixelValue[i] = analogRead(dataPin);
    delayMicroseconds(delayTime);
    digitalWrite(clockPin, LOW);
    delayMicroseconds(delayTime);
  }

  digitalWrite(clockPin, HIGH);
  delayMicroseconds(delayTime);
  digitalWrite(clockPin, LOW);
  delayMicroseconds(delayTime);

  for (int j = 0; j < 128; j++)
  {
    Serial.print("I received: ");
    Serial.println(pixelValue[j]);
  }

}


texts:
I just want to configure my laptops keyboard buttons a,s,d,f,g,h and j. I wrote this code and it works for only a but I couldn't configure other buttons.

Code is:

#include "Keyboard.h"

const int buttonPin = 3;          // input pin for pushbutton
int previousButtonState = HIGH;   // for checking the state of a pushButton
int counter = 0;                  // button push counter

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT);
  // initialize control over the keyboard:
  Keyboard.begin();
  Keyboard.press('a');
}

void loop() {
  // read the pushbutton:
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if ((buttonState != previousButtonState)
      // and it's currently pressed:
      && (buttonState == HIGH)) {
    // increment the button counter
    counter++;
    // type out a message
    Keyboard.print("a");
  }
  // save the current button state for comparison next time:
  previousButtonState = buttonState;
}

How can I configure other buttons s,d,f,g,h and j to pin buttons 4,5,6,7,8 and 9.

Thanks for help:)


texts:
I recently purchased several of the DFRobot ledkeypad shields: https://www.dfrobot.com/product-1407.html

I have Arduino Leonardo (which also had some problems in the beginning, being recognized as modems).
My OS is Linux Mint, and I'm using the last Arduino IDE.

The library I use is the one recommended on the website of the vendor, LedKeypad.h, and works fine with the other shields of the same model from the same batch.

Some shields worked fine but I am now having trouble with one of them, which seems unresponsive. I can load for instance the blink program in the arduino, and it works, but the shield does not work. When it is plugged in, the fours dots are slightly red, and I cannot turn them off.

I tried displaying something on the serial monitor when the buttons are pushed, and only one of the 5 buttons works (the KEY_DOWN one).

Is there anything I can attempt to fix the problem ? Or should I just give up on this shield ?


texts: Gyro not zero when returning to original position after random rotations

texts:
I am currently trying to make a self balancing robot. Making good progress but stumbled across an issue.

My gyroscope readings do not return to zero if I return in to its original position after random rotations around all 3 axes. Meaning rotation when all angles are not zero.

I am confident this issue is not caused by accuracy of the numerical integration as I have tried jerking the sensor incredibly hard around 1 axis, yet it still returns to 0 when rotated back.

I managed to get the gyro to return to zero when rotating around 1 axes when 1 angle is not zero. Meaning if Y is 45, and I rotate Z 90 degrees, I can transfer the Y angle to X, and once I return all angles back to zero individually, I can return to the original position. I've done this for all 3 pairs of angles (XY, XZ, YZ) and tried to add all 3 equations but the end result does not zero the gyro.

Anyone know any resources that I can look up on, or any idea of what the solution could be? Any help is appreciated.


texts: Why are the files not being created correctly?

texts: I have been through http://arduino.cc/en/Hacking/LibraryTutorial but I can't do it. Whenever I create a new sketch and try to save it as .cpp or .h from the Save As button in the Arduino IDE, it gets saved as _cpp and _h. I am not able to create a library this way. How do I create a new library? What am I missing here?


texts: How to transmit serial data from laptop USB out to Teensy?

texts:
I want to send serial data from my laptop to a Teensy LC chip through the laptop's USB port. I am not sure how to do this. From reading I have found two possibilities, which both seem to have problems:

Get a USB to serial adapter cable, connect the USB to the laptop, the serial to a MAX232 chip, the MAX232 chip to the UART serial on the Teensy. The ambiguity in this option lies in the fact that the MAX232 chip requires a minimum 4.5V input, and the specs on the Teensy LC say it has 3.3V and one 5V digital output (would this one output be compatible with a MAX232?). Also, it has only 3.3V input, so it sounds like 5V coming from the MAX232 chip would be too much (I guess I could incorporate a chip like https://www.adafruit.com/product/735 ?). Now if I were to go this route with a Teensy 3.1, which says its input pins are 5V tolerant, its voltage output is also only 3.3V (and there is no mention of any 5V output). I guess the answer here would be to incorporate a chip like https://www.adafruit.com/products/1787 ?
The second possibility I looked into would be a USB-to-TTL adapter cable to go straight to the Teensy LC, but I read somewhere that the serial UART with Arduino is different in some way and I wasn't sure if the serial communication coming through the USB-to-TTL cable would be compatible with the Teensy. I was looking at one of these cables at Sparkfun, and I think I would connect the TxD from the cable to the RX on the Teensy, the RxD from the cable to the TX on the Teensy, and the GND cable to a ground on the Teensy.

Could someone point me in the right direction regarding sending serial data through a laptop's USB out to the Teensy?


texts: How do I order the gcc compiler to generate -S flag in Arduino IDE

texts: How can I set the Arduido IDE to generate the -S flag to gcc to see the machine code in Arduino? (the sketches)


texts:
I would like both the motors to spin the attached wheels forward when I push the joystick forward and vice versa. When the joystick is still, the motors should stop spinning. At the moment, when I push the joystick on x-axis and my x variable increases both motors spin, but when I push it in the opposite direction and x decreases, only motor A spins. Additionaly when I connect the arduino to the power (usb cable to my pc), motor B spins for approx 1 second and then stops.
This is the circuit I have (sorry for a lack of schematic, let's hope this wonderful drawing is enough):

The code:
int MotorAA = 7;
int MotorAB = 8;

int MotorBA = 11;
int MotorBB = 12;

int x = 0;

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

  pinMode(MotorAA, OUTPUT);
  pinMode(MotorAB, OUTPUT);

  pinMode(MotorBA, OUTPUT);
  pinMode(MotorBB, OUTPUT);

  digitalWrite(MotorAA, LOW);
  digitalWrite(MotorAB, LOW);

  digitalWrite(MotorBA, LOW);
  digitalWrite(MotorBB, LOW);
}

void loop() {
  x = analogRead(A0);
  Move();
  Serial.println(x);
}

void Move() {
  if (x == 0){
    return;
  }

  if (x > 520)
  {
    digitalWrite(MotorAA, HIGH);
    digitalWrite(MotorAB, LOW);

    digitalWrite(MotorBA, HIGH);
    digitalWrite(MotorBB, LOW);
  }
  else if (x < 480)
  {
    digitalWrite(MotorAA, LOW);
    digitalWrite(MotorAB, HIGH);

    digitalWrite(MotorBA, LOW);
    digitalWrite(MotorBB, HIGH);
  }
  else{
    digitalWrite(MotorAA, LOW);
    digitalWrite(MotorAB, LOW);

    digitalWrite(MotorBA, LOW);
    digitalWrite(MotorBB, LOW);
  }
}


texts:
I have an Arduino BT and I can't connect it to any device I have. I've tried in 3 different situations:

Win7 - If I choose 'Connect without a PIN code', the device seems properly detected but it doesn't appears in Device Manager. In the case of the connection with the PIN code, it throws a timeout error.

Win8 - Don't even ask me for the PIN code. A message 'This isn't working. Try again and verify if the device is still visible' appears.

Android 5.0 - When I try to pair and write the PIN code, I get a message 'Invalid PIN or password'.

The PIN is 12345, by Arduino.cc page.

Another different thing is that in the documentation, the board has the Blink code by default. But the orange light on the board doesn't blink, and don't turn green either. I didn't find anything about the color of the LED in this board.

Can anyone help me?


texts: Help with coding Arduino Nano to run fan through slide switch at specific intervals

texts:
I’m trying to use Arduino Nano to run my 5 V PC fan, which, I know it sounds crazy, it’ll be mounted on a piece of Tupperware that’ll control the airflow through it via the fan. However I have no idea how to code the Arduino, but I do know how to code other things when I’ve done it in class. The setup is a 5 V rechargeable lithium ion portable battery connected to the switch which would be connected to the Arduino, and when the switch is triggered/flipped it would allow power to the Arduino, boot it up, and trigger the code that would tell the fan to run at specific intervals. The idea for intervals is a result of the battery only having 23 hrs and 10 minutes of continuous battery life while powering the fan. The pseudocode would look something like:

  Press bump switch, it turns on the Nano with the ensuing program. Twice an hour, the Nano starts the fan. The fan runs for 20 seconds to 30 seconds each time the fan is started. After a set of 48 on/off cycles have completed (24 hours), the Nano is set to sleep mode in order to save power. In order to restart cycles, user must press bump switch again.

I’m pretty sure I have the hardware side of things down but if I don’t please do inform me.

I’ve attached a picture of what it’ll approximately look like, with the battery at the left, switch in the middle, then the Arduino (not seen in picture), then the fan.

I know this is asking a lot when I don’t even know where to get started with the coding, but I’d be sincerely eternally grateful.


texts: Can we control an Arduino with voice commands?

texts:
I'm looking for some method to control an Arduino with voice commands.

Could this work on this platform?


texts: Connect Arduino + WiFi Shield to Raspberry Pi

texts: I want to send collected data (temperature sensor) from my Arduino via the WiFi shield to my Raspberry Pi. Can I do that with the WiFi library that exists in Arduino IDE ?


texts: I2C LCD Serial Interface Board not displaying text

texts:
The code dont gives error, but not displays "Hello World"

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // initialize the LCD
  lcd.begin();
  // Turn on the blacklight and print a message.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop() {
}


texts: TRIAC Pulse driver for Spot Welder (help needed with programming)

texts:
I have designed and built a transformer driver board for my spot welder. It is powered from mains electricity (230 V) and consists of the following segments: triac drive and protection, zero cross detection, controller input, connections. The board operates correctly when voltage is manually applied. However, I'm not able to make it work with Arduino.

What I want it to do is:

Read the potentiometer(R10), and assign to it value a phase angle, at which triac is going to receive pulse to turn on.
Read Potentiometer (R9), and assigned to it value number of pulses(1-100) for a triac,
Read switch (Power_pulse) that when high start triac firing procedure (angle and duration determined by pots)
I have an I2C display 16x4 that(can be driven directly from SCL and SDA on Leonardo) I might use to display welding parameters(optional goal)
The code I found on "electronoobs.com"

   int detectado = 0;
    int valor=0;
     int last_CH1_state = 0;

   void setup() {

  PCICR |= (1 << PCIE0);    //enable PCMSK0 scan
  PCMSK0 |= (1 << PCINT0);  //Set pin D8 trigger an interrupt on state change. Input from optocoupler
  pinMode(3,OUTPUT);        //Define D3 as output for the DIAC pulse

}

void loop() {
   //Read the value of the pot and map it from 10 to 10.000 us. AC frequency is 50Hz, so period is 20ms. We want to control the power
   //of each half period, so the maximum is 10ms or 10.000us. In my case I've maped it up to 7.200us since 10.000 was too much

   valor = map(analogRead(A0),0,1024,7200,10);
    if (detectado)
    {
      delayMicroseconds(valor); //This delay controls the power
      digitalWrite(3,HIGH);
      delayMicroseconds(100);
      digitalWrite(3,LOW);
      detectado=0;
    }
}

//This is the interruption routine
//----------------------------------------------

ISR(PCINT0_vect){
  /////////////////////////////////////               //Input from optocoupler
  if(PINB & B00000001){                               //We make an AND with the pin state register, We verify if pin 8 is HIGH???
    if(last_CH1_state == 0){                          //If the last state was 0, then we have a state change...
      detectado=1;                                    //We haev detected a state change!
    }
  }
  else if(last_CH1_state == 1){                       //If pin 8 is LOW and the last state was HIGH then we have a state change
    detectado=1;                                      //We haev detected a state change!
    last_CH1_state = 0;                               //Store the  current state into the last state for the next loop
    }
}

Finally the question: What do I need to add to this code to make it work in my application?

PS.  Issues regarding safety are addressed by another board that have fuse and over voltage protection.

PPS. I have 5V supply dedicated to driving the board and Arduino.

enter code here
void setup() {

}

 int faza=0;
 int cykle=1;
 bool wcisniety;

  void loop() {

    faza=20000 * analogRead(2) / 255;// Pot 1
    cykle=100 * analogRead(3) / 255; //Pot2

  if(digitalRead(4) && (! wcisniety))// if cheacks for button pres to activate function
    {zgrzewaj();}

   wcisniety=digitalRead(4);

   }

 void zgrzewaj(){

   while (digitalRead(0)){

    }

  for (int i=0; i < cykle;i++){

delayMicroseconds(faza);

digitalWrite(1,HIGH);

delay(10-faza/1000);

digitalWrite(1,LOW);// fireing TRIAC
 }
}

This is what i come up  with. While it looks simple and proprly build still dont hav any output.
All coments appreciated.


texts: Unable to connect PN532 Board to Arduino Uno

texts:
I'm attempting to connect this PN532 NFC Board to an Arduino UNO using SPI. Currently my arduino is unable to recognize the board and I'm not sure whats the root of my issue. I'm using the Adafruit PN532 library and my program fails at trying to get the Firmwarm Version of the attached chip. I've attached the code and pictures of the soldering and connections. One interesting note is the LED on the chip will turn on before I connect VCC. The LED will turn on as soon as plug in MOSI (Not sure if that is intended behavior). Any ideas on where my issue might be?
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>

// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SCK  (13)
#define PN532_MISO (12)
#define PN532_MOSI (11)
#define PN532_SS   (10)

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

void setup(void) {
  Serial.begin(115200);
  nfc.begin();
  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Could not find board");
    while (1); // halt
  }

  Serial.print("Found Board");
  nfc.SAMConfig();
}

void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
  uint8_t uidLength;

  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  if (success) {
    Serial.println("Found a card");
    }
    delay(2000);
}


texts: Adafruit Flora V2 use onboard and external NeoPixels

texts: I am working on wearable project using an Adafruit Flora V2, and for this project I need to use the onboard NeoPixel. I also need to use Neopixels that are attached to the D6 pin (is it a pin?). I have a line at the beginning of my program that says #define PIN 6. I found that I can use the onboard NeoPixel by changing this to #define PIN 8. Is there a way to use the onboard NeoPixel and the ones attached to D6. I already have everything wired up, and the rest of my program is written, I just need to use both pins. Thanks for any possible help.


texts:
My system looks like this:

ESP8266 is connected to Arduino Uno (2, 3 pins) and a relay's data input to Arduino's pin 12 and power for relay is provided from another source.

Arduino gets data from server and switches on/off relay according to that signal. This system works perfectly for few hours and then suddenly crashes. In my WiFi console I have:

  wlan0: STA 2c:3a:e8:4e:bf:70 WPA: pairwise key handshake completed
  (RSN) wlan0: STA 2c:3a:e8:4e:bf:70 IEEE 802.11: disassociated wlan0:
  AP-STA-DISCONNECTED 2c:3a:e8:4e:bf:70 wlan0: STA 2c:3a:e8:4e:bf:70
  IEEE 802.11: disassociated wlan0: STA 2c:3a:e8:4e:bf:70 IEEE 802.11:
  associated wlan0: STA 2c:3a:e8:4e:bf:70 IEEE 802.11: disassociated
  wlan0: STA 2c:3a:e8:4e:bf:70 IEEE 802.11: disassociated wlan0: STA
  2c:3a:e8:4e:bf:70 IEEE 802.11: associated wlan0: AP-STA-CONNECTED
  2c:3a:e8:4e:bf:70

I have read this Arduino question, but circuit diagram similar to that one. I get power from my PC to run Arduino.

This is my Arduino code :

#include "WiFiEsp.h"

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(2, 3); // RX, TX
#endif

char ssid[] = "RPi";            // your network SSID (name)
char pass[] = "raspberry";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

char server[] = "192.168.50.1";

unsigned long lastConnectionTime = 0;         // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 10000L; // delay between updates, in milliseconds
int testLED = 12;
// Initialize the Ethernet client object
WiFiEspClient client;

void setup()
{
  pinMode(testLED, OUTPUT);
  // initialize serial for debugging
  Serial.begin(9600);
  // 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");

  //printWifiStatus();
}

void loop()
{
  // if there's incoming data from the net connection send it out the serial port
  // this is for debugging purposes only
  while (client.available()) {
    char c = client.read();
    //code to run relay
    if (c == '#')
    {
      while (client.available() == 0) { } // Do nothing while we wait for the next value

      // reading the second charactor
      c = client.read();
      if (c == '1') {
        Serial.println("On");
        digitalWrite(testLED, HIGH);
        delay(600000);
      }
      else if (c == '0') {
        Serial.println("Off");
        digitalWrite(testLED, LOW);
        delay(600000);
      } //end of C cheking if-else
    }  //end of first charactor # if
    //end of replay code
  }
  // if 10 seconds have passed since your last connection,
  // then connect again and send data
  if (millis() - lastConnectionTime > postingInterval) {
    httpRequest();
  }
}

// this method makes a HTTP connection to the server
void httpRequest()
{
  Serial.println();

  // close any connection before send a new request
  // this will free the socket on the WiFi shield
  client.stop();

  // if there's a successful connection
  if (client.connect(server, 80)) {
    Serial.println("Connecting...");

    // send the HTTP PUT request
    client.println(F("GET /simple.txt HTTP/1.1"));
    client.println(F("Host: localhost"));
    client.println("Connection: close");
    client.println();
    // note the time that the connection was made
    lastConnectionTime = millis();
  }
  else {
    WiFi.begin(ssid, pass);
    Serial.println("Reconnecting again");
  }
}


texts: Can not receive data from UART with stepper motor

texts:
I am using an Arduino Mega2560
While my motor is moving I can not receive anything from the UARTs. When the motor ends movement, I receive data from UART.

How can I make my motor move without stopping the reception of data from UART?


texts: teensyduino with teensy LC: cannot include multiple files in sketch

texts:
I'm trying to get a rather large sketch working with a teensy LC.  I'd like to break it into headers and C files, but the multi-file sketch fails to compile.  When I put everything into a single, monolithic sketch, it runs fine.  I've #included the h files where they are needed, using single quotes, and have confirmed that my h files are in the same folder as my sketch.  Is there an additional step to go through specific to teensy?  I've managed to do this tons of times using a standard arduino.

Here is a basic sketch:

This is the main sketch file:

   #include "tst.h"
void setup() {
  // put your setup code here, to run once:

}

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

This is tst.h

void doNothing();

This is tst.c

#include "tst.h"
void doNothing()
{
  int i = 0;
}

I get the  error "undefined reference to doNothing() in function loop"


texts:
This code sets a pin HIGH for 1 microsecond and then LOW for 1 microsecond. The expected frequency should be about 500 kHz. When measuring the output the frequency is about 96.4khz. Why ?

int del = 1;

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

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

digitalWrite(3, HIGH);
delayMicroseconds(del);
digitalWrite(3, LOW);
delayMicroseconds(del);

}


texts:
When I test this program, the motor starts vibrating when proxy1 is low and proxy2 is high. The displayed text also goes wrong.

#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,4,5,6,7);

int ir1=22;
int ir2=26;

int led1=23;

int motor=24;
int motor2=25;

int proxy1=0;
int proxy2=0;

void setup() {
  pinMode(ir1,INPUT);
  pinMode(ir2,INPUT);

  pinMode(led1,OUTPUT);

  pinMode(motor2,OUTPUT);
  pinMode(motor,OUTPUT);
  lcd.begin(16,2);
  lcd.setCursor(0,0);
  lcd.clear();
  lcd.println("Everything Is In");
  lcd.setCursor(0,1);
  lcd.println("Order...........");

}
void loop(){
  proxy1=digitalRead(ir1);
  proxy2=digitalRead(ir2);
if((proxy1==LOW)&&(proxy2==HIGH))
{
  lcd.setCursor(0,0);
  lcd.clear();
  lcd.println("Rule Violated!");
  digitalWrite(led1,HIGH);
  digitalWrite(motor2,HIGH);
  digitalWrite(motor,LOW);

}
if((proxy1==LOW)&&(proxy2==LOW)) {
  lcd.setCursor(0,0);
  lcd.clear();
  lcd.println("Everything Is In");
  lcd.setCursor(0,1);
  lcd.print("Order");
  digitalWrite(led1,LOW);
  digitalWrite(motor2,LOW);
  digitalWrite(motor,HIGH);
  delay(2000);
  digitalWrite(motor2,LOW);
  digitalWrite(motor,LOW);
}
else
{
  lcd.setCursor(0,0);
  lcd.clear();
  lcd.println("Everything Is In");
  lcd.setCursor(0,1);
  lcd.print("Order");
  digitalWrite(led1,LOW);
  digitalWrite(motor2,LOW);
  digitalWrite(motor,LOW);
}
}


texts:
I hope you all well.

Recently after view unknown crashes I decided it can be related with me messing with "heap"

After reading few sources on heaps and how it works it kind of confusing. Some sources mention that you can F() everything and it will be fine and others mention reserving space for strings with "reserve()"

I am looking for suggestions how possibly eliminate or or control?

I will post snapshot of code below where the evil "String" is used few times.

////////sending data
    senddata(String(temp), String(hum), String(dis), String(flood), String(heaterstatus), String(humidifierstatus));
    //////////sending data

void senddata(String temp1, String hum1, String dis1, String flood1, String heater1, String humid1) {   /////sending all field values in one go
  //////////sending data
  String getData = "GET /update?api_key=" + API + "&field1=" + temp1 + "&field2=" + hum1 + "&field3=" + dis1 + "&field4=" + flood1 + "&field5=" + heater1 + "&field6=" + humid1;
  sendCommand("AT+CIPMUX=1", 5, "OK");
  sendCommand("AT+CIPSTART=0,\"TCP\",\"" + HOST + "\"," + PORT, 15, "OK");
  sendCommand("AT+CIPSEND=0," + String(getData.length() + 4), 4, ">");
  esp8266.println(getData); delay(1500); countTrueCommand++;
  sendCommand("AT+CIPCLOSE=0", 5, "OK");
}


texts: How to measure water turbidity with arduino

texts: I would like to measure water turbidity in the sea. The sensor does not need to measure it in an accurate way, I just need to know if water is clear or very turbided. I know that there could be used a light scatter but I do not know what kind of sensor should I use. Could anyone help how to measure turbidity?


texts: CC3000 gets wrong address when connecting to wireless AP

texts:
I tried using both the SparkFun and Adafruit CC3000 libraries first with what I actually wanted as a program, but when that didn't work, the examples for those libraries, and I always seem to get the same problem.

The CC3000 will connect to my AP, which uses a private address in the range 172.24.1.1/24, and somehow it will end up with the address 192.168.1.64.

I know that it is connecting, since iw event lists the device MAC address as it connects.

The only changes I have made to the source code at this point are the ssid and password, and changing the interrupt and vbat pins to match the configuration of the tinyduino cc3000 board.

The device has firmware 1.34. Here is the code.

The specific output I get from the arduino is as follows (Note I commented out the disconnect at the bottom):

Connected at 115200

---------------------------------
SparkFun CC3000 - Connection Test
---------------------------------
CC3000 initialization complete
Connecting to: my_wifi_ap
Connected!

CC3000 MAC Address: 70:FF:76:04:B9:5B
IP Address: 192.168.1.62
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.254
DHCP Server: 0.0.0.0
DNS Server: 192.168.1.254
SSID: my_wifi_ap

Finished connection test

running iw event -f on my AP before running a connection test gives me the following output:

wlan0: new station 70:ff:76:04:b9:5b

When another device, like my phone, connects to this AP, we get 172.24.1.xx, where xx is whatever number between 50 and 150 that DHCP assigns us.

Edit:
Also, if I comment out the disconnect at the end of the test, I can see the device is sending keepalives every three or four seconds using:

iw dev wlan0 station get 70:ff:76:04:b9:5b  //(inactive time never exceeds 4000ms).

I can't ping 192.168.1.64 because that network is obviously unreachable, but trying to ping 172.24.1.64 gives me a exception:

icmp open socket: Operation not permitted

Output from Adafruit Example:

RX Buffer : 131 bytes
TX Buffer : 131 bytes
Free RAM: 1221

Initialising the CC3000 ...
Firmware V. : 1.32
MAC Address : 0x70 0xFF 0x76 0x04 0xB9 0x5B
Started AP/SSID scan

Networks found: 20
================================================

...

SSID Name    : my_wifi_ap
RSSI         : 83
Security Mode: 3

SSID Name    : my_other_wifi_ap
RSSI         : 67
Security Mode: 3

...

================================================

Deleting old connection profiles

Attempting to connect to my_wifi_ap
Started AP/SSID scan

Connecting to my_wifi_ap...Waiting to connect...Connected!
Request DHCP

IP Addr: 192.168.1.62
Netmask: 255.255.255.0
Gateway: 192.168.1.254

The actual device being connected to is a Raspberry Pi AP, which was set up with DNSMASQ and hostapd. The configuration works, and has been proven to work with other embedded networking devices.


texts: how to push data from an Arduino pin to Bluetooth module

texts: I'm writing a software that can receive data from Arduino via Bluetooth. My software is pretty fine now, at least it can pair with my hardware but when I try to test whether it can receive data via Bluetooth, I'm stuck. My Arduino receives temperature readings from a sensor at Analog pin 0. My Bluetooth module HC-05 connects with Arduino at Digital 0 and 1 (RX and TX pin respectively, as default). I don't know how to push data from Analog pin 0 to the Bluetooth module. Thanks in advance for any suggestion.


texts: Is it possible to run two for loops separated?

texts:
I have three funtion which describe the brightness of three LEDs. I want the seconde loop run 1 second after the first one and the third 1 second after the second one. One loop needs approximately 5 seconds. So basically I need to run three loops separated. How is this possible?

Update:
So I have this code running which I can compile but does not work:

int LED = 3;
int LED2 =10;
int LED3 = 9;

bool loop1state, loop2state, loop3state; // True if running, false if off
int  loop1index, loop2index, loop3index; // Iterator values
int  periodIndex = 0; // starting with 0, increasing every 10 ms

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

void loop()
{
// Update loop enablers.
switch(periodIndex)
{
case 0:
 loop1state = true;
 loop1index = 0;
 break;

case 1000:
 loop2state = true;
 loop2index = 0;
 break;

case 1500:
 loop3state = true;
 loop3index = 0;
 break;

case 4000:
 periodIndex = 0;
 break;
}

if (loop1state)
{
 for (loop1index = 0; loop1index<255; loop1index++){
  analogWrite(LED,loop1index);
 }

 loop1state = loop1index < 256;
 }

 if (loop2state)
 {
 for(loop2index = 0; loop2index<255; loop2index++)
 {
  analogWrite(LED2,loop2index);
 }

 loop2state = loop2index < 256;
}

 if (loop3state)
 {
 for(loop3index = 0; loop3index<255; loop3index++)
 {
  analogWrite(LED3,loop3index);
 }
 loop3state = loop3index < 256;
 }
 delay(10);
 }


texts:
void loop()
{
  if (sensor.begin() == true)
  {
    Serial.print("Current Conversion Mode: ");
    Serial.println(sensor.getConversionMode());
    Serial.println("Enter your mode of Conversion (number 0 - 3): ");
    while (Serial.available() == 0); // Waits for the user input
    mode = Serial.read(); // Reads the input string from serial port
    Serial.print("Number recieved: ");
    Serial.println(mode);
    delay(500);
    if (mode == '0' | mode == '1' | mode == '2' | mode == '3')
    {
      sensor.setConversionMode(mode);
      Serial.println();
      delay(500);
    }
    else
    {
      Serial.println("Conversion mode unsuccessfully set - Please enter a number 0 - 3");
    }
    delay(1000);
  }
  else // Runs when the device was unable to setup properly
  {
    Serial.println("Device failed to setup");
  }
}

I'm currently using the SparkFun red board to run this code on. I have been trying to get this to read from the serial monitor to take an input to send to the library I wrote to change the value of the conversion mode register of a temperature sensor. When I run the code, I can only have it run once correctly, then it jumps directly to the else statement for the inputs, saying that 0-3 was not an input. I tried the other methods that people have suggested  from this website and the Arduino forums but none of them have worked for me yet. I'm not sure if adding more delays would help - that was one of the most common suggestion I found for this specific issue and it wasn't that consistent. Please help! Thanks.


texts: how to create a specific buffer when there is no buffer message in the data packet?

texts:
So I'm trying to understand a read method. In this method,

// Read data from buffer
int SoftwareSerial::read()
{
if (!isListening())
  return -1;

// Empty buffer?
if (_receive_buffer_head == _receive_buffer_tail)
  return -1;

// Read from "head"
uint8_t d = _receive_buffer[_receive_buffer_head]; // grab next byte
_receive_buffer_head = (_receive_buffer_head + 1) % _SS_MAX_RX_BUFF;
return d;
}

it looks it receives buffer head. But in the write only a 1 or 0 is being sent as the data packet's header. Nothing else. So how does the arduino know how big of an buffer to create?
also, there is no stop bit being transmitted, so how does it look at a buffer tail? Or is this all created regardless of the transmitter? and then, all the values just get read into the buffer, and then read again from there? Also I don't see a delay in this read method. Wouldn't that cause errors in the data flow? How is that being handled?


texts:
Arduino Nano Every schematic informs us that we can use ATMega4809's pins PF03 and PF02 to communicate via I2C.
ATMega4809 manual says in page 19 that in order to use those pins as I2C we need to use PORTMUX.
I'm not really an expert and I don't understand how to do that.
Any help would be approciated.


texts: Make system with ultrasonic sensor and servo

texts:
I want to create a system where the servo will make the ultrasonic sensor move and detect the area in front of it. I have made the program but when run the ultrasonic sensor can not detect as usual.

Does anyone have another program or why my program is not running as planned?

This is the source code :

#include <Servo.h>

const int trigPin = 10;
const int echoPin = 9;
int lampu = 13 ;

// membuat nama objek servo untuk pengontrolan servo
Servo myservo;
// variable untuk menyimpan posisi servo
int pos = 0;
long duration, inches, cm;
void setup() {
  Serial.begin(9600);
  pinMode(lampu, OUTPUT);
  myservo.attach(7);
}

void loop() {
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
  inches = microsecondsKeInchi(duration);
  cm = microsecondsKeCenti(duration);
  Serial.print(inches);
  Serial.print(" in, ");
  Serial.print(cm);
  Serial.print(" cm");
  Serial.println();

  lampuNyala() ;
  servo();
  delay(10);
}

// start dari 0 derajar sampai 180 derajat
long microsecondsKeInchi(long microseconds)
{
  return microseconds / 74 / 2;
}

long microsecondsKeCenti(long microseconds)
{
  return microseconds / 29 / 2;
}

void servo(){
  for(pos = 0; pos < 180; pos += 1)
  {
    // pada posisi 1 derajat
    // memberitahu servo untuk pergi ke posisi  'pos'
    myservo.write(pos);
    // tunggu 15ms untuk pencapaian  posisi servo
    delay(30);
  }
  // start dari 180 derajat ke 0 derajat
  for(pos = 180; pos>=1; pos-=1)
  {
    // memberitahu servo untuk pergi ke posisi  'pos'
    myservo.write(pos);
    // tunggu 15ms untuk pencapaian  posisi servo
    delay(30);
  }
}

void lampuNyala(){
  if(cm > 0 && cm <=30){
    digitalWrite(lampu,HIGH) ;
  }
  else{
    digitalWrite(lampu,LOW) ;
  }
}


texts: Need code for reading&plotting a quadrature encoder signal

texts:
some help needed!
I have a high quality quadrature encoder with outputs A+, A-, B+, B-, Ref+, Ref-.
If all edges are read, the encoder gives 108000 ppr.
For the frequency, in my setup it makes a turn in about 30 sec or more, but the readhead can take much more.
I have already hooked it up to Arduino UNO and can see the counts correctly in serial monitor at 500000baud (below it has a loss). It counts up to 54000 ppr only (I use pins D5, 6 as input, A+, B+)
What I would need is the following: code that is able to read 108000ppr, measures and plots the apparent angular position of the shaft for a full rotation, degrees on the X axis, deviation from the theoretical (constant speed) on the Y axis (unit arcseconds).
The trigger for the beginning and end of the plot is the Ref channel.
I have a solid understanding of the basics, can wire any hardware if necessary to add but I cannot write code, at best I can understand what a C code does when I read it :)
I need this stuff to check the precision of components I am using in my products.
Thanks for you attention,
Andras


texts:
I'm trying to build an Arduino 4WD smart car. so i connected my l298N motor driver module with my v4 shield and used a 4 x 1.5v AA batteries to try and power my 4 motors up. i connected 2 of the motors in parallel so i can use 1 L298N to power it on. initially it worked but then a few minutes later it stopped moving. i thought my connections were bad so i redid all the connections but it didn't work so i changed the battery to 9v. with this the motors worked for a few seconds then stopped but was making noise so i tried powering the motor driver with my Arduino but it didn't come on. I tried powering the motor driver module with my Arduino but the driver module didn't come on.i decided to use my bread board and l293D IC to control my motors it didn't work but the motors were making noise. I changed my motor to one that i removed from a PlayStation controller but nothing still.i did research on the internet and was advised on this tutorial (https://create.arduino.cc/projecthub/maxxlife/arduino-4wd-car-cf5fd0) to not use AA batteries but no explanation why. so i checked other tutorials and saw people using AA to control 1 or 2 motors. Why shouldn't i use AA batteries? does anyone please think they know the solution to my problem? thank you
This is how my kit looks https://www.ebay.com/itm/NEW-4WD-Robot-Smart-Car-Chassis-Kits-car-with-Speed-Encoder-for-Arduino-M26/201561877173?_trksid=p2047675.c100009.m1982&_trkparms=aid%3D777000%26algo%3DABA.MBE%26ao%3D1%26asc%3D36860%26meid%3Dc76077722d4348e88152fa6c7f32c005%26pid%3D100009%26rk%3D1%26rkt%3D1%26sd%3D181329341315
Also should i change my use Li-ion battery 18650 x2 instead of the 6LR61 9v battery i used


texts:
i am making post requests with esp8266 on nodeMCU. i have a messy code so i dont want to annoy you with showing it here. the problem is i get soft wdt reset time to time while making request. for example i change piece of code(removing or adding some serial.println lines) and i see i get soft wdt reset right there in http.post.

i tried my best to avoid Strings. I only used a few times, without in the loop. I am only using WiFiClientSecureBearSSL with FirebaseESP8266.

do you have any idea what cause this problem?


texts: LB1847 stepper controller :how to connect to grbl atmega based board with step ,direction,enable , limit?

texts:
I like to use an LB1847 chip with stepper motor "both salvaged from old copier". I made a GRBL AtMega board, this board gives step, direction, enable and limit leads.

So I tried to find the corresponding pins on the LB1847, but the data sheet only shows enable1 and enable2 pins and phase1 and phase2 pins?

So how can I connect the step and direction and enable pins of AtMega to these pins of LB1847?

There are other logic pins on LB1847 chip to control current and decay.
If the data sheet is required i can upload it.

Thanks in advance


texts: ESP8266 Software serial to ATmega 328 is not properly working

texts:
Thanks in advance..

We are having esp8266-12E chip and Atmega328 connected as follows,
ESP 12 pin as Tx,13 pin as Rx && Atmega328 13pin as Rx, 12pin as Tx. Everything works fine, but while communicating via serial some low pulse is being generated. We couldn't find the issue with multimeter anyway but got it by oscilloscope signal.

When this false low pulse during communication happens Atmega328 connected pins also getting low for the same duration.

We tried using separated logic execution for ESP and Atmega and both were worked perfectly, but only during communicating via Software serial its flickers getting started.

Please help us getting this resolved.


texts: What should be the delay to be given for reading accelerometer

texts:
I have five accelrometer sensors (MMA 7361) connected to the analog channels of Arduino Duemilanove. I am using the following code to read the data. (I am reading from only one axis from each sensor.)

#include <avr/io.h>
#include <avr/wdt.h>

int sensorValue = 0; // value read from the pot

void setup()
{
    Serial.begin(9600); // initialize serial communications at 9600 bps:
}

void loop()
{
    // read the analog values:

    int i=1;

    Serial.print("ACS#");

    for(i=0;i<5;i++)
    {

        sensorValue = analogRead(i);
        Serial.print(sensorValue);
        Serial.print("#");

        delay(10);
    }

    Serial.println("");

}

I am using a delay of 10 after reading each sensor. What should the value of the delay I should be using after reading one sensor to get the correct values from the sensors?


texts: Can you use an Arduino UNO as an EEPROM programmer

texts: Hi I have an Arduino UNO and a AT28c64B and a single shift register, is it possible to make an EEPROM programmer with it? I’m not too good with the Arduino to do a lot of trial and error... I would just like to know if it’s possible or not, not how to...


texts:
How can I convert a byte array to float?

Code:

void send_data() {
    CCPACKET data;
    data.length=2;

    float lon=26.533255;
    float lat=27.533463;

    data.data[0]=lon;
    data.data[1]=lat;

    if(cc1101.sendData(data)){
    Serial.println(data.data[0]);
    Serial.println(data.data[1]);

    Serial.println(" sent ok ");
    return true;
    }else{
    Serial.println("sent failed ");
    return false;
    }

 }

The problem is when I print those two variables it just prints lon 26.00 and lat 27.00 but not lon 26.533255 lat 27.533463 as I expected.

Here is the header file for CCPACKET I use:

#ifndef _CCPACKET_H
#define _CCPACKET_H

#include "Arduino.h"

/**
 * Buffer and data lengths
 */
#define CC1101_BUFFER_LEN        64
#define CC1101_DATA_LEN          CC1101_BUFFER_LEN - 3

/**
 * Class: CCPACKET
 *
 * Description:
 * CC1101 data packet class
 */
class CCPACKET
{
  public:
    /**
     * Data length
     */
    byte length;

    /**
     * Data buffer
     */
    byte data[CC1101_DATA_LEN];

    /**
     * CRC OK flag
     */
    boolean crc_ok;

    /**
     * Received Strength Signal Indication
     */
    byte rssi;

    /**
     * Link Quality Index
     */
    byte lqi;
};

#endif

I was trying to fix it by this part of code, but without success:

float lon=26.533543;

*((float *)data.data[0]) = lon;

Can someone help me to convert the byte array to float?


texts: Using multiple laptop battery packs to power everything

texts:
I'm working on a medium sized robot project with multiple arduinos to control stuff. I've been planning on using a lead-acid battery pack, but then I was given 10 working and identical Asus laptop battery packs rated at 14.8 V 4400 mAh, and one old Asus laptop.

I opened up one of the battery packs, because it was bad and it has a 4S2P battery configuration and a protection board.

Can I hook all of these battery packs in parallel, or will power leak between the battery packs, and is that be a problem?

Is there alternatively some 4S20P or 3S25P battery pack with charger I can purchase to put these batteries in?

(I do have a step-down converter that will provide the Arduinos with the right voltage, regardless of input voltage up to 36 V)

I tried to ask a similar question on electrical engineering, but ot was deemed off topic for the site.


texts:
I'm testing a servo using varspeedservo.h and it rotates to 180 degree on start and then rotates back to programmed position.
Here is the code:

#include <AFMotor.h>
#include <VarSpeedServo.h>
VarSpeedServo myServo;

void setup()
{
  myServo.attach(10);
}
void loop()
{
  myServo.slowmove(0, 30);
  delay(5000);
}


texts: What is the best vehicle platform to begin with (e.g. tracked, four-wheel drive)

texts: Despite many articles on the topic of vehicle platforms, none of them seem to recommend the best one to start with. Later on I am sure I will seek an exact kind of chassis for autonomous vehicle construction, but now I am looking to learn the basics of this area of the Arduino world. If you could give me a simple recommendation for the general category of vehicle platform to use it would be much appreciated. I will be using an ultrasonic distance sensor coupled with a servo motor to detect obstacles, so it is a very simple project. Thank you so much.


texts: How do I upload sketch (and parameters) through a user interface

texts:
I'm pretty new to Arduino and I'm developing my first real-world project.

I have a Arduino Mega with a full working sketch in it which is going to be placed in several distant places and I have a number of "mantainers" that will need to get to the place, connect the board with their Windows (Vista+) laptop (USB), upload a new version of the sketch (if available), download some data from EEPROM and change (if needed) some parameters stored in PROGMEM. This just to give you the full picture, now I come to the questions.

What I'm trying to attempt is to write (in c++) a software that gives non-programmers a UI to do this stuff easily, so I wonder:

How do I load the .hex file to the board? I kinda got I have to use AVRdude: is there any c++ example/tutorial/library I can use not to reinvent the wheel?
When can I write to PROGMEM? When I connect with the serial cable Arduino stops the running sketch, waits for a new sketch and, if it does not arrive, it starts the old sketch back again. I guess that is the time to write to PROGMEM: if there is a running sketch I cannot do it, am I right?


texts: Fail programing a Sonoff Dual with Arduino IDE

texts:
1) I have a Sonoff Dual, which I wish to upload a Sketch.

2) Other Sonoff basic devices programed the same way, with succes.
But when uploading  the sketch the ( even the generic Blink sketch ) - I do not get any response from the Sonoff device.

3) pins were soldered correctly according this tutorial

4) Uploading the sketch succeeds, using FTDI set to 3.3v.

What might be the reason for it ? What can I do more to check it ? my only guess is that something has happened to Sonoff device - but it uploads successfully.

Guy

Code (edit2)

    /*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Blink
*/
#define LED_BUILTIN 12
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  delay(2000);
  Serial.println("HELLLLLLO");
}

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

Upload

Build options changed, rebuilding all
Sketch uses 251224 bytes (50%) of program storage space. Maximum is 499696 bytes.
Global variables use 28080 bytes (34%) of dynamic memory, leaving 53840 bytes for local variables. Maximum is 81920 bytes.
Erasing 0x80000 bytes starting at 0x00000000
Uploading 255376 bytes from /tmp/arduino_build_214375/Blink.ino.bin to flash at 0x00000000
................................................................................ [ 32% ]
................................................................................ [ 64% ]
................................................................................ [ 96% ]
..........                                                                       [ 100% ]

Addede1: Port Selection:

note: when taken port was not connected ( connects to USB0)

edit3: erasing using esptool.py:

guy@desktop:~$ esptool.py --port /dev/ttyUSB0 --chip esp8266 erase_flash
esptool.py v2.5.0
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8285
Features: WiFi, Embedded Flash
MAC: 60:01:94:ad:bf:34
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 2.4s
Hard resetting via RTS pin...


texts:
I want to use both IMU at the same time using the Sparkfun Library on a SAMD21 mini breakout board. Can anyone help?

The begin function is :

inv_error_t MPU9250_DMP::begin(void) {
  inv_error_t result;
  struct int_param_s int_param;
  Wire.begin();
  result = mpu_init(&int_param);
  if (result)
    return result;
  mpu_set_bypass(1); // Place all slaves (including compass) on primary bus
  setSensors(INV_XYZ_GYRO | INV_XYZ_ACCEL | INV_XYZ_COMPASS);
  _gSense = getGyroSens();
  _aSense = getAccelSens();
  return result;
}


texts: Querying streaming sensor data on the Arduino board

texts:
I am new to Arduino and this forum, so please forgive me if I am asking something really trivial and stupid.

I have an Arduino board which collects sensor readings from an MPU6050 sensor (acceleration+gyroscope). The next step for me would be to process these data directly on the board. I want to somehow store N last sensor values and then query this set (collection, vector, array, whatever you call it) to fetch certain values. This set will be constantly updated with new values, whereas older values will be pushed out, so that only the most up-to-date values are stored in the set. For example, I want to know if the acceleration exceeded 10 m/s in the last minute.

In the literature this kind of set with most recent values is sometimes called window - this approach allows limiting an unbounded sequence of constantly generated tuples to a bounded bag and then apply traditional SQL-like query operators. For example, Oracle has come with CQL - an engine and a query language for handling streaming data.

Before I start implementing this, I am wondering if there is a similar (and, of course, much simpler) library for Arduino? If not, which data structure should I use to implement such functionality?

Also, my intention is to query not just individual values, but certain patterns and sequences - e.g., I want to know if the acceleration first decreased and then increased again (something similar to the WHERE condition of an SQL query). Does it look realistic to implement with Arduino?


texts: Arduino RS485 shield to RS485 temperature & humidity sensor

texts:
I’m try to get data from rs485 is not work please advise to me.

1.  Try to connect PC usb485 to DY-MD02 is work.
    Send command “AUTO” or “READ”

2.  Try to Arduino rs485 shield to DY-MD02 is not work.
    Send command “AUTO”

my code

''''

char command[4] = {'A', 'U', 'T', 'O'};

int n = sizeof(command)/sizeof(command[0]);   // Number of elements in an array

String incoming = "";   // for incoming serial string data

void setup()

{

      // initialize serial ports
      Serial.begin(9600);
      pinMode(EN,OUTPUT);
      digitalWrite(EN,HIGH); //Enable high, RS485 shield waiting to transmit data
      Serial.write(command,n); //Test send command Auto,Read to RS485
      delay(500);
}

void loop()

{

      String temp;
      digitalWrite(EN,LOW); //Enable low, RS485 shield waiting to receive data

      while(Serial.available() > 0 )
      {
          temp=Serial.read();
          Serial.println(temp);
          delay(1000); //Delay for some time, waiting for data transmitted
      }

}

''''

if change code to = Serial.readString() not show anything.

please help me
Thank

to Juraj

Maker tell me can connect with Arduino uno and send manual to me.

see in attach file.


texts: Arduino Mini Pro 3.3 V Issue with Bluetooth Mate

texts:
I have an Arduino Mini Pro 3.3 V powered from a coin cell(3.6 V, CR2450) and connected to Bluetooth Mate Gold. I have checked the connections and they are fine. I can also connect to the bluetooth from while trying to upload the file and also from Android bluetooth terminal.I am not sure if it could be bootloader issue as I have checked 2 Arduino Mini Pros that give the same problem running the sample sketch on the bluetooth hookup guide.

Arduino: 1.6.5 (Mac OS X)
Board: "Arduino Pro or Pro Mini, ATmega328 (3.3V, 8 MHz)"

The error is:

Sketch uses 2,412 bytes (7%) of program storage space. Maximum is 30,720 bytes.
Global variables use 210 bytes (10%) of dynamic memory, leaving 1,838 bytes for local variables. Maximum is 2,048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

I burned the bootloader again but no success.

I get the same with UNO. However with UNO, when I press the reboot button before the program uploads is works.

Could someone point me out to the solution to this? Thanks


texts: How can I send and receive data from an Arduino Uno to Arduino Mega using I2C?

texts:
I am trying to send data as a string from an Arduino Uno to another Arduino Mega. I have read about the I2C connection where we connect the RX to TX oppositely.

How to start and send and receive data between them? I have no idea how the code can be written.


texts:
Hello  I have an Arduino programme where a string is loaded from an SD card. That all works fine. I want to see if the string that has been loaded contains a certain phrase. I am using substring but it doesn't seem to be working. What am I doing wrong? Here's my code:

file = SD.open("/classes/basic.txt", FILE_READ);
 Serial.print("Reading, Checking and Compiling \n");
  while(file.available()) {
   character23 = file.read();
   content.concat(character23);
  }
if (content != "") {
  l1 = content;
  Serial.println(l1 + "\n");
}

if(l1.substring(0) == "print"){
  printlnMethod();
}
file.close();

it all works until it gets to l1.substring and that doesn't work because the method inside doesn't run. The string that gets loaded into the Arduino from the SD card is : println("hello world");

What am I doing wrong?


texts: I have a UDOO, and I wonder whether or not it is possible to use the Arduino that it has without starting the UDOO's operating system, i.e., I would like use Atmel Studio to load a program within the Arduino at UDOO.


texts: can't interface SIM900 GSM Module with Arduino Mega

texts:
I am trying to interface SIM900 GSM Module with Arduino Mega. When I send AT command on COM port in carriage mode then its not sending 'ok' back so I think the interface is not successful. Here is the resource which I referred to - Link.

Have a look below:-

Code:-

#include <SoftwareSerial.h>     //please put less than and greater than sign respectively in place of  =

SoftwareSerial SIM900(10, 11); // (RX, TX). please zoom image above to see exactly what is going where.

void setup()
{
  SIM900.begin(19200);               // the SIM900 baud rate
  Serial.begin(19200);

}

void loop()
{

  if (SIM900.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
  Serial.write(SIM900.read());
  if (Serial.available())                // if data is available on hardwareserial port ==> data is comming from PC or notebook
  SIM900.write(Serial.read());

}

Electric Connection:-

How to interface it correctly?

Update:- I added a 5v 2A power supply and changed Arduino Rx/Tx pin to 10/11. Added micro sim at the back but still the same result


texts: Is it better to use Vraw or Vcc on Mini Pro?

texts: I have 12V and 5V power available. Is it better to feed the 5V through the Vcc pin or either the 12V or 5V through the Vraw pin?


texts: AVR - How to know that there is collision between stack and heap or the memory has filled?

texts: I am using the dynamic memory in AVR microcontroller, so How to know that there is collision between stack and heap or if the memory has been filled?


texts: Will a genuine Arduino board have the same issues with High Sierra as other non genuine ones?

texts:
I think my question is quite specific to High Sierra. I am very new and have bought a starter Elegoo kit to learn the basics. I did not realise that their boards are not the real thing.

I have an iMac running High Sierra and although the Mac recognises the board (I checked this through the apple menu) every time i try to upload code i get the error message:

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

I have watched several videos on line that have taken me through installing drivers including one specific to High Sierra. However the problem continues.

Does anyone know if i buy a genuine Arduino board, will i have the issues? Will Arduino just not work with High Sierra.

Any help or advice would be so appreciated by someone very new and trying to learn!

Thank you

Paddy


texts: Analog output doesn't work for just 2 LEDs [Arduino Mega]

texts:
I am having a problem with an Arduino Mega 2560.

Everything works fine, the ultrasonic sensors work fine, and the other LEDs work fine. Although there is 2 LEDs who do not work right and when I do analogWrite(), they actually do digitalWrite(). I have tried to attach these two LEDs to a potentiometer (potentiometer works fine, values are tested) but it always does digitalWrite() not analogWrite().

I have tested the LEDs and potentiometer on an Arduino Uno in PWM pins and analog pin and yes it does work very well.

Please mind that these LEDs are attached to analog pins. Why is this? Because I do not have anymore PWM pins available to use and so I have to use analog pins. No way I can rearrange this.

Here is part of the code (only part otherwise it's too long, most of my pins are taken):

//Leds//

int led = A4;
int ledUV = A3;

//Potentiometer//

int potReading;
int potPin = A2;
int lightDim;

void setup(){

    Serial.begin(9600);

    pinMode(led, OUTPUT);
    pinMode(ledUV, OUTPUT);

    pinMode(potPin, INPUT);

}

void loop(){

    potReading = analogRead(potPin);
    lightDim = (255./1023.)*potReading;

    analogWrite(led, lightDim);
//  analogWrite(ledUV, lightDim);
//  Serial.println("pot: ");
//  Serial.println(potReading);
//  Serial.println(" ");
    Serial.println("dim: ");
    Serial.println(lightDim);
//  analogWrite(led, 255);
//  analogWrite(ledUV, 255);

}


texts: How to use get_properties to get RSSI in RF24?

texts:
As picture below, how to use get_properties ? I fail to understand AN625, how to use get_properties to get RSSI ?

Adding source code based on RH_RF24 functions.

#include <SPI.h>
#include <RH_RF24.h>

// Singleton instance of the radio driver
RH_RF24 rf24;

uint8_t Recieve_Data[20];

uint8_t receive_buffer[RH_RF24_MAX_MESSAGE_LEN];
uint8_t receive_buffer_length = sizeof(receive_buffer);

uint8_t Rssi;

unsigned long Micro_Time;

uint8_t status[8];
uint8_t buf[RH_RF24_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);

void setup()
{
  Serial.begin(115200);
  if (!rf24.init())
    Serial.println("init failed");
  // Defaults after init are 434.0MHz, modulation GFSK_Rb5Fd10, power 0x10
   while(!rf24.setFrequency(443));
  rf24.setModemConfig(rf24.GFSK_Rb50Fd100);  //设置成GFSK_Rb50Fd100
}

void loop()
{
  rf24.setModeRx();
  delay(100);
  rf24.setModeIdle();
  rf24.command(RH_RF24_CMD_GET_INT_STATUS, NULL, 0, status, sizeof(status));
  Serial.print("Id   ");
  for (int i = 0; i <= 8; i++)
  {
    Serial.print((uint8_t)status[i]);
    Serial.print("   ");
  }
  Serial.println();
  /*
    if (status[2])
    {
      uint8_t modem_status[6];
      rf24.command(RH_RF24_CMD_GET_MODEM_STATUS, NULL, 0, modem_status, sizeof(modem_status));
      delay(100);
      for (int i = 0; i <= 6; i++)
      {
        Serial.print(modem_status[i]);
        Serial.print("   ");
      }
      Serial.println();
    }
  */
  delay(400);
}


texts:
I am using the following wiring diagram from a tutorial.  I need to follow this configuration because later tutorials build on this example.  I have looked at other solutions, but they follow a different pattern and I am still learning, so don't have the sophistication to adapt.  I've looked at:

Hacktronics
StackExchange

The picture shows Freeduino, but I am using an Arduino Uno (does that make a difference?)

Here is the code I am using:

#include <LiquidCrystal.h>
int rs = 3;
int enable = 4;
int d4 = 5;
int d5 = 6;
int d6 = 7;
int d7 = 8;

int rows = 2;
int cols = 16;
LiquidCrystal lcd (3, 4, 5, 6, 7, 8);

void setup() {
  // put your setup code here, to run once:
  pinMode (rs, OUTPUT);
  pinMode (enable, OUTPUT);
  pinMode (d4, OUTPUT);
  pinMode (d5, OUTPUT);
  pinMode (d6, OUTPUT);
  pinMode (d7, OUTPUT);
  lcd.begin(cols, rows);
  lcd.clear();
}

void loop() {
  // put your main code here, to run repeatedly:
  lcd.setCursor(0,0);
  lcd.print("Hello World");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("Goodbye World");
  delay(1000);
}

Unfortunately, I am getting a blank screen (it is lit up, but blank).  So questions:

Is the diagram correct?
Is the code the problem?
What else should I look for?


texts:
I want to connect my YUN Rev. 2 to 7.4V.
I read that the older version only provides exactly 5 V at the Vin Pin. Is the Rev. 2 similar to it? I read that the power supply should be improved, but what does that mean?
I just tried to connect the Vin to regulated 5 V by a power supply board, but it didn't work. If I connect it to the 5V Pin the board is working, but I think this isn't recommended.
So has anybody experience with that board?
Thanks for your answers.


texts: Voltage divider for 6 non intrusive current sensors

texts:
I have an Arduino project where I intend to use 6 non intrusive current sensor model SCT013 (100A/50mA) manufactured by yhdc.com

As reference voltage on examples I find at the internet it is suggested the use of 2 10K resistor connected in series from 5V to ground, the reference voltage is extracted from the middle connection between the resistors (2.5v).

Question:

In the case of six sensors will I have to use 6 independent voltage dividers or can I use a single divider as reference for all sensors?

I am concerned the interference between sensors may cause reading imprecision.

Thanks in advance
Paulo


texts: I want to take a reading from 5 different mq sensor at a time. do I need an external power source to power these sensors or it will be ok to power sensors from 5v available from the board? I am using arduino uno board .


texts: Unable to use ir receiver and motor shield together

texts:
#include <IRremote.h>
#include <AFMotor.h>
AF_DCMotor motor(1);

int RECV_PIN = 14;//The definition of the infrared receiver pin 11
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  Serial.begin(9600); //Open serial
  irrecv.enableIRIn(); // Initialization infrared receiver
  motor.setSpeed(255);
  motor.run(RELEASE);
  Serial.println("start");
  motor.run(FORWARD);
  delay(1000);
}

void loop()
{
  if (irrecv.decode(&results)) {
    if(results.value==0x3D9AE3F7)
    {

      motor.run(FORWARD);
      delay(2000);
    }
    else if(results.value==0x1BC0157B)
    {
      motor.run(RELEASE);
      motor.run(BACKWARD);
    }
    Serial.println(results.value, HEX);//Wrap output in hex receive code
    Serial.println();//For ease of viewing the output to add a blank line
    irrecv.resume(); //Receiving the next value
  }
}

Motor shield is not working when I use an IR receiver.
I tried connecting the ir receiver in different analog pins but it didn't work. I guess it's due to some error in my code but unable to figure out.