texts: How can an Arduino Mega 2560+Wifi Shield 2.0 (SeeedStudio) receive data from database in a XAMPP server on my PC?

texts:
I'm trying to connect my Arduino Mega via Wifi to my XAMPP server. My main objective is get a value from my database and store it on a variable in Arduino code. With this new variable I'll be able to control the rest of the program... So I need your help. Can someone give me advice?

I already tried every thing that I found on the internet but it just doesn't work.

I think that the simple way is to send a GET request to the server and read its response... But for some reason I can't send a GET request through...

I tested it on the browser directly and the value shows up, so I think that the server side is all right.

Here is my Arduino code:

#include <Arduino.h>
#include <SoftwareSerial.h>
#include "WiFly.h"
#include "HTTPClient.h"

#define SSID      "mySSID"
#define KEY       "myKEY"
#define AUTH      WIFLY_AUTH_WPA2_PSK
#define HTTP_GET_URL "http://192.168.1.80/xampp/training/send_data_db.php/?temp=0"

// Pins' connection
// Arduino       WiFly
//  2    <---->    TX
//  3    <---->    RX
SoftwareSerial uart(10, 11);
WiFly wifly(uart);
HTTPClient http;
char get;

void setup() {
  Serial.begin(9600);
  Serial.println("------- WIFLY HTTP --------");
  uart.begin(9600); // WiFly UART Baud Rate: 9600
  // Wait WiFly to init
  //  delay(3000);

  // check if WiFly is associated with AP(SSID)
  if (!wifly.isAssociated(SSID)) {
    while (!wifly.join(SSID, KEY, AUTH)) {
      Serial.println("Failed to join " SSID);
      Serial.println("Wait 0.1 second and try again...");
      delay(100);
    }
    wifly.save(); // save configuration,
  }
  Serial.println("\r\nTry to get url - " HTTP_GET_URL);
  Serial.println("------------------------------");
  while (http.get(HTTP_GET_URL, 10000) < 0) {
  }
  while (wifly.receive((uint8_t *)&get, 1, 1000) == 1) {
    Serial.print(get);
  }
  if (wifly.commandMode()) {
    Serial.println("\r\n\r\nEnter command mode. Send \"exit\"(with \\r) to exit command mode");
  }
}

void loop() {
  int c;
  while (wifly.available()) {
    c = wifly.read();
    if (c > 0) {
      Serial.write((char)c);
    }
  }
  while (Serial.available()) {
    c = Serial.read();
    if (c >= 0) {
      wifly.write((char)c);
    }
  }
}

And here is my PHP code:

<? php
include("./connection/database_connect.php");
include("./top_table.php");

if ((isset($_SESSION["ID"])) AND (isset($_GET["temp"]))) {
  $id = $_SESSION["ID"];
  $sql = "SELECT temp FROM perfil, client WHERE perfil.ID ='$id'";
  $consult = mysqli_query($connect, $sql);
  $result = mysqli_num_rows($consult);
  if (($result == 1)) {
    $person_data = mysqli_fetch_array($consult, MYSQLI_ASSOC);
    $temp = $person_data["temp"];
    header("HTTP/1.1" . " " . 200 . "OK");
    header("Content-Type: text/html; charset=UTF-8");
    header("Content-Length: 1112");
    header("Connection: close");
    header("/r/n");
    echo $temp;
  } else {
    //se user dosen't exist on data base
    header("Location: http://192.168.1.80/xampp/training/login.php");
    exit;
  }
} else {
  header("Location: http://192.168.1.80/xampp/training/login.php");
  exit;
}
?>


texts: Arduino motor shield orange/white pin usage

texts:
I have an Arduino motor shield like this one plugged into my Mega board.

I would like to know some more information about the orange and white pin blocks on the board. The Arduino website has the following information, but it doesn't give any explanation of what is best to use them for or which pins are mapped to the data pins etc.

TinkerKit connectors for two Analog Inputs (in white), connected to A2 and A3.
TinkerKit connectors for two Aanlog Outputs (in orange in the middle), connected to PWM outputs on pins D5 and D6.
TinkerKit connectors for the TWI interface (in white with 4 pins), one for input and the other one for output.

What I want to do is connect a servo up to the board and was hoping I could use one of the orange OUT blocks. I haven't been successful in finding any examples of this which leaves me in doubt as to whether it is possible or not. I would just plug it in, but I'm afraid of frying the shield/mega/servo. Probably an irrational fear, but I can't afford another one of any at the moment!

I don't know which pins in the block are assigned to the data, vcc and out, so if anyone know I would be grateful for the answer.

Also, just because it is annoying not to understand, what are the TWI connectors for?

I hope this isn't too general a question as I could really use some answers!


texts: RFID stops working when I place the servo

texts:
I've successfully implemented Door Unlock system described in this tutorial.
At first I used Arduino Uno and RFID RC522 Reader and MG90S Micro servo.

When I used Arduino Uno with Arduino Pro Micro for arduino ATmega32U4 5V/16MHz, the RFID reader stops working after plugging the servo.
Since Arduino Pro Micro have only 5V output, I used resistors to downgrade 5V to 3V in order to poser the RFID reader. I used same output 'vcc' to select 5V for the servo and 3V converted to the reader.

The problem is that each component works perfectly independent of each other, however, when I place them together they stop working.


texts: Can we use ESP32 to program ESP32-CAM through ESP-IDF

texts:
Can we just use an ESP32 NodeMCU for example to program an ESP32-CAM? I saw a lot of people programming ESP32-CAM using an arduino Uno, can we do the same for ESP32 NodeMCU? Of course, in the "Arduino as ISP" programming mode.
If we can, is there anything more that I need? if not, why? and are there any other solutions to program it?

Moreover, I want to use ESP-IDF which is better than using the Arduino GUI app.


texts:
Note: I'm using just the atmega chip and atmel studio. Not exactly a full arduino.

I have been using the atmega168 with a MAX17040 fuel gauge in a project. The I2C interface between the atmel and the fuel gauge is working fine and I am able to read data from the fuel gauge.

Due to the power requirement of the project, the fuel gauge requires its compensation value to be adjusted. This is a 16 bit register, so according to the manufacturer I have to write 0x1234 across address 0x0C and 0X0D in one go. Otherwise the values are discarded.

All the datasheet and online forums talk about 8-bit I2C addressing (which I have working), but instruction on addressing 16 bit register is limited. I was wondering if anyone can help me on this.

My basic code is pasted below. The I2C_start takes care of TWCR, TWDR, etc. It could be something to do with Repated_Start, but not sure.

uint8_t I2C_write_register(uint8_t device, uint8_t address, uint8_t value)
{
    device <<= 1;

    uint8_t ret = I2C_start(device | TW_WRITE);
    if (ret)
        return 1;

    if (!ret)
        ret = I2C_write(address);
    if (!ret)
        ret = I2C_write(value);
    I2C_stop();

    return ret;
}

uint8_t I2C_start(uint8_t address){
    // reset TWI control register
    TWCR = 0;
    // transmit START condition
    TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);
    // wait for end of transmission
    while( !(TWCR & _BV(TWINT)) );

    // check if the start condition was successfully transmitted
    if((TWSR & 0xF8) != TW_START){ return 1; }

    // load slave address into data register
    TWDR = address;
    // start transmission of address
    TWCR = _BV(TWINT) | _BV(TWEN)|_BV(TWEA); //|_BV(TWEA) added
    // wait for end of transmission
    while( !(TWCR & _BV(TWINT)) );

    // check if the device has acknowledged the READ / WRITE mode
    uint8_t twst = TW_STATUS & 0xF8;
    if ( (twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK) ) return 1;

    return 0;
}


texts:
So I'm facing this problem a lot in my code where the program is not getting into the if else loop properly and just returning the same answer again and again.

void loop() {

double X_value = ((double)(analogRead(X_pin)-487))/540.00;
double Y_value = ((double)(529-analogRead(Y_pin)))/540.00;

double theta_rad = atan((double)Y_value/(double)X_value);
double theta_deg = ((double) theta_rad)*180.00/3.1416;

double temp = (double)abs(tan((double)theta_rad));
if (temp == 0.00) {
temp2 = 0.00;
} else {
  double temp2 = min(temp,1.00/temp);
}

Serial.print("Theta = ");
Serial.print(theta_deg);
Serial.print("\n");
Serial.print("temp 2 = ");
Serial.print(temp2);
Serial.print("\n");

delay(1000);

}

The answer keeps on coming 0 even when temp is non zero.

If anyone knows the reason please help...


texts: I am trying to install the Teensy loader software but I need to know where Arduino is installed. Does anyone know where in Fedora the Arduino files are?


texts:
I am using EM-18 Rfid module with Arduino mega the problem is that when i swipe the card for reading the card ID nothing will shown in serial monitor.Code given below.EM-18 connection diagram is given in attachments.
int count = 0;
    char card_no[12];
    void setup()
    {
       Serial.begin(9600);
    }
    void loop()
    {
       if(Serial.available())
       {
          count = 0;
          while(Serial.available() && count < 12)
          {
             card_no[count] = Serial.read();
             count++;
             delay(5);
          }
          Serial.print(card_no);
       }
    }


texts:
I have tried many combinations and I can get the Attiny85 to display on the TM1637 just fine, but I cannot get ant readings from the DTH11, tried different pins, libraries. I upload code via UNO as isp and that works fine. Tried same code on UNO and it works.
This is my first question on here, I usually figure things, but also first ATtiny85 adventure.

#include <TM1637Display.h>
#include "DHT.h"
#define CLK 4
#define DIO 3
#define DHTPIN 2  //
#define DHTTYPE DHT11
int MTD (2000);
TM1637Display display = TM1637Display(CLK, DIO);
DHT dht(DHTPIN, DHTTYPE);

const uint8_t celsius[] = {
  SEG_A | SEG_B | SEG_F | SEG_G, SEG_A | SEG_D | SEG_E | SEG_F
}; // oC
const uint8_t Fahrenheit[] = {
  SEG_A | SEG_B | SEG_F | SEG_G, SEG_A | SEG_E | SEG_F | SEG_G
}; // oF
const uint8_t Humidityh[] = {
  SEG_B | SEG_C | SEG_E | SEG_F | SEG_G, SEG_C | SEG_D | SEG_E | SEG_F | SEG_B
}; // HU

void setup() {
  dht.begin();
  display.setBrightness(7);
}

void loop() {
  delay(1000);
  float Humidity = dht.readHumidity();
  float TemperatureC = dht.readTemperature();
  float TemperatureF = dht.readTemperature(true);

  display.showNumberDecEx(TemperatureF, 0b10000000, false, 2, 0);
  display.setSegments(Fahrenheit, 2, 2); delay(MTD);
  display.showNumberDecEx(Humidity, 0b10000000, false, 2, 0);
  display.setSegments(Humidityh, 2, 2); delay(MTD);
  display.showNumberDecEx(TemperatureC, 0b10000000, false, 2, 0);
  display.setSegments(celsius, 2, 2); delay(MTD-1000);
}


texts: Why can't I declare variables inside an if statement?

texts:
I have a void function that helps me set the time on my arduino clock. I need to use the same function twice - once for the alarm and once for the actual time. The variables I am defining need to equal either alarmHours and alarmMinutes, or hours and minutes. This was my solution:

void setting(int i){
 if(i==0){
  int mi=alarmMinutes;
  int ho=alarmHours;
 }else if(i==1){
  int mi=minutes;
  int ho=hours;
 }
//more code later
}

I got an error saying that ho and mi are undefined.
I fixed this like this:

void setting(int i){

 int mi;
 int ho;

 if(i==0){
  mi=alarmMinutes;
  ho=alarmHours;
 }else if(i==1){
  mi=minutes;
  ho=hours;
 }
}

This solved the problem. Why couldn't I use the first option if I passed in a 0 or a 1 to the parameters of the function?


texts:
Hello everyone. Does MFRC522 module read all 13.56 MHz RFID tags?
Or there are different types of the 13.56 MHz tags that the MFRC522 module reads only one type of them?


texts:
I am trying to create a server - node connection with NRF24L01+ chip and Mirf library with interrupts. It seem to work, but server does not seem to get reply from node. If I put it in the loop it receives. Can you check what is wrong with my code?
Server:

#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

typedef struct{
  long int packet;
  byte address[5];
}
Test;
Test Toolkit;

void setup(){
  Serial.begin(9600);
  Serial.println("Configuring NRF24L01+ module ...");
  Mirf.cePin = 9;
  Mirf.csnPin = 10;
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();
  Mirf.setRADDR((byte *)"clie1");
  Mirf.setTADDR((byte *)"serv1");
  Mirf.payload = sizeof(Test);
  Mirf.config();
  Serial.println("Configuring internal script variables ...");
  Serial.println("Setting system interrupts ...");
  Toolkit.packet = 9;
  attachInterrupt(0,wakeupFunction,FALLING);
}

void loop(){
  strcpy((char *)Toolkit.address,"CLI");
  Mirf.send((byte *)&Toolkit);
  while(Mirf.isSending()) { }
  //Mirf.setRADDR((byte *)"clie1");
  /*if(Mirf.dataReady()) {
    Mirf.getData((byte *)&Toolkit);

    Serial.println("Got data!");
    Serial.print("Packet number: ");
    Serial.println(Toolkit.packet);
  } else Serial.println("NO DATA");*/
  delay(1000);
}
void wakeupFunction() {
  //while(Mirf.isSending()) { }
  if(Mirf.dataReady()) {
    Mirf.getData((byte *)&Toolkit);
    Toolkit.packet = random(300);
  }
}

and this is client

#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

typedef struct{
  long int packet;
  byte address[5];
}
Test;
Test Toolkit;

void setup(){
  Serial.begin(9600);
  Mirf.cePin = 9;
  Mirf.csnPin = 10;
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();
  Mirf.setRADDR((byte *)"serv1");
  Mirf.setTADDR((byte *)"clie1");
  Mirf.payload = sizeof(Test);
  Mirf.config();
  Serial.println("Listening...");
}

void loop(){
  if(!Mirf.isSending() && Mirf.dataReady()){
    Serial.println("Got packet");
    Mirf.getData((byte *)&Toolkit);
    Serial.println("Packet number:");
    Serial.println(Toolkit.packet);
    Serial.println((char *)Toolkit.address);
    //Sending
    delay(50);
    Mirf.setTADDR((byte *)"clie1");
    Mirf.send((byte *)&Toolkit);
    while(Mirf.isSending()) Serial.println("Sending");
    Serial.println("Reply sent.");
  }
}


texts: Uploading new sketch to Leonardo-type boards when you've changed the HID mode

texts:
I have Sparkfun Pro Micro (Leonardo compatible board). I got it because I plan to build my own array of controls for use in flight/racing sims.

My starting point is LeoJoy, and I didn't have any trouble getting this up and running. Installed just fine, and I have a programmable HID joystick available in windows. It seems to work by modifying the RAWHID code in the default libraries to spoof being a HID joystick. However, my board was now stuck in joystick mode, with no available COM ports for uploading new sketches.

Resetting the board (by grounding the RST pin), enables the COM port, but very, very briefly. Not enough time to send new sketches.

After about an hour of trying different timing, I finally did upload an empty sketch to the board before it went into Joystick mode. So I'm good for now, but I'm a bit worried that I'm going to have to repeat this every time I want to make a change to my program.

Am I doing something completely noobish here? Is this the correct way to program a board that has been forced to act as a joystick? Is there a better way?

Perhaps there's some code I can put into my sketch that will delay the change of USB behavior for a few seconds. That way, it will allow me to recompile and submit my sketches after a reset without having to rush the timing.


texts: Error Performing HTTP GET request on google sheets (Apps Script) using TTGO T-CALL

texts:
I've tried using several libraries such as TinyGSM, SoftwareSerial, AT commands but I'm guessing the problem to be with my GET request url is https://script.google.com/macros/s/GAS_ID/exec?tag=1234&value=5678 and the Apps Script code is
   function doGet(e){
      Logger.log("--- doGet ---");

      var tag = "",
      value = "";

   try {

// for debugging
if (e == null){e={}; e.parameters = {tag:"test",value:"-1"};}

tag = e.parameters.tag;
value = e.parameters.value;

// save the data to spreadsheet
save_data(tag, value);

  return ContentService.createTextOutput("Wrote:\n  tag: " + tag + "\n  value: " + value);

   }
 catch(error) {
   Logger.log(error);
return ContentService.createTextOutput("oops...." + error.message
                                        + "\n" + new Date()
                                        + "\ntag: " + tag +
                                        + "\nvalue: " + value);
        }
      }

     // Method to save given data to a sheet
    function save_data(tag, value){
    Logger.log("--- save_data ---");

    try {

    // Paste the URL of the Google Sheets starting from https thru /edit
    // For e.g.: https://docs.google.com/..../edit
     var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/SPREAD_SHEET_ID/edit#gid=0");
var dataLoggerSheet = ss.getSheetByName("Sheet1");

// Get last edited row from DataLogger sheet
var row = dataLoggerSheet.getLastRow();

// Start Populating the data
dataLoggerSheet.getRange("A1").setValue(tag);
dataLoggerSheet.getRange("B1").setValue(value);
  //dataLoggerSheet.getRange("C" + row).setValue(tag); // tag
       /// dataLoggerSheet.getRange("D" + row).setValue(value); // value

    }

        catch(error) {
           Logger.log(JSON.stringify(error));
         }

         Logger.log("--- save_data end---");
          }

I've already tested the HTTP GET requests on other websites so there seems to be no problem with the device.
BTW this code (Apps Script) worked perfectly with nodeMCU with appropriate libraries and arduino code.
Please help me out.


texts: What are the FLASH_ARRAY/FLASH_TABLE macros in this code?

texts:
In this code for heating monitor, there appears to be macros called FLASH_ARRAY and FLASH_TABLE. I can't find any reference to them either in this code, Arduino, or on the Internet. What do they do?

FLASH_ARRAY(byte, VARIABLE_DEVICE_TABLE,
    DEVICE_LADDNING_RETUR,
    DEVICE_LADDNING_UT,
    DEVICE_TANK1,
    DEVICE_TANK2,
    ...
    VARIABLE_ID_LOAD,
    VARIABLE_ID_TIME_EMPTY);

and

FLASH_TABLE(byte, NUMBER_TEMP_TABLE, 7,
  {DEVICE_LADDNING_RETUR, 99,  5, 10,  7, MAIN_TYPE_TEXT_CELCIUS, 2},
  {DEVICE_LADDNING_UT,    99, 43, 10,  7, MAIN_TYPE_TEXT_CELCIUS, 2},
  ...
  {DEVICE_UTE,             0, 55, 15,  7, MAIN_TYPE_TEXT_CELCIUS_WITH_NEGATIVE, 103},
  {VARIABLE_ID_EFFECT,   114, 29, 10,  7, MAIN_TYPE_TEXT_VARIABLE, 2});


texts: Serial Monitor shows random texts While Reading Data from RTC DS3231 with Arduino Uno

texts:
I tried to set time on a RTC DS3231. After Uploading it with Arduino IDE, I try viewing the output in the Serial Monitor. However, if I start viewing the Serial Monitor, It starts showing encrypted lines. I have tried the example code and yet it shows the same.

The Setup code

#include <DS3231.h>
DS3231  rtc(SDA, SCL);

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

  rtc.begin();

  rtc.setDOW(SUNDAY);
  rtc.setTime(02, 17, 0);
  rtc.setDate(29, 03, 2020);
}

The loop code

void loop()
{
  Serial.print(rtc.getDOWStr());
  Serial.print(" ");

  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");

  Serial.println(rtc.getTimeStr());

  delay (1000);
}

The output Screen Shot is


texts:
I would like to read MUX 14 with the ADC.  On page 263 of the Atmega328 data  sheet it shows 1110b on the MUX corresponding with reading V_BG.

I need to read this so I can calibrate my sensor readings taken with the 5v reference to those taken with the 1.1v reference.  Because the 5v power supply may vary and the 1.1 is more stable, I need to be able to translate the readings taken with a 5v reference based on how the internal 1.1v is read.

Based on the code for analogRead, I wrote this:

int readVBG(int _analogReference) {
  uint8_t low, high;
  ADMUX = (_analogReference << 6) | 14;
  sbi(ADCSRA, ADSC);
  while (bit_is_set(ADCSRA, ADSC));
  low  = ADCL;
  high = ADCH;
  return (high << 8) | low;
}

_analogReference is either 1 or 3 depending on the reference voltage desired.

I expect to read 1023 when _analogReference is 3 and about 225 when _analogReference is 1.  Instead I get smaller values which I'm guessing are from a floating (unconnected) analog pin.


texts: Any disadvantages on using Particle Photon over an Arduino?

texts:
It seems to me like Photon is 'winning' on the price front and ease of programming and of course the cheap wifi connection.

I realize the cloud portion (even the local cloud server) could be considered a disadvantage, but what about things like ability to drive dc/stepper motors or some exotic sensor? Perhaps not enough analog and/or digital pins? etc..

One disadvantage I can think of is the lack of resources whereas the Arduino has a ton of references online with working with all kinds of motors and sensors.


texts: merge two loops in arduino uno?? compiled but not working

texts:
#include <Adafruit_Fingerprint.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
SoftwareSerial sms(2, 3);
SoftwareSerial mySerial(4, 5);
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

int electronic_lock = 8;
int numdata;
boolean started = false;
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
bool found = 0;
bool matched = 0;
int return_id;

uint8_t id;

void setup()
{
  pinMode(8, OUTPUT);
  Serial.begin(9600);
  while (!Serial);
  delay(100);
  // set the data rate for the sensor serial port
  finger.begin(57600);

  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor");
  } else {
    Serial.println("Did not find fingerprint sensor");
    while (1) { delay(1); }
  }

  finger.getTemplateCount();
  Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" template(s)");
  Serial.println("Waiting for valid finger...");

  sms.begin(9600);
  pinMode(8, OUTPUT);

  lcd.begin(20, 4);                     // Initialize 20X4 LCD and turn on backlight
  lcd.backlight();

  Serial.begin(9600);
  Serial.println("Adafruit finger detect test");

  // set the data rate for the sensor serial port
  finger.begin(57600);

  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1);
  }
  lcd.setCursor(0, 0);
  lcd.print("Biomatric Door Lock ");
  lcd.setCursor(0, 1);
  lcd.print("       System       ");

  delay(3000);
  lcd.clear();

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("**Place the finger**");

}

void loop()             // run over and over again
{
  getFingerprintIDez();
  delay(50);            //don't ned to run this at full speed.
}

int getFingerprintIDez() {
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;

  // found a match!
  Serial.print("Found ID #"); Serial.print(finger.fingerID);
  Serial.print(" with confidence of "); Serial.println(finger.confidence);
  digitalWrite(electronic_lock, HIGH);
  delay(1500);                        //Change the door lock delay from here
  digitalWrite(electronic_lock, LOW);
  Serial.println("Unlocked");
  return finger.fingerID;

  if (found == 1)
  {
    if (matched == 1)
    {
      lcd.setCursor(0, 1);
      lcd.print("***Access Granted***");
      digitalWrite(8, HIGH);
      delay(2000);
      digitalWrite(8, LOW);
      sms.print("0");
    }
    else
    {
      sms.print("1");
      lcd.setCursor(0, 1);
      lcd.print("***Access  Denied***");
      digitalWrite(8, LOW);
    }
  }
  else
  {
    lcd.setCursor(0, 0);
    lcd.print("**Place the finger**");

    lcd.setCursor(0, 1);
    lcd.print("                    ");
    lcd.setCursor(0, 2);
    lcd.print("                    ");
    lcd.setCursor(0, 3);
    lcd.print("                    ");
  }
  delay(50);
}


texts: Thermometer project shows fluctuation due to varying sensor value and voltage

texts:
I built this thermometer that reads the sensor value from the temperature sensor and displays it on the LCD display. It basically works fine, but the displayed temperature shows a fluctuation between +/-2 degrees due to varying sensor value and voltage every second.
(This is my very first Arduino project and I am pretty new to electronics.)
The Arduino gets the power via my Mac through USB.

When I check the sensor value and voltage, it slightly differs each second (or whatever delay interval I use in my code). Sensor value is between 123-125 and voltage usually 0.7, but also changes slightly, which causes the temperature calculation to vary around 2 degrees, which for a "thermometer" is quite a lot.

Is there any way to stabilize it? Should I use a capacitor or another resistor?

Code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const float powerSupply = 5.0;
const int sensorPin = A0;
const float baselineTemp = 23;

void setup() {
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.print("Temperature:");
}

void loop() {
  int sensorVal = analogRead(sensorPin);
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal);

  float voltage = (sensorVal/1024.0)*powerSupply;
  Serial.print(", Volts: ");
  Serial.print(voltage);

  Serial.print(", degrees C: ");
  float temperature = (voltage - .5)*100;
  Serial.println(temperature);

  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(temperature);
  // lcd.print(String(sensorVal) + ", " + String(voltage) + ", " + String(temperature));
  delay(1000);
}


texts:
I'm trying to use the Ethernet Shield and the EasyVR (voice recognition) together.
The Ethernet shield uses the same pins that the EasyVR, but the easyVR works fine if I don't call Ethernet.begin(). Is there a way to disconnect the ethernet shield in order to be able to use the EasyVR again?

I haven't seen any method like "release" or "disconnect" in the Ethernet's class.

Thanks!


texts: Issues with connecting XBee to Arduino Uno R3

texts:
I have an Arduino Uno R3, Wireless Proto Shield and a XBee XB24-AWI-001 all hooked together. I'm using X-CTU software to access the XBee and change the properties of it. I did a little research and found out that if I want to access the XBee, I have to connect the GND to the RST pin (on the Proto Shield) or hold the RESET button on the board. This method works and when I do that, I can find the XBee on X-CTU.

The question is - why do I have to do that? I'm probably wrong, but as far as I understand, if I have my Arduino connected to the computer, I'm accessing the ATmega microprocessor and that's the reason I can't access the XBee, but when I do the reset, I'm constantly resetting the microcontroller and that's the reason why I can access the XBee? Hopefully someone can explain this...

The link where I found the information about resetting (or removing) the ATmega microproccesor, Using Arduino to Connect Xbee Serial to Computer.


texts: Why does my analogRead work on Teensy but not Arduino Uno?

texts:
I have successfully made a voltage measurement circuit on my Teensy 3.1 that reads a voltage coming out of digital pin 0 set high and coming back into an analog pin A0 to read voltage.

Basically:

int timer = 100;
int ColA = 0;
int Output;

// Setting digital pin functions

void setup()
{
  Serial.begin(38400);
  pinMode(0, OUTPUT);

}

// Program

void loop()
{
  digitalWrite(0, HIGH);
  delay(timer);
  Output = analogRead(A0);
  Serial.println(Output);
  delay(timer);
}

It works fine with my circuit on a Teensy 3.1 running 3.3v however when i run this code on an Arduino Uno running 5v wired exactly the same way I just get this print out of numbers that cycles back and forth from ~128 down to 0 and back constantly.

Any insight on the differences here would be great. I need the 5v micro-controller to run a 4051 multiplexer!


texts: Sainsmart LCD 2004 - LiquidCrytal_I2C library issue unable to compile

texts:
I bought a Sainsmart LCD2004 from Amazon to use with my Arduino Uno.
I understand that since this LCD uses I2C a new library needs to be downloaded.

From the sainsmart website I dowloaded the LCD 2004 rar
http://www.sainsmart.com/arduino/arduino-shields/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.html

When I try to compile the example titled helloworld I get the following error:

In file included from HelloWorld.pde:3:
C:\Users\r_yob_000\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:81: error: conflicting return type specified for 'virtual void LiquidCrystal_I2C::write(uint8_t)'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'

There seems to be a conflict between two functions returning different types.

I've tried searching the issue and found a lot of posts with similar errors.
The solution suggested is usually that a new version of the LiquidCrytal_I2C needs to downloaded. Or that one should use Arduino IDE version 1.0

I have downloaded tons of LiquidCrytal_I2C libraries and tried them all on IDE version 1.0 and 1.0.6 and I still get the same error message. I've even tried changing the LiquidCrytal_I2C.h file so that it returns the correct type and still have no luck.

Could I please get some help with this issue.

Thank you very much.


texts: Error Compiling on raspberry Pi - no error details provided in IDE

texts:
I've just cracked out my Franzis Arduino Tutorial Kit (Best Xmas Present EVER!) and I'm already stuck on my second program.

I successfully wrote and executed a basic 'blink' program, however when I wrote out the second program provided in the manual I get an 'Error Compiling' when trying to check the syntax or run the program.

I tried the obvious of unplugging the board and plugging it back in but this didn't work. When I search for help most forum posts refer to the error message, however I have no message, just the orange warning bar stating 'Error Compiling'

This is the code;

// Franzis Arduino
// My second Arduino program

int ledPin = 13; //LED is connected with digital pin 13

// The setup routine configures the digital port
// This routine is executed only once at program start!

void setup()
{
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  Serial.printIn("Our second Arduino program");
  Serial.printIn();
}

// The main program is an infinate loop
void loop()
{
  Serial.print("5 + 188 yields");
  Serial.print(5+188);
  while(true)
  {
    digitalWrite(ledPin, HIGH); // Turn on LED
    delay(2000);                 // Wait for a second
    digitalWrite(ledPin, LOW);   // Turn off LED
    delay(2000);                 // Wait for a second
    continue;
  }
}

And here's a screenshot of the error message (or lack of);


texts: Scope of RtcDateTime object when declared outside of a function

texts:
I'm trying to merge 2 Arduino samples, in order to be able to use DS3231 RTC module with ESP8266 WiFi simple web server.

My RTC library is this:
https://github.com/Makuna/Rtc/wiki

Generally, to code runs ok (I have the Web server responses to my browser calls, and I think the DS3231 RTC code also works). But when I'm trying to use a variable from within the RTC object into the Web server function - I get nothing.

I thought declaring the 'now' object outside any function (Setup() nor Loop()) will make it global, and when I'll update it in the Loop() function using

now = Rtc.GetDateTime();

It will be available to other functions as well, but all I get is "0" when I try to print it.

My code is here:
Definitions part:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

/* This block is for I2C protocol for DS3231 module (for normal hardware wire use below) */
#include <Wire.h> // must be included here so that Arduino library object file references work
#include <RtcDS3231.h>
RtcDS3231<TwoWire> Rtc(Wire);
/* The above block is for I2C protocol and DS3231 module  (for normal hardware wire use above) */

ESP8266WebServer server(80);
RtcDateTime now;

My Loop():

void loop(void) {
  now = Rtc.GetDateTime();
  Serial.println(now.Minute());
  server.handleClient();
  delay(500);

}

And all I get is "0" printed.

Any help would be appreciated!


texts:
Folks.
I'm working on an ESP8266 and keen to switch to using:

an object approach -> sorted;
physical interrupts on the hardware pins -> sorted;
timer interrupts -> driving me crazy!

My problems are that:

There are so many timer libraries
I can't find one that works on my set-up; either they don't compile, or they have unfulfilled dependencies
Some look promising, but then it turns out something needs to be polled to see if the timer has triggered

Can anyone help me out here please?  I just want a straight-forward approach to setting a simple timer on the 8266 that will trigger an ISR where I can switch off an output now and then tidy up later.

Regards, David (Southampton)


texts: delete the memory or re-upload a program

texts:
At the moment I am following the instructions of this project https://github.com/JoernL/LimiTTer. Besides the peripheral parts like a Bluetooth module and an NFC module, the central unit is an Arduino Pro Mini.
I am a bloody novice with Arduino and just taught myself how to solder stuff. So far, I successfully uploaded the program from the project above to the Arduino Mini Pro and will continue as soon as the other parts arrive.

Anyhow, since I am strictly following the instructions I have some serious knowledge gaps and hope you can help me out. So, for instance.

How do I know, how much storage capacity is available on the Arduino board before and after I uploaded something?
How can I delete a program from the Arduino board?
When I upload a program, will the program that is already on the Arduino been overwritten?
Is an Arduino generally used to execute one specific program and not to hold a set of totally different programs?


texts:
Why is a toroidal inductor being used in the RFID reader described in DIY FSK RFID Reader?

I feel that a toroidal inductor wouldn't be very effective in grasping the changes in electromagnetic field changes.


texts:
Hi all I use 2 sensors and 2 led strips. I want to let both led strips light up without interrupting each other while reading the different values from the inputs. But Arduino still pauses when one lights up, the other one needs to wait for the time to pass, either one misses reading the value when one is processing the output.

I know delay(wait); makes it block out the coming data, but it lets the strips light up for 6 seconds. If I remove it, the strips will light one 1 second only. What should I do? Thanks so much!

#include <Adafruit_NeoPixel.h>
#define PIN 6
int ledFadeTime = 7;
Adafruit_NeoPixel strip3 = Adafruit_NeoPixel(60, 9, NEO_GRB +NEO_KHZ800);//led pin
Adafruit_NeoPixel strip4 = Adafruit_NeoPixel(60, 7, NEO_GRB + NEO_KHZ800);//led pin
const int sensorPin3 = A2;//motion sensor
const int sensorPin4 = A3; //flash sensor

unsigned long strip3OnTime;
unsigned long strip4OnTime;
bool strip3On;
bool strip4On;
unsigned long previousMillis = 0;
const long interval = 1000;

void setup() {

  Serial.begin(9600);
  strip3.begin();
  strip3.show();
  strip4.begin();
  strip4.show();

  strip3On = false;
  strip4On = false;
}

void loop(){
 int Val3 = analogRead (sensorPin3); // sensor val
 int Val4 = analogRead (sensorPin4);

 Serial.print(Val3);
 Serial.print(" ");
 Serial.println(Val4);

   if (Val3>70) {
     rgbFadeInAndOut3(0, 0, 255, ledFadeTime);
     //analogWrite(strip3, HIGH);
     strip3On = true;
     strip3OnTime = millis();
   }
   if (Val4>70) {
     rgbFadeInAndOut4(0, 0, 255, ledFadeTime);
     //analogWrite(strip4, HIGH);
     strip4On = true;
     strip4OnTime = millis();
   }

   if(strip3On)
     if(millis() - strip3OnTime > 7000) {
       rgbFadeInAndOut3(0, 0, 1, 5000);
       strip3On = false;
     }
   if(strip4On)
     if(millis() - strip4OnTime > 7000) {
       rgbFadeInAndOut4(0, 0, 1, 5000);
       strip4On = false;
     }
 }

 void rgbFadeInAndOut3(uint8_t red, uint8_t green, uint8_t blue, uint8_t wait) {
   unsigned long currentMillis = millis();
   if (currentMillis - previousMillis >= interval){
     previousMillis = currentMillis;

   for(uint8_t b = 0; b <255; b++) {
      for(uint8_t i=0; i < strip3.numPixels(); i++) {
         strip3.setPixelColor(i, red * b/255, green * b/255, blue * b/255);
       }
      strip3.show();
     delay(wait);
   };

   for(uint8_t b=255; b > 0; b--) {
      for(uint8_t i = 0; i < strip4.numPixels(); i++) {
         strip3.setPixelColor(i, red * b/255, green * b/255, blue * b/255);
      }
      strip3.show();
      delay(wait);
   };
 };
 }
 void rgbFadeInAndOut4(uint8_t red, uint8_t green, uint8_t blue, uint8_t wait) {
    unsigned long currentMillis = millis();
    if (currentMillis - previousMillis >= interval){
     previousMillis = currentMillis;

   for(uint8_t b = 0; b <255; b++) {
      for(uint8_t i=0; i < strip4.numPixels(); i++) {
         strip4.setPixelColor(i, red * b/255, green * b/255, blue * b/255);
      }
      strip4.show();
      delay(wait);
   };

   for(uint8_t b=255; b > 0; b--) {
      for(uint8_t i = 0; i < strip4.numPixels(); i++) {
         strip4.setPixelColor(i, red * b/255, green * b/255, blue * b/255);
      }
      strip4.show();
      delay(wait);
   };
 };
 }


texts:
I have written a code that displays a number into a seven segment display without manually setting the Arduino pins HIGH/LOW for each number. Now, my problem is how can I display a number larger than 9? This is my code and it works for only 1 digit number: (The seven segment display truth table is inverted because I'm using common anode 7seg)

#define SEG_A 2
#define SEG_B 3
#define SEG_C 4
#define SEG_D 5
#define SEG_E 6
#define SEG_F 7
#define SEG_G 8
#define DEC_P 12

#define SET1 9 // [!][!][x]
#define SET2 10// [!][x][!]
#define SET3 11// [x][!][!]

struct segmentmap {
  uint8_t num;
  const int segment[7];
};

const struct segmentmap segments[] = {
  // n   A  B  C  D  E  F  G
  {0, {0, 0, 0, 0, 0, 0, 1}},
  {1, {1, 0, 0, 1, 1, 1, 1}},
  {2, {0, 0, 1, 0, 0, 1, 0}},
  {3, {0, 0, 0, 0, 1, 1, 0}},
  {4, {1, 0, 0, 1, 1, 0, 0}},
  {5, {0, 1, 0, 0, 1, 0, 0}},
  {6, {0, 1, 0, 0, 0, 0, 0}},
  {7, {0, 0, 0, 1, 1, 1, 1}},
  {8, {0, 0, 0, 0, 0, 0, 0}},
  {9, {0, 0, 0, 1, 1, 0, 0}}
};

void setup() {
  Serial.begin(9600);
  for (int x = 2; x <= 8; x++) {
    pinMode(x, OUTPUT);
    Serial.print("Segment pin: ");
    Serial.print(x);
    Serial.println(" is set to OUTPUT mode.");
    digitalWrite(x, HIGH);
  }
  pinMode(DEC_P, OUTPUT);
  pinMode(SET1, OUTPUT);
  pinMode(SET2, OUTPUT);
  pinMode(SET3, OUTPUT);
  digitalWrite(SET1, 1);
}
int x = 0;
void loop() {
  if (x > 9) {
    x = 0;
  }
  updateDisplay(x);
  delay(1000);
  x++;
}

void updateDisplay(int input) {
  for (int x = 0; x <= 9; x++) {
    //Serial.println(segments[x].num);
    if (segments[x].num == input) {
      Serial.println(segments[x].segment[0]);
      ////////////Simplify this part//////////////
      digitalWrite(SEG_A, segments[x].segment[0]);
      digitalWrite(SEG_B, segments[x].segment[1]);
      digitalWrite(SEG_C, segments[x].segment[2]);
      digitalWrite(SEG_D, segments[x].segment[3]);
      digitalWrite(SEG_E, segments[x].segment[4]);
      digitalWrite(SEG_F, segments[x].segment[5]);
      digitalWrite(SEG_G, segments[x].segment[6]);
      ////////////////////////////////////////////
      //Multiplex here?//
    }
  }
}


texts: Find which WiFi device quiries a network?

texts:
1) What additional hardware sensors will be required for it?

2) What software components one shall develop to capture devices broadcasted network names?

Looking at WiFi library can not get what one can utilize for such task: there is sample on scanning yet no samples of capturing such scans


texts:
i have problem with change srting to array
my string input is like this B109DAE1B71B638E it come from Serial.readString
and i want to change this string to array byte like this
byte in01[] = { 0xB1, 0x09, 0xDA, 0xE1, 0xB7, 0x1B, 0x63, 0x8E };


texts: WifiEsp client TIMEOUT when put on a loop

texts:
Hello I have been using the WifiEsp to send and receive data from Thingspeak.
All is well until I put my http request on the Void Loop() section.

My Goal: I want to receive data every loop not on only on setup.
Here is my code

#include <WiFiEsp.h>
#include <WiFiEspClient.h>
#include <SoftwareSerial.h>
SoftwareSerial Serial1(6, 7); // RX, TX
WiFiEspClient  client;
int status = WL_IDLE_STATUS;

#define SSID "Benok4G"
#define PASS "password"
char reply;
char server[] = "184.106.153.149";

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial1.begin(9600);
WiFi.init(&Serial1);
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");

}

void loop() {
Serial.println();
Serial.println("Receiving Data...");
if (client.connect(server, 80)) {
Serial.println("Connected to server");
client.println("GET /channels/344468/fields/3/last?key=ABCDEFGH
HTTP/1.1");
client.println("Host: api.thingspeak.com");
client.println("Connection: close");
client.println();

while (client.available()) {
char c = client.read();
Serial.write(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("Disconnecting from server...");
client.stop();
while(true);
 }
}

I can receive the letter "a" properly. However, I want it too loop and give me updated value every loop.

BUT! when I put the code from the void setup() to the the void loop().
I get this error..

Any ideas on how can I loop it without getting the error? I tried adding delays and putting it on another function, still the same. It will only work when I put in inside the void setup()

Thanks!


texts: Arduino 1.6.1 IDE with Teensyduino Serial port lag issue?

texts:
OS: Ubuntu 14.04
Board: Teensy 3.1 and Arduino UNO

I've ran many tests and concluded that the issue is within the Arduino IDE itself.

The issue: Instead of a smooth stream of data displaying from the serial port, the terminal displays big chunks of data periodically.

I tested it with minicom and the stream of data is smooth.

Any solutions?


texts: While making a Arduino programmed maze runner Will bipolar motor shield be more beneficial than using tb6612fng motor shield???? Also which type of sensors will be better??


texts: Arduino: using digital pins to emulate USB device

texts: Is there any "easy" way to emulate USB keyboard or gamepad using digital pins on Arduino Mega? I looked at Uno-Joy/Mega-Joy, but I dont find firmware changes appealing.


texts: Wrong data from DS18B20 temperature sensor after long power off

texts:
I have my Arduino Uno connected to the PC via USB when prototyping.  I am developing a thermometer with memory, using DS18B20 sensors.

When PC is shut down, there is no power on the USB and the Arduino is off. Sometimes, when my PC is turned off for several hours and then, when I turn it on, the Arduino is started, but it behaves "strange" - the program is showing buggy values on the display, looking like if there is some bug in the sketch. However, when I upload the sketch again, it works fine.

The buggy values are the averages for the run, computed simply by summing a float and dividing by int. What I see is e.g. instead of seeing something around 23.5 I see 85.1. The current values read from the sensor look OK (show 23.5 as expected), but I cannot tell for sure if perhaps some value read early might be wrong.

It is not easy to reproduce, I see it only sometimes, always when powering Arduino on after several hours without power.

My first idea is either the sketch got corrupted during the long power down, or variables are initialized wrong, and the sample sum / sample count is not zero.

However I though the sketches are uploaded into the Flash RAM, which should be non-volatile according to the docs. Is there something obvious I am missing, some explanation why is the sketch working differently after long power down?


texts:
In my project I need to add some storage space and I don't want to use an SD card, because in the "final product" the user shouldn't be able to access the data on their own.

So I was considering the options here http://playground.arduino.cc/Main/InterfacingWithHardware#Storage but many of the technologies are either outdated, for example as reads here ADESTO is discontinuing production of dataflash, or they give too little memory, like the I2C EEPROM (which is 128KByte per chip and I would rather not go through the hassle of multiplexing lots of memory chips since I'd like to have 1MByte of storage at least), or are extremely overpriced and cannot be found on retail: some sites require you to buy 2000$ worth of chips or charge you 30$ for delivery, which kind of kills the fun of prototyping something.

I know I am being picky not wanting to use an SD for the prototype, but I would like to know if you ever faced this problem and how you solved it, or if you know some alternative solution which gives a good amount of memory (~1 or 2 MBytes at least) within reasonable costs.


texts: Using 2 RGB lights over Bluetooth with a DigiSpark

texts:
I'm not that experienced with electronics but I am learning. And I've set a challenge for myself. I have a Digispark USB Development board (and many more but I want to use this one!), I have a Bluetooth module and I have two RGB LEDs which I want to control over the Bluetooth connection. Each LED has to be controlled separately and I want to be able to set each color separately and be able to mix about 256x256x256 colors. Which means, PWM connections. The Bluetooth connection would listen to instructions, receiving four bytes containing RGB values and a value between 0 and three to pick which light needs to be set. (0=None, 1=left, 2=right, 3=both)
Also important is that it needs to be small. It will end up in a container of of roughly 3x3x10 CM in size. (Slightly bigger than 1x1x3 inch.)

The challenge is that Digispark only has 6 pins available so that's not enough to handle this all. I could use three pins and use a 74HC165N Shift Register but that would just turn each color on or off, thus limiting me to 8 colors. That's not good enough! Besides, I also need to connect the four pins of the Bluetooth module.

So my question is simple: What would I need more to build this project? To send the proper six analog signals while having enough pins to handle the Bluetooth datastream?


texts:
I purchased this CO2 sensor a while back: SainSmart MG811 Gas CO2 Carbon Dioxide Sensor Module Sensor Module for Arduino UNO R3 Raspberry Pi

The module has four pins, Vin, GND, Dout and Aout. I assume Dout and Aout are digital output and analog output, respectively.

Other than that, the sensor came with no datasheet, instructions, or tutorial. I also searched online but fail to find anything useful.

I'm going simple for now, just hooking up the sensor module to Arduino board. I know I can probably connect the output pins to the analog pins, and analogRead them, but what I am looking for is how to convert the raw data readings into CO2 levels in PPM. Like a formula.

Also, I'm curious as to how the digital output works...


texts: Module light is blinking/working but it's not showing for pairing in my smart phone.I have supplied it 3.3 volts and have tried different phones.


texts: Can Only Upload Arduino Sketch Once to Custom Mega2560 Board

texts:
I created a custom Arduino based off the Mega2560 R3. It uses the ATMega16U2 uC as the USB interface between ATMega2560 uC and the PC.
The bootloader on the 2560 is uploaded by using an Arduino Micro via ArduinoISP. I followed this tutorial from Instructables on uploading the bootloader/firmware for the 16U2 except I modified some parts for the 2560 instead of the UNO. Here is my added section in the /program Files (x86)/Arduino/hardware/arduino/avr/boards.txt
unorestore.name=MEGA2560 16U2 Restore Firmware
unorestore.bootloader.tool=arduino:avrdude
unorestore.bootloader.low_fuses=0xff
unorestore.bootloader.high_fuses=0xd9
unorestore.bootloader.extended_fuses=0xf4
unorestore.bootloader.file=Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex
unorestore.bootloader.unlock_bits=0x3F
unorestore.bootloader.lock_bits=0x0F
unorestore.build.mcu=atmega16u2
unorestore.build.f_cpu=16000000L
unorestore.build.board=uno.build.board=AVR_MEGA2560
unorestore.build.core=arduino:arduino
unorestore.build.variant=standard

The problem is after I upload a sketch (with a size say over 10 kB), I can't upload any new sketch and get this timeout error message instead as shown below. Not even a simple blink sketch. The TX and RX LED connected to the 16U2 uC that flashes during an sketch upload doesn't even blink once.

The only way I can get it take another sketch is to "re-flash" the bootloader on the 2560 uC via ArduinoISP. The TX and RX led now flashes during the sketch upload. Of course, this is a huge hassle as I don't want to do "re-flash" the 2560 bootloader every time I want to upload a sketch.
I don't have this problem on my Elegoo Mega2560 R3 clone board so I'm thinking it might be something wrong with my 16U2 firmware/bootloader. Anyone have any idea what else might be causing this?


texts:
I have a problem regarding a Nokia 5110 LCD display. I am currently building a soldering station based on a PID controller. The original code was using a 7 segment display and I adapted the code to the Nokia display.

The problem is that when I rotate the potentiometer, the "read temp" and "set temp" is showing the exactly the same number, and after I finish rotating the potentiometer, the values return to their normal number.

How can I solve this problem ?

This is my code: https://pastebin.com/inPtkniX

This is the original project: https://www.allaboutcircuits.com/projects/do-it-yourself-soldering-station-with-an-atmega8/

//Soldering station Software using PID
//Thank you Alex from https://geektimes.ru/ for help with led array function
//AllAboutCircuits.com
//epilepsynerd.wordpress.com

#include <PID_v1.h>
#include <PCD8544.h>

PCD8544 lcd;
unsigned long updaterate = 500; //Change how fast the display updates. No lower than 500
unsigned long lastupdate;
int temperature = 0;
//Define Variables we'll be connecting to
double Setpoint, Input, Output;
//Define the aggressive and conservative Tuning Parameters
double aggKp = 4, aggKi = 0.2, aggKd = 1;
double consKp = 1, consKi = 0.05, consKd = 0.25;
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint, consKp, consKi, consKd, DIRECT);

void setup() {
  lcd.begin(84, 48);
  //We do not want to drive the soldering iron at 100% because it may burn, so we set it to about 85% (220/255)
  myPID.SetOutputLimits(0, 220);
  myPID.SetMode(AUTOMATIC);
  lastupdate = millis();
  Setpoint = 0;
}

void loop() {
  lcd.clear();
  //Read temperature
  Input = analogRead(0);
  //Transform the 10bit reading into degrees celsius
  Input = map(Input, 0, 450, 25, 350);
  //Display temperature
  if (millis() - lastupdate > updaterate) {
    lastupdate = millis();
    temperature = Input;
  }
  //Read setpoint and transform it into degrees celsius(minimum 150, maximum 350)
  double newSetpoint = analogRead(1);
  newSetpoint = map(newSetpoint, 0, 1023, 150, 350);
  //Display setpoint
  if (abs(newSetpoint - Setpoint) > 3) {
    Setpoint = newSetpoint;
    //temperature = newSetpoint;
    lastupdate = millis();
  }
  double gap = abs(Setpoint - Input); //distance away from setpoint
  if (gap < 10) {
  //we're close to setpoint, use conservative tuning parameters
    myPID.SetTunings(consKp, consKi, consKd);
  } else {
    //we're far from setpoint, use aggressive tuning parameters
    myPID.SetTunings(aggKp, aggKi, aggKd);
  }
  myPID.Compute();
  //Drive the output
  analogWrite(11, Output);
  //Display the temperature
  show(temperature, newSetpoint);
}

void show(int value, int newspnt) {
  lcd.setCursor(0, 0);
  lcd.print("READ TEMP");
  lcd.setCursor(0, 1);
  lcd.print(value);
  lcd.setCursor(0, 2);
  lcd.print("SET TEMP");
  lcd.setCursor(0, 3);
  lcd.print(newspnt);
  delay(200);
}


texts:
I am attempting to send data from my Arduino to my computer using the WiFi shield.  However, my code is erroring out on UDP.endPacket(), and I do not understand why.  Here is my code:

#include <WiFi.h>
#include <WiFiUDP.h>

int status = WL_IDLE_STATUS;
char ssid[] = "NETGEAR31"; //  your network SSID (name)
char pass[] = "oddearth926";    // your network password (use for WPA, or use as key for WEP)

char  ReplyBuffer[] = "acknowledged";       // a string to send back

WiFiUDP Udp;

void setup()
{
  //Initialize serial and wait for port to open:
  Serial.begin(9600);

  // 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 SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
  }
  Serial.println("Connected to wifi");
  printWifiStatus();
  Serial.println("\nStarting connection to server...");
  if(!Udp.begin(8765))
  {
    Serial.println(F("failed"));
  }

  // if you get a connection, report back via serial:
}

void loop()
{
  IPAddress ip(10,0,0,5);
  int port = 8766;
    // send a reply, to the IP address and port that sent us the packet we received
    if(!Udp.beginPacket(ip, port))
    {
      Serial.println(F("Failed beginning packet"));
    }
    Udp.print(ReplyBuffer);

    if(!Udp.endPacket())
    {
      Serial.println(F("Failed ending packet"));
    }
}

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

And here is the log:

Attempting to connect to SSID: NETGEAR31
Connected to wifi
SSID: NETGEAR31
IP Address: 10.0.0.34
signal strength (RSSI):-63 dBm

Starting connection to server...
Failed ending packet
Failed ending packet
Failed ending packet
Failed ending packet
Failed ending packet
Failed ending packet

It will continue to spit out "Failed ending packet" until I stop it.  Any ideas?


texts:
When passing the pin number in pinMode its possible to use A0 - A7, does it apply only to that methode?
How can pinMode expect a number (is it int?) type in case of digital pin another (is it then string?) in case of analog pin?
I want to use that in my class methode, is there a way to use that and have my code more readable or should I use the pin numbers?
P.S. I have tried to read the source code but I don't understand the uin8_t (I know its a byte, but not how it can understand A5 as an int)

Tnx a lot


texts: SIM900A Module doesn't send SMS to user anymore, after previously working

texts:
I'm trying to make a hydroponics project that collects data from sensors and sends it to the user through SMS every 15 minutes. However, when I try to run tests now, the pump part of the code works perfectly fine but the earlier part of the code that deals with sending the SMS doesn't work. I've tested the sim module by itself and it works, so it's not a hardware problem. What seems to be the problem here?
#include <SoftwareSerial.h>
#include <DHT.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <EEPROM.h>
#include <GravityTDS.h>
#include <Servo.h>

#define ONE_WIRE_BUS 5
#define DHTPIN 7
#define DHTTYPE DHT11
#define TdsSensorPin A1
#define PUMPPIN 11

SoftwareSerial mySerial(9, 10);
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DHT dht(DHTPIN, DHTTYPE);
GravityTDS gravityTds;
Servo myservo;

char msg;
char call;

void setup()
{
  mySerial.begin(9600);   // Setting the baud rate of GSM Module
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  dht.begin();

  sensors.begin();

  gravityTds.setPin(A1);
  gravityTds.setAref(5.0);
  gravityTds.setAdcRange(1024);
  gravityTds.begin();

  myservo.attach(PUMPPIN);
}

void loop()
{
  const unsigned long SECOND = 1000;
  const unsigned long MINUTE = 60*SECOND;
  const unsigned long HOUR = 60*MINUTE;

  delay(30L * SECOND);
  int h = dht.readHumidity();
  float t = dht.readTemperature();
  float tdsValue = 0;
  float temperature = t;
  gravityTds.setTemperature(temperature);
  gravityTds.update();
  tdsValue = gravityTds.getTdsValue();

  sensors.requestTemperatures();

  mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  mySerial.println("AT+CMGS=\"+************\"\r"); // Replace x with mobile number
  mySerial.print(h);// The SMS text you want to send
  mySerial.print("% humidity, ");
  mySerial.print(t);
  mySerial.print(" degrees Celsius air temperature, ");
  mySerial.print(sensors.getTempCByIndex(0));
  mySerial.print(" degrees Celsius water temperature, ");
  mySerial.print(tdsValue,0);
  mySerial.print(" ppm");

  delay(100);
  mySerial.println((char)26);// ASCII code of CTRL+Z
  delay(1000);

  myservo.write(0);   //Clockwise maximum speed rotation
    delay(30L * SECOND);
  myservo.write(90);
  delay(15L * MINUTE);
}


texts:
I've recently purchased a no-brand 1€ ATtiny programmer off eBay, and with the ridiculous price obviously came no documentation nor support from the seller.

At first I thought that using it with the Arduino IDE would have been as simple as plugging and programming, but no default lib worked. My hopes definitely crumbled when I realized the device wasn't even being picked up by Debian, showing instead this in the logs:

kernel.info: [ 2758.501968] usb 6-3: new low-speed USB device number 2 using ohci-pci
kernel.err: [ 2758.641798] usb 6-3: device descriptor read/64, error -62
kernel.err: [ 2758.885515] usb 6-3: device descriptor read/64, error -62
kernel.info: [ 2759.125231] usb 6-3: new low-speed USB device number 3 using ohci-pci
kernel.err: [ 2759.265065] usb 6-3: device descriptor read/64, error -62
kernel.err: [ 2759.508779] usb 6-3: device descriptor read/64, error -62
kernel.info: [ 2759.748500] usb 6-3: new low-speed USB device number 4 using ohci-pci
kernel.err: [ 2760.156027] usb 6-3: device not accepting address 4, error -62
kernel.info: [ 2760.291871] usb 6-3: new low-speed USB device number 5 using ohci-pci
kernel.err: [ 2760.699382] usb 6-3: device not accepting address 5, error -62
kernel.err: [ 2760.699421] usb usb6-port3: unable to enumerate USB device

and with lsusb outputting this:

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 07d1:3c0a WiFi Dongle
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 045e:0745 Mouse/Keyboard BT Dongle
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Reading up on the subject seemed to confirm that it was something I shouldn't have bought, and the closest I've got to a better understanding was with this question (link) which I can't comment.

So building up on the answer there, can anyone please explain a bit more in detail what for and where micronucleus would be needed?

Alternatively, is it possible to go with something as easy as installing the drivers and plugging it into the Arduino IDE?


texts:
Is there a way to test whether the UART Tx buffer is empty without waiting?

serial.flush() waits, so it won't help me.

I tried looking into serial.SerialEvent(), but the link was broken on the Arduino reference page.

Can anyone point me to a description of it?


texts: What is the use of noTone() function as the duration for which the note must be played can be specified using the third argument of note() function.


texts: If I have a group of Arduinos connected via I2C, can one Arduino cause the rest to freeze?

texts:
I have a group of four Arduino boards connected via I2C.  One is the master, which sends and receives values from all of the others.  I noticed that the Master will stop executing its loop if power is removed from one of the other Arduino boards.

Can one Arduino in a I2C group cause the rest to freeze?
Is there a way to prevent this?

I am using one of the Arduino boards to connect to a server via network shield and I don't want the other Arduino boards to be effected if the networked Arduino freezes.


texts: Finding connectors for push button component

texts:
What type of connectors would I use for these buttons?:

http://www.adafruit.com/product/1477

They sell wires with the connectors already crimped on, but I only need the connectors.

I found https://www.jameco.com, but i'm not sure which connector would be right, or what to look for specifically.


texts: Does old/low charge battery affects internal clock?

texts:
Totally newbie in eletronics here, but could not find the answer for this one.

When a battery is nearly-exhausted, it's voltage and or amperage dims, right?

My question is if this kind of scenario (running low battery) would affect the arduino internal clock using only it.

I'm using arduino to a device that will operate remotely (with a 9V battery), and also logs intervals using the time function.

If battery is near-exhausted, then will this skew the numbers I get?


texts: How do I program a non-Atmel chip with the Arduino IDE?

texts:
I have been working with Ardiono and esp8266 to develop a IOT project. Everything is going perfect.

Now I want to make use of a new chip i.e. the High-Flying SIP120 WiFi chip.

But I dont know how to make this chip support my Arduino code.

I have multiple big codes written using Arduino libraries and Arduino IDE already.

Any Help is appreciated. Thank you.


texts: why sound appears between VCC and GND pins in esp8266 module?

texts:
When I use esp8266 as STATION mode and connect a speaker between VCC(3.3v) and GND pin a sound appears like "doop doop". what is this sound?
I test this in version 01 and 12 of esp8266 module and this appear in both versions.
maybe you ask me why I connect speaker to this pins. problem is that when I use pwm of esp8266 for playing a sound, this sound ("doop doop") appear to it also.
What is problem? How can I fix this?


texts: LED Strobe based on switch press through Arduino

texts:
I have a problem I can't see to solve. I'm trying to program my Arduino, which I just got. I have read a lot of programming scenarios, but can't seem to find one that fits my problem.

I can get the LED to turn off and on like I want.

Assume a switch is pressed or even two wires to the LED are put together. Once the switch is pressed I'd like the LED to flash briefly, even though the LED has power to it. Is there a way to do this with Arduino code?

(1) Press switch
(2) Flash LED briefly
(3) Switch is still being pressed
(4) LED remains off until switch is pressed again
(5) loop through routine again.


texts: Using ESP32-CAM (with ov2640 camera image sensor) to send image via USB

texts:
I was trying to obtain image from ESP32-CAM (with ov2640 camera image sensor).

I obtained the image through camera web server by connecting the ESP32-CAM and PC to same wifi network. A USB to TTL module was used to interface ESP32-CAM to PC.

Program was uploaded to ESP32-CAM using arduino IDE

Reference video: https://www.youtube.com/watch?v=U5uvl6kDFJY

ESP32-CAM development board and ov2640 CMOS image sensor: https://i.stack.imgur.com/0Fa2W.jpg

CP2102 USB to TTL module:  https://i.stack.imgur.com/Zr0YV.jpg

Since this system involved wifi I had some serious trouble in obtaining the image:

Entering wifi credentials
Connecting the ESP32-CAM and PC to same wifi network
with variations in wifi speed image display lags which is the main problem

So I was hoping to transfer the image from ESP32-CAM to PC via USB just like connecting a USB webcam to PC.

Can anyone please help to find a solution?


texts:
I have set up Timer2 to count every tick at 16MHz, or 62.5ns per tick. Then I run the following code:

int t = 0;
    for (int i=0;i<64;i++){
  data[4*i] = TCNT2;
  data[4*i+1] = TCNT2;
  byte now = data[4*i+1];
  byte last = data[4*i];
  t += now > last? (long)(now-last) : 256 -(long)(last-now);
  data[4*i+2] = TCNT2;
  data[4*i+3] = TCNT2;
  }
}
for (int i=0;i<255;i++){
  Serial.println(data[i]-data[i+1]);
}

and I get the output: "4 4 4 11" (repeated) which makes sense, 4 clock cycles to read TCNT2 and write it to the correct place in data and 11 cycles when also evaluating the loop condition. However, I can't understand when the variable t is updated. I have tried running with and without t and both give the same timings. From my (obviously lacking) understanding updating a variable is at minimum one instruction, so how can it do it under one clock cycle? Am I misunderstanding what one instruction is or does the TCNT2 counter for the timer not update accurately here?


texts: Developing Standalone Arduino GUI Controller

texts:
I am rather new to using an Arduino.
As a part of my Graduate-Level Chemistry research, I am trying to further the development of a cheap DIY, open-source, Flow Chemistry Syringe pump system.

The device utilizes Stepper Motors, Step Motor control boards, an Arduino Uno, and a 3D printed Pump frame. Simple code was previously developed using the Arduino IDE. I have expanded on this a bit to allow for more customization (syringe size, mostly). The limitation here, is that the Serial Monitor inputs will be taxing to the users. I need to develop a simple GUI that allows for all of the inputs I need (syringe size, flow (step) rate, start and stop functions, etc.). I need this gui to be a standalone application that can be easily shared (no need to download anything extra, no installations, deploy-able on at LEAST Win and Mac).

Our labs goal is to develop a system that is easy to use and distribute, reducing the costs associated with using Flow Chemistry. I have a decent understanding of Arduino IDE, and I am willing to learn whatever I need to make this work.

I have seen a few things about Python, and 'Processing', but they seem to require the simultaneous use of Arduino IDE which would make deployment too complicated.

How should I approach this? What language do I need to learn? What advice do you have?


texts: Can I do speech to text converting with arduino?

texts:
I am a beginner to arduino. I want to make such a robot that can convert my speech into text and save the texts in a .txt file in the SD card attached to my arduino.
Can I do so? If it is possible please someone give me the instruction. Someone help me please...


texts: Loop code without manually pressing the button

texts:
In a piece off code I am modifying I have a button connected to start the code and then it resets its self afterwards. Is they a way to make the arduino loop that code without manually pressing the button again?

This is a section off the code:

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif
#define PIN 6
#define BUTTON_PIN 9

Adafruit_NeoPixel strip = Adafruit_NeoPixel(120, PIN, NEO_GRB + NEO_KHZ800);

bool oldState = HIGH;
int showType = 0;

void(* resetFunc) (void) = 0; //declare reset function @ address 0

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  // Get current button state.
  bool newState = digitalRead(BUTTON_PIN);

  // Check if state changed from high to low (button press).
  if (newState == LOW && oldState == HIGH) {
    // Short delay to debounce button.
    delay(20);
    // Check if button is still low after debounce.
    newState = digitalRead(BUTTON_PIN);
    if (newState == LOW) {
      showType++;
      if (showType > 9)
        showType=0;
      startShow(showType);
    }
  }

  // Set the last button state to the old state.
  oldState = newState;
}

void startShow(int i) {
  colorWipe(strip.Color(75, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 75, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 75), 50); // Blue
  theaterChase(strip.Color(75, 75, 75), 50); // White
  theaterChase(strip.Color(75, 0, 0), 50); // Red
  theaterChase(strip.Color(0, 0, 75), 50); // Blue
  rainbow(20);
  rainbowCycle(20);
  theaterChaseRainbow(50);
  resetFunc();  //call reset
}

Thanks Reece


texts: Why does my Wemos D1 Mini stops working while charging via solar?

texts:
I'm using an battery shield to recharge my battery. I want to use a solar panel, so I bought one (5V 240mA). I'm pretty sure, it won't recharge my battery fully, but that's not the point.
I've assembled my board with my shield, soldered the solar panel together with an schottky-diode and put it on USB (since the shield allows charging via USB). All fine, I get some electric power in the sun - yeah!
But my Wemos D1 Mini only runs for say 2-3 minutes and than ... dead? Restarting works, but only lasts again 2-3 minutes. This only happens while the battery shield is charging via solar. I already tested using any USB charging (my computer) - this simply works.
Basically I rebuild the circuit like described on TheAustrian/Wemos-D1-Mini-BME280-Weather-Station but only one solar panel attached and using the Wemos D1 Mini Battery Shield instead of the TP4056.
Any hints what's going on? Why can't I run the board while charging via solar? Did I miss something?


texts:
I want to get JSON string from a URL which goes like this

  https://maps.googleapis.com/maps/api/directions/json?origin=7649+Paseo+Santa+Cruz&destination=SJSU&key=MY_API_KEY

and here is my code:

#include <Bridge.h>

//#include <b64.h>
#include <HttpClient.h>

//#include <ArduinoHttpClient.h>

#include <Arduino_JSON.h>
#include <SPI.h>
#include <WiFiNINA.h>

//#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = "my_wifi_ssid";        // your network SSID (name)
char pass[] = "my_wifi_password";    // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;     // the Wifi radio's status

WiFiSSLClient wifi;
char serverAddress[] = "maps.googleapis.com";

void setup() {
  //Bridge.begin();
  Serial.begin(9600);
  //listNetworks();
  //Initialize serial and wait for port to open:

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

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < "1.0.0") {
    Serial.println("Please upgrade the firmware");
  }

  // 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);

    // wait 10 seconds for connection:
    delay(10000);
  }

  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
  printCurrentNet();
  printWifiData();
  Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  if (wifi.connect(serverAddress, 80)) {
    Serial.println("connected to server");
    // Make a HTTP request:
    wifi.println("GET /maps/api/directions/json?origin=7649+Paseo+Santa+Cruz&destination=SJSU&key=MY_API_KEY");
    wifi.println("Host: maps.googleapis.com");
    wifi.println();
  }
}

void loop() {
  while (wifi.available()) {
    char c = wifi.read();
    Serial.write(c);
  }

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

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

  // check the network connection once every 10 seconds:
  delay(10000);
  }

It only printed in Serial Monitor:

Starting connection to server...

disconnecting from server.


texts: Is 1MB flash enough for OTA upload in ESP-01?

texts: I'am asking this question, because in my ESP-01 OTA upload always fail. In fact update won't even start. When update was triggered esp wifi led(build in blue) indicates "working" , but after cca one second esp reset itself. And The original program remains and starts again...


texts: Are there flexible pressure sensors for Arduino that can measure forces of at least 600 lbs?

texts:
I'm in need of flexible pressure sensors that can read how much force is exerted on someone's foot while running (these sensors would be placed inside the shoe). Since pressure can often be three times the weight of the person, I need something fairly strong. Are there fairly cheap sensors that are available or hacks that could do the same thing?

Thanks!


texts: Need help with on off switch to power arduino.

texts: I am trying to add an on and off power switch to my arduino project.  My project is running off a 9v battery and I would like to save as much power as I can.  There might be a better why that I don’t know.  I added SLEEP_MODE_PWR_DOWN to my project and from what I can tell, the arduino enters sleep mode.  I am having a hard time getting the arduino to wake from sleep mode.  Am I able to do this from a full power down?  I have been reading this link. http://www.gammon.com.au/forum/?id=11497  and others.


texts:
ESP8266 -> FTDI -> USB Mac

I followed the wiring on this page: http://williamdurand.fr/2015/03/17/playing-with-a-esp8266-wifi-module/

I was communicating with it via Serial at 115200.  I issued a AT+UART_DEF=9600,8,1,0,0 and a few seconds later I looked over and it was smoking.

I bought 2 of these.  The previous one I had wired to an Arduino Nano running through a logic level converter.  That one only returns Exception (28) over and over again after issuing that same command.

On both units AT+GMR returned:

AT+GMR
AT version:0.40.0.0(Aug  8 2015 14:45:58)
SDK version:1.3.0

Are these units too hard to use? What did I do to burn it out?

[UPDATE]

Answer given was that I fed it 5v instead of 3.3v. Obvious. I didn't think I did but I checked the output of the FTDI and sure enough it was 5.1v.  So why does the output on it say 3V3 ?  I thought that meant that it was 3.3v...

Should have checked it first.


texts: Help Connecting MicroSD Module with Arduino Uno

texts:
I am Trying to make a MicroSD .wav file player using Arduino Uno. I have ordered a MicroSD Card Module from ebay today.

Product Link : http://www.ebay.in/itm/Micro-SD-Card-Module-SD-Storage-Board-TF-Card-Memory-Shield-SPI-For-Arduino-/161696480012?

As You can See in the Product Image, there is not mentioned on the PCB that which Pin Is ground or VCC Or any other SPI pin.
1. How will I identify the correct pins of the MicroSD Module ?
2. How can I connect a speaker to arduino to play .wav files. Is Amplifier neccessary? I am weak when it comes to electronics.

I have listened that when I connect a Capacitor in series with speaker, it will boost the output volume. There will not be music but only voice recordings in .wav files. I want to listen it clearly only.


texts: Can't create an array of type const char*

texts:
I have something being returned as a const char* and would like to save it to an array.

I've tried this:

const char* book[amtBooks] = "";

and get this error:

error: array must be initialized with a brace-enclosed initializer


texts: is it possible to write two threads in arduino & switch between data & AT command mode dynamically?

texts: I need to recieve data from a android phone and also estimate distance of phone from the HC 05 module , So i want to write two threads or functions. In one part i want recieve data from android phone store it in a variable and in other enter AT command mode to see RSSI of the phone.


texts: Controlling an LED with the 74HC4067E multiplexer

texts:
I am testing a 74HC4067E MUX setup with my Arduino Uno which I would like to use to selectively light up many LEDs, one at a time. For this first test, I am using a modified version of the blink tutorial. Essentially, I am setting the 4 control pins to digital LOW and setting the input to HIGH, through a resistor appropriate for my LED. I am also providing 5V to the Vcc pin on the MUX. I don't really know why I am doing this, but it seems to work. Here is my code:

int led_input = 0;
int led_ctrl_1 = 1;
int led_ctrl_2 = 2;
int led_ctrl_3 = 3;
int led_ctrl_4 = 4;

void setup() {
    pinMode(led_input, OUTPUT);
    pinMode(led_ctrl_1, OUTPUT);
    pinMode(led_ctrl_2, OUTPUT);
    pinMode(led_ctrl_3, OUTPUT);
    pinMode(led_ctrl_4, OUTPUT);
}

void loop() {
    // control signal
    digitalWrite(led_ctrl_1, LOW);
    digitalWrite(led_ctrl_2, LOW);
    digitalWrite(led_ctrl_3, LOW);
    digitalWrite(led_ctrl_4, LOW);

    // input signal
    digitalWrite(led_input, HIGH);
    delay(500);
    digitalWrite(led_input, LOW);
    delay(500);
}

I know, the code could be more efficient.

The blue LED is hooked up to I0 and blinks as it should. The problem comes when I try to change the control pin values. When I change it to, say 6...

// control signal
digitalWrite(led_ctrl_1, LOW);
digitalWrite(led_ctrl_2, HIGH);
digitalWrite(led_ctrl_3, HIGH);
digitalWrite(led_ctrl_4, LOW);

... and I move my LED to I6, I get no blink. I've tested all the pins and it doesn't seem like there is a signal coming from any of them. I assume that I am using the chip wrong, but I'm not sure how. Pictures of my setup follow... any help is greatly appreciated!

Arduino pin 0 maps to chip pin 1 (through resistor) as input.
Arduino pins 1-4 map to chip pins 10, 11, 14, and 13 in that order.
I have a 5V going to chip pin 24.
The LED is connected long leg to chip pin 9 in the images, the grounded.


texts: How to wire and use a L6219 motor driver

texts:
I have 4 of these L6219 motor drivers and I dont know how to wire them. They have almost no wiring diagrams and when there is something, I cannot understand it.
And I forgot I also need help sending data to it; I would like if I could use an arduino for that.
Also this was from a motor driver soldering kit and in the box I also found a pic18f4450 microchip well maybe we can use that somewhere too but for now. I need help wiring and using a l6219 motor driver. And also can I even use an Arduino with these drivers?
Thanks!


texts: How can I run the arduino IDE 1.8.9 on debian testing as regular user?

texts:
When I start the arduino IDE as regular user from my debian testing system, I get a crash right after the splash screen:

Temp/arduino-1.8.9/arduino                                                              :)
Picked up JAVA_TOOL_OPTIONS:
java.lang.NullPointerException
        at processing.app.BaseNoGui.onBoardOrPortChange(BaseNoGui.java:679)
        at processing.app.Base.onBoardOrPortChange(Base.java:1317)
        at processing.app.Base$12.actionPerformed(Base.java:1544)
        at processing.app.Base.rebuildBoardsMenu(Base.java:1494)
        at processing.app.Base.<init>(Base.java:275)
        at processing.app.Base.main(Base.java:151)
Temp/arduino-1.8.9/arduino  7,28s user 0,50s system 183% cpu 4,243 total

When I start it with sudo I can use everything regularly. There are quite a few bug reports mainly in the archlinux community about a similar issue, where they suggest to install a package arduino-avr-core to solve it. But I assume, the reason why it happens for me, is different, since it runs fine with root privileges, and we do not have such a package in debian. Debians arduino IDE from the repos is way to old to use it these days with modern boards.

My Groups: tty uucp dialout cdrom floppy sudo audio dip video plugdev systemd-journal netdev bluetooth lpadmin scanner docker

The file permissions are fine for the ide and the arduino data directory.

The permissions for the usb device are also correct, just in case:crw-rw----+ 1 root dialout 188, 0 Mai  4 11:42 /dev/ttyUSB0

My Java environment:

java --version                                                                          :)
openjdk 11.0.3 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+1-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.3+1-Debian-1, mixed mode, sharing)

Maybe someone ran into the same problem as well?


texts: Errors seen whilst compiling with AdaFruit Motor Shield ("invalid library")

texts:
Whenever I compile a sketch, change the Tools > Board selection, or open/close Boards Manager/Library Manager I get the following message in the console:

> WARNING: Spurious .github folder in 'Adafruit Motor Shield library' library
> WARNING: Spurious .github folder in 'Adafruit Motor Shield V2 Library' library
>
>
> Invalid library found in
> C:\arduino-1.6.8\libraries\Adafruit-Motor-Shield-for-Arduino-master:
> C:\arduino-1.6.8\libraries\Adafruit-Motor-Shield-for-Arduino-master
> Invalid library found in C:\arduino-1.6.8\libraries\robotarm:
> C:\arduino-1.6.8\libraries\robotarm Invalid library found in
> C:\arduino-1.6.8\libraries\Adafruit-Motor-Shield-for-Arduino-master:
> C:\arduino-1.6.8\libraries\Adafruit-Motor-Shield-for-Arduino-master
> Invalid library found in C:\arduino-1.6.8\libraries\robotarm:
> C:\arduino-1.6.8\libraries\robotarm


texts: What overheads and other considerations are there when using a struct vs a class?

texts:
C on embedded systems has traditionally use structs to hold structured data.

Arduino brings C++ to the table, so we can use classes instead.

Lets say we have two different data structures which could be considered very similar:

typedef struct
{
    int valueOne;
    int valueTwo;
    int valueThree;
} value_t;

and:

class Value
{
    public:
        int valueOne;
        int valueTwo;
        int valueThree;
}

In terms of memory, what difference will this make?

I still see the struct technique being used heavily - why is this?


texts: Having problems with HC-05 and three relays

texts:
I'm trying to control three relays with the Arduino Uno rev3 and a HC-05 bluetooth module from Elecfreaks.

I've wrote this code:

// the comments are the part of the code that I use to replace the Serial by default to be able to use the HC-05 module
//#include <SoftwareSerial.h>
int relay1 = 2;
int relay2 = 3;
int relay3 = 4;
int relay1estatus = 0;
int relay2estatus = 0;
int relay3estatus = 0;
char command;
//SoftwareSerial bluetooth(5,6);

void setup() {
 Serial.begin(9600); //bluetooth.begin(9600);
 pinMode(relay1, OUTPUT);
 pinMode(relay2, OUTPUT);
 pinMode(relay3, OUTPUT);
 digitalWrite(relay1, LOW);
 digitalWrite(relay2, LOW);
 digitalWrite(relay3, LOW);
}

void loop() {
 while(Serial.available() > 0){ //bluetooth.available()
  command = (byte)Serial.read(); //(byte)bluetooth.read();
  Serial.println(command); //bluetooth.println(command)

  if (command == 'a'){
   if (relay1estatus == 0){
    digitalWrite(relay1, HIGH);
    relay1estatus = 1;
   }else{
    digitalWrite(relay1, LOW);
    relay1estatus = 0;
   }
  }

 if (command == 'b'){
  if (relay2estatus == 0){
   digitalWrite(relay2, HIGH);
   relay2estatus = 1;
  }else{
   digitalWrite(relay2, LOW);
   relay2estatus = 0;
  }
 }

 if (command == 'c'){
  if (relay3estatus == 0){
   digitalWrite(relay3, HIGH);
   relay3estatus = 1;
  }else{
   digitalWrite(relay3, LOW);
   relay3estatus = 0;
   }
  }
 }
}

The problem is that this code works perfectly using the Arduino IDE serial monitor, but when I try it using instead of the default serial methods, the SoftwareSerial ones it doesn't work.

Doesn't work in a very strange way because I can switch one by one the relays between on or off but, when I have two of them activated seems like freezes, I can't switch the third one on or off and neither I can switch the other two again.

To send the 'commands' through bluetooth I use the Bluetooth Terminal app available in the PlayStore.
(I've just posted the same question in stackoverflow but now I think here's the best place to ask it)


texts: Hacking a Chinese Audio Selector Board: IRLib2 with Low Power Sleep Issue

texts:
I have an issue getting an arduino based hacked-board to sleep whilst performing ir remote commands properly.

What am i hacking?

Exactly this:

tl;dr it's a 4 in 1 out audio selector with motorised volume pot controllable by an IR remote. But it's got a lot of issues so i've enjoyed hacking it. I will release full details maybe with a re-done PCB layout should people wish to grab a board / diy kit, but at the moment it looks like this:

Why am i hacking it?

As is, it's closed hardware and closed software, the MCU itself is an STC15W408AS which prides itself on not being able to have its flash memory read, and believe me it does it's job well; I've clearly removed it and pulled out the SOP20 footprint to another pcb that can talk to either the original IC, or an arduino nano. the volume pot as well is too slow and requires tapping to change, the relays are not latching so consume a lot of power, the whole unit consumes too much power, and i've more of less changed the majority of the components and layout.

So what's the issue?

I got to a point where i've got quite a nice setup in terms of design, it's more of less exactly how i want it and how an audio component should perform, transparently. This is why i'm now optimising the code, with a strong emphasis on lowering the idle power consumption, given it's an always on device.

The original code can be viewed here:

I've already got it down from 150mA to ~65mA by lowing the clock to 8MHz, removing the regulator, LEDs and everything else that's unnecessary, and have disabled a few modules on the ATmega328 itself, as seen on line 88.

The aim is to have it sleep when it's not being used, but i had a few set-backs since with the intention vs implementation, when it came to the ir demodulator.

A post by Nick Gammon discussed how to put the board to sleep when it's been inactive for more than two seconds whilst using IRLib1.

So i went along and ported that code to IRLib2 shown here, then retrofitted it with my original code, essentially putting the bulk of my IR response code in the 'storeCode' function (shown in the forum post, of course i refactored to more appropriate names).

The code itself works well, but it 'soft-bricks' at rather random intervals (system freezes until manual reset), usually after a few button presses, and almost at every repeat code, [The original code behaves as intended] (i do use repeat codes to allow the user to hold a volume up/down button to continuously change it, i haven't yet ported that functionality to the new sleeping code since it sleeps after 2 seconds of holding, but have begun playing with an idea seen on line 173.

I can see the current draw with the new code is low, at about 10mA for the entire board which is more than ten times lower than before, so i'll be really happy if anyone can point me in the right direction.


texts: My computer dose not recognise my Arduino Uno

texts:
I had never used Arduino before. When I tried to interface my new Arduino Uno board to my computer, the computer failed to recognize the board.

Why isn't the board interfaced successfully? How should I troubleshoot that problem?


texts:
I'm following a guide on storing sensor data to MYSQL:

Guide

I'm using different sensors but my POST request is getting any results to my server. For now, I'm only storing temperature.

Here is my code for saving data:

void sendData(double input){

String data = "sensorid=3000000&temp=" + doubleToString(input, 2) + "&hum=1.2";

if(client.connect("192.168.1.50",80)){
    client.println("POST /arduino/add.php HTTP/1.1");
    client.println("Host: 192.168.1.50");
    //client.println("User-Agent: Arduino/1.0");
    //client.println("Connection: close");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.print(data.length());
    client.println();
    client.print(data);

    Serial.println("Sent data: " + data);
}

if(client.connected()){
   client.stop();
}
delay(300000);
}

I've commented out two headers since it did not give any other results. My Serial.println gives: Sent data: sensorid=3000000&temp=24.00&hum=1.2
Which means that the arduino is connected to the giving IP-adress and that my Request data is as I want. They are also working perferct when I'm testing with Requestmaker. So I'm pretty sure my error comes from the way I'm doing the request here.

So do you have any idea how I can solve this? Or how I can debug it t


texts:
How long does it take to read I2C?

I'm reading data from I2C sensor through a 20Hz timer interrupt. The interrupt handler only set the readSensorFlag, and I double checked that it happens at 20Hz through putting a Serial print there.

void TIMER2_Interrupt(void) {
  if (NRF_TIMER2->EVENTS_COMPARE[0] != 0) {
        readSensorFlag = true;
        NRF_TIMER2->EVENTS_COMPARE[0] = 0;
      }
    }

Now in the main loop I perform the reading of sensors.

void loop() {
  // Reading data from sensors to a buffer
  if (readSensorFlag) {
    readSensorFlag = false;

    if (bufferCounter < BUFLEN - 2*SAMPLESIZEINCHAR - 1) {
      epoch = millis();
      proximity = vcnl.readProximity();
      ambientLight = vcnl.readAmbient();

The strange this is that: if I set proximity and ambient light to be some constant and not reading from I2C, then the recorded sampling frequency is 20Hz:

  1988,    7,   10
  2038,    8,   10
  2088,    9,   10
  2188,    1,   10
  2238,    2,   10
  2288,    3,   10

If I revert back reading I2C code (second column is data from sensor), then frequency is only 8Hz!!!

 17637,    8,   33
 17763,    9,   33
 17937,    1,   34
 18067,    2,   35
 18194,    3,   34
 18320,    4,   34

How could reading I2C block the timer interrupt? And how could it be so slow? (I've tried a similar sensor before, and could reach 100Hz with that).


texts:
Similar questions regarding Arduinos mention the existence of tools that would enable the pushing of sketch updates to NodeMCU via WiFi / OTA (Over The Air).

Does this proceed?  If so, please indicate the proper tools.


texts: How do I use 3 Hc-sr04 ultrasonic sensors to control 3 vibration dc motor?

texts:
This code we are using only one motor and one hc-sr04 ultrasonic sensor, the code is shown below:

#define trigPin 7
#define echoPin 6
#define motorPin 5

void setup()
{
  Serial.begin(9600);// to use the serial monitor
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(motorPin, OUTPUT);
}

void loop()
{
  int duration,distance;
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2)/29.1;
  Serial.print(distance);//to print the distance on the serial monitor
  Serial.println("cm");

  // to make the motor vibrate depending on the distance
  // if the ultrasonic sensor is too far from the obstacle it will vibrate slowly
  // if the ultrasonic sensor is very close to the obstacle it will vibrate very fast

    if(distance <= 60 && distance >= 45)
    {
      // to make the motor vibrate
    digitalWrite(motorPin, HIGH); // making the motor on

    delay(200);
    digitalWrite(motorPin, LOW);// making the motor off
    delay(200);
    }

    else if(distance < 45 && distance >= 30)
    {
    digitalWrite(motorPin, HIGH);
    delay(100);
    digitalWrite(motorPin, LOW);
    delay(100);
   }
    else if(distance < 30){

    digitalWrite(motorPin, HIGH);
    delay(50);
    digitalWrite(motorPin, LOW);
    delay(50);
  }
  else
  {
    digitalWrite(motorPin, LOW);
  }
}

We want you to tell us your comment about the code.

And we want to add two more motors and two ultrasonic sensors, one of them in the left and the other in the right.

We want you to help us in the code, because we don't know how we can change it for two other motors.


texts:
Using Audrino Nano and MKS SERVO42 42 Stepper Motor With Driver Board Closed Loop with the LCD. I have got the motor going by using the menu on board. Now able to run Code1 https://github.com/makertut/Arduino-Closed-loop.git out of GitHub and it runs as it is designed. Line 5 int numstep = 1030; cc runs the number of steps indicated and changing this number will determine the movement.
I can do the math to calculate the degrees for number of step for a particular stepper. I would like to use degrees instead of steps for my program. Does anybody know how to code this?
Thanks Greg


texts: Hardware Serial connection for Arduino Mega 2560 NEO GY-GPSMV2 GPS module

texts: My project is Vehicle Tracking System, One of my module is GPS module (Neo GY-GPSMV2). I can successfully see the GPS coordinates via Software Serial. But what I want is that my Arduino should not be connected to my laptop. So I should use Hardware Serial (correct me if I'm wrong). But I read some blogs that I should use resistors to avoid damage to m GPS module if I will use Hardware Serial. I searched for the wiring of it then I see this.  (Please remind that I'm using Mega so please just focus on the wiring). So I bought a 10k and 4.7k resistors. My question is how can I appl this on an actual wiring? should I split the wire? or what?


texts: Does direct port access interfere with PWM?

texts:
I think I've scoured the SE for questions about PWM, and fast digitalWrite etc, but I didn't see this point addressed.

I need to use direct writes to some digital pins. Some of the pins on the port are using analogWrite/PWM, though not the pins I'm accessing digitally.

In the digitalWrite function the Arduino core checks to see if PWM is in use and disables it if a digital write is attempted. Since the pins here are isolated -- no digital writes to PWM pins -- is this a needed step?

The reason I ask is that when accessing a port directly, as in PORTD |= (PORTD & mask) | somebit, you are in fact writing to the pins being used for PWM, you just aren't writing changed bits.

Am I overthinking this? Is it 'PWM-safe' to use direct port outputs on the neighbor pins?


texts: Infrared sending not working slight misconfiguration?

texts:
Edit: Took some advice from below but it still doesn't work. I think it probably blocking code but please tell me how I could fix it to send a the valid infrared signal, NOTE: I wouldn't actually code it like this I am just trying to learn and understand how to do it and then make it better after:
uint8_t Status;
uint8_t Counter;
const uint32_t Code[] = {4507,4507,573,1694,573,1694,573,1694,573,573,573,573,573,573,573,573,573,573,573,1694,573,1694,573,1694,573,573,573,573,573,573,573,573,573,573,573,573,573,1694,573,573,573,573,573,573,573,573,573,573,573,573,573,1694,573,573,573,1694,573,1694,573,1694,573,1694,573,1694,573,1694,573,46560};

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

void loop() {
  while(Counter<70) {
    if (Status=1) {
        digitalWrite(4, HIGH);
        Status=3;
        while(Status=3) {
          delayMicroseconds(26);
          digitalWrite(4, HIGH);
          delayMicroseconds(26);
          digitalWrite(4, LOW);
        }
        delayMicroseconds(Code[Counter]);
        Status=2;
        Counter++;
    } else {
      if (Status=2) {
        digitalWrite(4, LOW);
        Status=0;
        while(Status=0) {
          delayMicroseconds(26);
          digitalWrite(4, HIGH);
          delayMicroseconds(26);
          digitalWrite(4, LOW);
        }
        delayMicroseconds(Code[Counter]);
        Status=1;
        Counter++;
      }
    }
  }
}


texts: Is there a way to keep a program on the Arduino after uploading new sketches?

texts:
I am looking for a way to keep a program on my Arduino Nano 3.0, after uploading new sketches on it. I would like to have a program on it that will control th screen and buttons at it. The user will choose one of the programs displayed on the screen and execute/pause/stop them. These programs will be uploaded on the Arduino, while the previous programmes stay.

If you are familliar with the Lego Mindsdorm microcontroller, you probably know waht I am looking for.

Is there a way to do that.


texts: Do the I/O pins on Arduino read current or voltage?

texts:
So I've recently started Arduino and I just had a question about the digitalRead() function.
Does the IO Pins read Voltage or Current?
The reason I'm asking is because of the attached circuit.
So IO pin 7 is HIGH when the button is not pressed because the resistor is connected to 5V through the resistor. When the button is pressed the button is shorted to ground and is LOW. Why does it read LOW? Surely it would still read 5v because it is still connected to 5V through the resistor?


texts: Arduino Nano + (2* tlc5940) + 34 LEDs = Power Questions

texts:
This is an adapted layout for two tlc5940 hooked up to an Arduino nano. The original project can be found here. I am a little unsure about the capacitors and resistors as that project had it hooked up to a 5v wall plug.

My Design will be running a pattern of PWM, blinking and chasing lights. The two red lights are off of the TLC5940s circuits because reds need a different resistance. If i am wrong, please let me know as that would simplify things.

Also as is the way of the stack community, any other red flags you can point out would be greatly appreciated as i am new to this game.


texts: Controlling DC motor using the Servo pins

texts: I have a L293D motor shield for arduino uno. It has capability of controlling 2 servo motors and 4 DC motors. But I want to control 5 DC motors for my project. So my question is can I use the 3 pins that are there in motor shield ( to control servo motors) for controlling a DC motor? Or any other solution if any without using any other hardware?


texts: Using Arduino to pass data from a coin collector to android app

texts:
Okay. Basically I want the android app to be able to recognize that a coin was inserted into the coin collector before it allows the user to use certain functions of the app.

However I am unsure what would be the best way to pass the data from the coin collector to the Android app.  My currently train of thought is to have the coin collector connect to an Arduino board which would then connect to the android app and send the input through that connection.

I was wondering if anyone knows of a better way to achieve this, or whether this is an acceptable/standard solution.

Thank you in advance!