texts: Yikes! Invalid device signature. Fail to burn bootloader and read fuses

texts:
I know this problem is kinda common but I had to post it anyway.

Before anything, I would like to inform you guys that I changed the fuse of my Arduino Pro 3v3 @ 8MHz to allow 1.8 V brownout and also programmed CKDIV8 AND CLKOUT. In other words, the fuse configuration is this: E:FE, H:DA, L:3F.

The programmer is the Arduino 2009 running as ISP programmer. The target is Arduino Pro Mini 3V3 @ 8Mhz.

I also used a 0.1uF cap between reset and ground in the Arduino programmer.

After a good time using the Arduino Pro without problems, some random problems began to appear when I tried to upload a program with the programmer (Arduino as ISP). So I tried to burn the bootloader again and the following message appeared ""avrdude: Yikes! Invalid device signature."

The same occurs when I try to communicate with avrdude using this command "avrdude -c arduino -p m328p -P COM3 -b 19200 -v".

Some tests I did:

Continuity test directly at uC pins between those signals: SCK, MISO, MOSI, (/SS - /RESET). No problem good connection.
Verified the clock in XTAL1 and XTAL2. No problem 8MHz.
Verified the clock in CKOUT (Arduino Pro pin 2) and measured 1MHz.
I also tried to delay the avrdude using -B5, B10 and another values. With a quick search on Google some people are saying that those delays don't work with the Arduino as ISP.
I used some sketches for slow clocks, which I don't remember, and no luck.
External power and no luck again.

What am I missing? Do I need to change something to communicate with Arduino Pro running at 1MHz?


texts: So the arduino shows up as "Unknown device" when connected to my computer. Followed somr guides on google but still failed, this error came up, what should I do? I've tried "Disable Driver Signature Enforcement" and the regedit thing..


texts: When I start running the Brushless motors with MPU6050 in my quadrocopter, there is a sudden spike in the data of Gyro X-axis and Gyro Y-axis

texts:
I am using the MPU6050_light library for getting the data for my quad-copter. When I am obtaining the gyro values from the MPU6050 without running the motors, its giving correct values but on running the motors and getting the values, I am getting a huge spike on both axes. I am a newbie and a tenth-grader so i don't know so much about electronics. I tried using a Kalman filter but could not find any code which can help me and the Kalman Library was too complex. I think if I apply some kind of filter the problem will be solved. If any one knows any other filter and its code, if you can share it, it would be of great help.
The code is as follows:
#include <SoftwareSerial.h>
#include <Servo.h>
#include <MPU6050_light.h>
#include <Wire.h>

double x = 0.0, y = 0.0, z = 0.0;
int c=0;

SoftwareSerial Slave(5,6);
Servo m1, m2, m3, m4, l;
MPU6050 mpu(Wire);

int throttle = 0;
int t1 = 0, t2 = 0, t3 = 0, t4 = 0;
unsigned long timer;
int of = 0;

void setup()
{
  Slave.begin(9600);
  Serial.begin(9600);
  Wire.begin();
  byte stat = mpu.begin();
  del(1000);
  mpu.calcOffsets();
  del(2000);
  m1.attach(3, 800, 2000);
  m2.attach(9, 800, 2000);
  m3.attach(10, 800, 2000);
  m4.attach(11, 800, 2000);
  l.attach(12, 800, 2000);
  throttle = 0;
  normal();
  del(10000);
  l.detach();
  while (of == 0)
  {debug();}
}

void loop()
{
  normal();
  debug();

  if (of == 0)
  {
    safe_land();
  }

  getxyz();

  if (x < -5.0)
  {
    t1 = t1 + 1;
    t3 = t3 + 1;
    debug();
    normal();
    getxyz();
  }

  if (x > 5.0)
  {
    t2 = t2 + 1;
    t4 = t4 + 1;
    debug();
    normal();
    getxyz();
  }
  if (y < -5.0)
  {
    t4 = t4 + 1;
    t3 = t3 + 1;
    debug();
    normal();
    getxyz();
  }

  if (y > 5.0)
  {
    t2 = t2 + 1;
    t1 = t1 + 1;
    debug();
    normal();
    getxyz();
  }

}
void normal()
{
  m1.write(throttle + t1);
  m2.write(throttle + t2);
  m3.write(throttle + t3);
  m4.write(throttle + t4);

}
void safe_land()
{
  throttle = 0;
  t1 = 0;
  t2 = 0;
  t3 = 0;
  t4 = 0;
  normal();
  off();
}
void off()
{
  m1.detach();
  m2.detach();
  m3.detach();
  m4.detach();
  while (true);
}
void del(int tii)
{
  unsigned long tim = (unsigned long)(tii);
  unsigned long t = millis();
  while (millis() - t <= tim);
}
void getxyz()
{
  mpu.update();
  x = (double)(mpu.getAngleX());
  Serial.print("X:");
  Serial.println(x);
  y = (double)(mpu.getAngleY());
  Serial.print("Y:");
  Serial.println(y);
  //z = (double)(mpu.getAngleZ());
}

void debug()
{

  if (Slave.available())
  {
   c=(int)(Slave.read());
  }
   if(c<=180)
   {
    throttle=c;
   }
   if(c==200 || c==201)
   {
    of=c-200;
   }
}

I am also using two Arduino UNOs, hence the software serial...


texts: Have been using UNO MEGA for small projects. Recently bought an UNO for other projects. Can I just go into the IDE an under Tools select UNO and a different port to do projects and rename sketches to keep track of sketches. Do not wish to use boards at the same time.


texts: Does the Sparkfun ESP32 Thing is compatible with generic modules like DHT11 sensor?

texts:
First of all I am kind of a noob working with microcontrollers, by the way I am using Arduino IDE 1.8.13
I fallowed the hookup guide to set up Arduino IDE to work with Sparkfun ESP 32 Thing board, and actually I was able to run the Arduino examples "Blink" and "Wifi" with no problem.
But my problem is when I tried to use the DHT11 sensor, I did fallowed several tutorials like this one but for my bad fortune I did not succeed, instead I was getting NaN reading from the temperature and humidity sensor, at first I thought it might had something to do with the libraries version, which I installed and uninstalled several times, including the IDE, then using those same libraries I was able to do the exact same example on an Arduino Uno microcontroller.
Then I realized I did not find any example, tutorial or document using the Sparkfun ESP32 Thing with the DHT11 sensor, since most of the examples that I found are for the generic ESP32.
Which makes me wonder, how can I know if those two components are compatible at all?
Does any one has faced something similar using ESP32 Thing with DHT11 or any another sensor?, if yes, how did you make it work or what did you do instead?
However any piece of advise is welcome.
Thanks in advance!


texts:
I'm working in an art project, is some kind of loop between contact microphones and walkie talkies. I want to create some kind of noisy feedback.

I'm putting one walkie-talkie inside of a bottle, and in front of the speaker/microphone from the walkie I want to put another contact microphone attached to an Arduino, and record the sounds of the walkie talkie and played with some delay in some buzzer in front of another contact microphone attached to an amp with three speakers. To sum up, I have like 3 parts linked between them, the first one the walkie, the second one with an Arduino and the third one a simple mic whith an amp and three speakers.

Only the second part will be working with the Arduino and I want it to record sound and play it simultaneously with some delay.
I worked with a friend with some servo motors and music shields and I've been doing some research. I found 3 very interesting projects one is this, that it's practically what I want to do Space Replaybut there's so little information about it, and the other two are Arduino Audio Input and Arduino Audio Output
So, my questions are:

If I use a music shield I don't need a DAC or/and an amp? or only an amp if my speakers are too loud?
In the project Space Replay they only use this music shield so with only one music shield I can record and play music simultaneously? or I need two music shields?
That Adafruit Wave Shield is only for Arduino uno, but it will be better or easier to work with DUE or Arduino Mega and another music shields or making my own circuits like in the instructables Arduino Audio Input and Output?

I don't care too much about the quality of the audio, as I said the purpose is make some noise. The only thing is I want to create some kind of echo, or some kind of cannon, between the first sound of the walkie and the others pick up sounds.

Any other comment or advice will be much appreciated and welcomed.
Thanks


texts: I can't seem to receive data to the ArduinoStudio serial monitor on ubuntu 14.04

texts:
I'm using the Arduino Starter Kit so I have a Uno R3 and going through the examples I'm trying to read temperature data from my controller in Arduino Studio.
In essence my problem can be reduced down to
void setup() {
    Serial.begin(9600);
}

void loop() {
    Serial.print("stuff");
}

Which I'd expect to keep printing "stuff" on the serial monitor.
(In practice I'm running this exact code but all the temperature-reading going on feels irrelevant to my problem, I'm simply mentioning it because I can observe that mye LEDs light up when the temperature rises so I know the code is uploaded and running on the Duo).
I'm not seeing any errors in the studio console, and if I connect using gtkterm or screen I can see data being sent so the problem seems to be isolated to the AndroidStudio serial monitor itself.
I'm running Ubuntu 14.04 and I've connected via USB on /dev/ttyACM3.
I tried running

stty -F /dev/ttyACM3 cs8 9600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

as suggested here and I also tried with baud 115200, taking care to also change the value in my setup function.
I also ran

chmod a+rw /dev/ttyACM3

But I'm still not seeing any errors or output. How do I proceed to debug this issue?
Running ls -l /dev/ttyACM* gives

crw-rw---- 1 root dialout 166, 0 feb.  20 14:22 /dev/ttyACM0
crw-rw---- 1 root dialout 166, 1 feb.  20 14:22 /dev/ttyACM1
crw-rw---- 1 root dialout 166, 2 feb.  20 14:22 /dev/ttyACM2
crw-rw-rw- 1 root dialout 166, 3 feb.  20 14:30 /dev/ttyACM3


texts:
At this stage, my finalized design includes Arduino Nano 3.0, a breakout board and a few electrical components on a breadboard.

Will there be an appreciable cost savings from not buying a ready-made Arduino? The Arduino Nano clone being used costs $17.20.

And is it a good idea if everything is soldered on to a custom fabricated PCB board, including the components of Arduino Nano 3.0? The PCB board will cost around $10 at the quantities I'm starting with.


texts:
I would like to be able to set the wifi SSID in the setup(), so I can customize it based on the MAC address or something similar. (avoiding to ESP's with the same code having the same SSID). However since it requires a const it does not seem to be possible, or am I missing something?
I'm using platformIO if that matters...


texts: Wemos D1 mini and JSN-SR04T-2.0: Type of power supply affects the sensor readings

texts:
Pretty similar to what is described here I have the strange problem that my sensor readings are affected by the type of power supply I use.
Whenever I connect my D1 mini through USB with laptop everything works fine. The readings make sense and are quite accurate.
But as soon as I disconnect it from the laptop and use a USB power supply (I tested different ones) the readings do not make sense anymore.
I also tried to apply the sketch to a NodeMCU board. The results are the same. So I assume it has something to do with either the sensor or the ESP 12E.
Any suggestions?


texts: Send data string from Arduino UNO to ESP8266-01

texts:
Is there anyway to send a string from an Arduino UNO to a ESP8266-01 (one with only 8 pins RX, TX, CH-PD, vcc, ground, reset, GPIO0, GPIO2) without using without using AT commands.  I've looked everywhere and from what I can see UART doesn't work and SoftwareSerial uses only AT commands.  I am at my wits end.  Can anyone help here? please.
I have tried Serial.write but only writes String and Esp8266 only receives ints.

I found some code I thought might work but so far I can see that the arduino is sending <100.00:200:00>, but on the esp8266 all I get is four backwards question marks

this is the code on the Arduino UNO

#include <SoftwareSerial.h>

SoftwareSerial ESPserial(2, 3); // TX | RX
 float water = 100.00;
 float battery = 200.00;
void setup()
{
    Serial.begin(9600);     // communication with the host computer
    //while (!Serial)   { ; }

    // Start the software serial for communication with the ESP8266
    ESPserial.begin(57600);

}

void loop()
{
   ESPserial.print("<");
          ESPserial.print(water,2);
          ESPserial.print(":");
          ESPserial.print(battery,2);
      ESPserial.print(">");
      Serial.print("<");
          Serial.print(water,2);
         Serial.print(":");
          Serial.print(battery,2);
      Serial.print(">");
     delay(10000);
}

and here is the code on the ESP8266

#include <SoftwareSerial.h>
#include <string.h>

SoftwareSerial ESPSerial(2,0);

const byte numChars = 32;
char receivedChars[numChars];
boolean newData = false;

String water;
String battery;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  ESPSerial.begin(57600);
  delay(10);

}

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

 water= getValue(receivedChars, ':', 0);
  battery = getValue(receivedChars, ':', 1);
Serial.println(water);
}

void recvWithStartEndMarkers() {
    static boolean recvInProgress = false;
    static byte ndx = 0;
    char startMarker = '<';
    char endMarker = '>';
    char rc;

    while (ESPSerial.available() > 0 && newData == false) {
        rc = ESPSerial.read();

        if (recvInProgress == true) {
            if (rc != endMarker) {
                receivedChars[ndx] = rc;
                ndx++;
                if (ndx >= numChars) {
                    ndx = numChars - 1;
                }
            }
            else {
                receivedChars[ndx] = '\0'; // terminate the string
                recvInProgress = false;
                ndx = 0;
                newData = true;
            }
        }

        else if (rc == startMarker) {
            recvInProgress = true;
        }
    }

The Arduino sends writes every 10 seconds and the esp prints the ???? every 10 seconds but with a lag.

I am not sure what the pin out to pin in should be.  Right now I have the Arduino 2(TX) attached to the GPIO0 and the Arduino 3(RX) attached to the GPIO2.

Can someone look at my code and see what I am doing wrong.  I thought I would send over two values because eventually I want to show water level and battery level.


texts:
So, I have this code (Arduino Mega):
void setup()
{
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(6, OUTPUT);

  analogWrite(10, 50);
  analogWrite(11, 50);
}

very basic motor speed control. Now when I do this (nothing else is connected to board, only 10 and 11 PWM control pins):
void setup()
{
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(6, OUTPUT);

  analogWrite(10, 50);
  analogWrite(11, 50);
  digitalWrite(6, 0);
}

motors stop. As if those analogWrites are ignored. Is this some exteption about Arduino board? Or is it just a bug? Again, nothing else is connected. Only 10 and 11 PWM outputs. Pin 6 is free. I tried puting digitalWrite above analogs - nothing.


texts:
I made a setup which consists of 3 Zigbee's, 2 routers(Zigbee S2C's) and 1 coordinator(Zigbee S2). The routers are each connected to arduino nano which collects data from 2 FSR's and an IMU(frame type: zigbee transmit request and packet size 46 bytes) and sends it to the Coordinator attached to an arduino UNO. All the Xbees are in API mode 2 and working at a baud rate of 115200. I am using a library called "Simple Zigbee Library" to send all the collected data to the Coordinator. The collection and sending of data works fine except that there are packets lost in the way. The nano's sample data at a frequency of around 25Hz independently. The coordinator tries to read the data send from the zigbees(using the library of course) in every loop, but unfortunately, it seems to receive only around 40-45 samples.(Should have been 25*2=50 samples total from the 2 xbees). Can anybody suggest why this is happening. I need as less data loss as possible for my setup to achieve its motive. Any kind of help is appreciated.

P.S: It may be important to mention that the coordinator is reading the data only from one xbee in each loop.

[[As can be seen from the "Source" heading in this image of data received by the coordinator, "19" and "106" are addresses of the routers. Data drop is intermittent]]1

    void setup()
{
// Start the serial ports ...
Serial.begin( 9600 );
while( !Serial ){;}  // Wait for serial port (for Leonardo only).
xbeeSerial.begin( 9600 );
// ... and set the serial port for the XBee radio.
xbee.setSerial( xbeeSerial );
// Set a non-zero frame id to receive Status packets.
xbee.setAcknowledgement(true);
}

void loop()
{
// Each SimpleZigBeeRadio instance contains two
// SimpleZigBeePacket instances, one for storing incoming
// messages and one for preparing outgoing messages.
// This example will not send any messages to the network.
// Rather, the coordinator will receive messages and display
// the contents to the hardware serial port.

// While data is waiting in the XBee serial port ...
while( xbee.available() )
{
// ... read the data.
xbee.read();
// If a complete message is available, display the contents
if( xbee.isComplete() ){
Serial.print("\nIncoming Message: ");
printPacket( xbee.getIncomingPacketObject() );

}
}

delay(10); // Small delay for stability
// That's it! The coordinator is ready to go.
}

 // Function for printing the complete contents of a packet //

void printPacket(SimpleZigBeePacket & p)
{
Serial.print( START, HEX );
Serial.print(' ');
Serial.print( p.getLengthMSB(), HEX );
Serial.print(' ');
Serial.print( p.getLengthLSB(), HEX );
Serial.print(' ');
// Frame Type and Frame ID are stored in Frame Data
uint8_t checksum = 0;
for( int i=0; i<p.getFrameLength(); i++){
Serial.print( p.getFrameData(i), HEX );
Serial.print(' ');
checksum += p.getFrameData(i);
}
// Calculate checksum based on summation of frame bytes
checksum = 0xff - checksum;
Serial.print(checksum, HEX );
Serial.println();
}


texts: Invalid data using GPS TinyShield module with Tinyduino

texts:
I am new in GPS modules and I need to get the NMEA data from my GPS module but when I execute my code all the NMEA sentences are Invalid.
I am using the same example from instructables Tiny GPS Tracker https://www.instructables.com/Tiny-GPS-Tracker/ and it does not work. So I found other code examples and changed them a little bit.
My code is below. I have the GPS_RX wired with Arduino TX and the same logic for GPS_TX-Arduino RX and Baud is 9600, all these details are inside GPS.h.
If I change the wiring between TX and RX or gps baud the system does not work at all, so I strongly believe that these values are correct.
#include "GPS.h"
#include <SD.h>

#if defined (ARDUINO_ARCH_AVR)
#define SerialMonitorInterface Serial
#include <SoftwareSerial.h>
#elif defined(ARDUINO_ARCH_SAMD)
#define SerialMonitorInterface SerialUSB
#include "SoftwareSerialZero.h"
#endif

const int chipSelect = 10;
int cardPresent;

// The GPS connection is attached with a software serial port
SoftwareSerial softSerial(GPS_RXPin, GPS_TXPin);

#define Gps_serial softSerial

void setup()
{
  Gps_serial.begin(GPSBaud);
  SerialMonitorInterface.begin(115200);
  while (!SerialMonitorInterface && millis() < 5000); //On TinyScreen+, this will wait until the Serial Monitor is opened or until 5 seconds has passed

  gpsInitPins();
  delay(100);
  SerialMonitorInterface.print("Attempting to wake GPS module.. ");
  gpsOn();
  SerialMonitorInterface.println("done.");
  delay(200);

  //Enable and set interval or disable, per NMEA sentence type
  Gps_serial.print(gpsConfig(NMEA_GGA_SENTENCE, 0));
  Gps_serial.print(gpsConfig(NMEA_GLL_SENTENCE, 0));
  Gps_serial.print(gpsConfig(NMEA_GSA_SENTENCE, 0));
  Gps_serial.print(gpsConfig(NMEA_GSV_SENTENCE, 0));
  Gps_serial.print(gpsConfig(NMEA_RMC_SENTENCE, 1));
  Gps_serial.print(gpsConfig(NMEA_VTG_SENTENCE, 0));
  Gps_serial.print(gpsConfig(NMEA_GNS_SENTENCE, 0));

  SerialMonitorInterface.print("Initializing SD card...");

  // see if the card is present and can be initialized:
  if (SD.begin(chipSelect)) {
    SerialMonitorInterface.println("card initialized.");
    cardPresent = true;
  } else {
    SerialMonitorInterface.println("Card failed, or not present- continuing with serial output");
    cardPresent = false;
  }
}

void loop() {
  handleGPS();
}

char waitForCharacter() {
  while (!Gps_serial.available());
  return Gps_serial.read();
}

void handleGPS() {
  while (Gps_serial.read() != '$') {
    if(!Gps_serial.available()){
      return;
    }
  }
  int counter = 1;
  char c = 0;
  char buffer[100];
  buffer[0] = '$';
  c = waitForCharacter();
  while (c != '*') {
    buffer[counter++] = c;
    if(c=='$'){//new start
      counter=1;
    }
    c = waitForCharacter();
  }
  buffer[counter++] = c;
  buffer[counter++] = waitForCharacter();
  buffer[counter++] = waitForCharacter();
  buffer[counter++] = '\r';
  buffer[counter++] = '\n';
  buffer[counter] = '\0';

  buffer[1] = 'G';
  buffer[2] = 'P';

  gpsDoChecksum(buffer);

  if (cardPresent) {
    File dataFile = SD.open("gps.txt", FILE_WRITE);
    // if the file is available, write to it:
    if (dataFile) {
      dataFile.write(buffer, counter);
      dataFile.close();
    } else {
      SerialMonitorInterface.println("error opening gps.txt");
      cardPresent = false;
    }
  } else {
    SerialMonitorInterface.print((char *)buffer);
  }
}

After I wait aprox. 30 seconds which is the cold start of the gps I still receive invalid NMEA sentences.
(I tested it outdoors and indoors)
$GPRMC,181341.901,V,,,,,,,211020,,,N4B
$GPRMC,181342.901,V,,,,,,,211020,,,N48
$GPRMC,181343.901,V,,,,,,,211020,,,N49
$GPRMC,181344.901,V,,,,,,,211020,,,N4E
$GPRMC,181345.901,V,,,,,,,211020,,,N*4F
Can someone explain to me what is going on?


texts: Is IMU of the Arduino Nano 33 BLE Sense good enough to measure acceleration?

texts: I have to measure acceleration wirelessly for 1 or 2 seconds with a high level of precision. I appreciate any other suggestions.


texts: Why does my 16x2 LCD displays weird letters and can't insert key from keypad?

texts:
I'm a newbie on Arduino here, and this is my first project on 16x2 LCD, 4x4 keypad and others. So, the story is, after I uploaded the program for my group's Arduino alarm clock to the Arduino board, the LCD displays black boxes on the first row of the LCD. But after soldering the LCD pins again and connect the Vo to the 10k ohm potentiometer, the LCD can display the "welcome" part properly. This can be seen in the two pictures below.

However, after a while, there are weird letters appearing on the second row of the LCD, blinking from the first picture below to the second picture again and again. Plus, I couldn't input any key from the keypad to the LCD, since the display's stuck at there.

I'm not sure if there's any problem in the circuit or in the programming. I'm quite confused here. Below is the code I uploaded to the Arduino board. Thank you in advance.

#include <EEPROM.h>
#include <Keypad.h>
#include <DS1307.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <LiquidCrystal.h>

DS1307 rtc(SDA, SCL);
LiquidCrystal lcd(A3, A2, A1, A0, 5, 4);
Time t;

#define buz 3

int Hor, Min, Sec, h, m, s;
int ASCII = 48;
char* tim;
char* dat;
const char key = 0;
char buffer[2];
const byte numRows= 4;
const byte numCols= 4;
char keymap[numRows][numCols]=
{
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte rowPins[numRows] = {12, 11, 10, 9};
byte colPins[numCols]= {8, 7, 6, 5};
Keypad myKeypad= Keypad(makeKeymap(keymap),rowPins, colPins, numRows, numCols);

void setup() {
  Wire.begin();
  rtc.begin();
  pinMode(buz, OUTPUT);
  lcd.begin(16, 2);
  welcome();

  rtc.setDOW(SATURDAY); //Set Day-of-Week to SUNDAY
  rtc.setTime(10, 54, 0); //Set the time to 12:00:00     (24hr format)
  rtc.setDate(7, 1, 2017); //Day, Month, Year
}

void loop() {
  t = rtc.getTime();
  Hor = t.hour;
  Min = t.min;
  Sec = t.sec;
  tim = rtc.getTimeStr();
  dat = rtc.getDateStr();
  char key = myKeypad.getKey();

  if (key == 'C'){
    digitalWrite(buz, LOW);
    EEPROM.write(2, ASCII+6);
    EEPROM.write(3, ASCII);
  }

  if(key == '#'){
    lcd.setCursor(0,0);
    lcd.print("Enter New Time");
    lcd.setCursor(0,1);
    int j =0;
    int i=0;
    while( j<6)
    {
      if(i==2 || i == 5){
        lcd.print(":");
        lcd.display();
        i++;
      }
      key=myKeypad.getKey();
      if(key)
      {
        lcd.print(key);
        lcd.display();
        EEPROM.write(j,key);
        j++;
        i++;
      }
    }
  }

  changealarm();
  checkalarm();
  timedate();
}

void checkalarm(){
  if( Hor == h && Min == m)
  {
    delay(3000);
    lcd.setCursor(0,1);
    lcd.print("Hold C");
    digitalWrite(buz, HIGH);
    delay(3000);
  }
}

void changealarm(){
  buffer[0]=EEPROM.read(0);
  buffer[1]=EEPROM.read(1);
  h = atoi(buffer);
  buffer[0]=EEPROM.read(2);
  buffer[1]=EEPROM.read(3);
  m = atoi(buffer);
  buffer[0]=EEPROM.read(4);
  buffer[1]=EEPROM.read(5);
  s = atoi(buffer);
}

void timedate(){
  lcd.setCursor(0,0);
  lcd.print("Time: ");
  lcd.print(rtc.getTimeStr());

  lcd.setCursor(0,1);
  lcd.print("Date: ");
  lcd.print(rtc.getDateStr());
  delay(3000);
  lcd.setCursor(0,1);
  lcd.print("Alarm: ");
  lcd.print(h);
  lcd.print(".");
  lcd.print(m);
  lcd.print(".");
  lcd.print(s);
  delay(3000);
}

void welcome(){
  lcd.setCursor(0,0);
  lcd.print("Welcome");

  lcd.setCursor(0,1);
  lcd.print("To");
  delay(3000);

  lcd.setCursor(0,1);
  lcd.print("TIMeProject");
  delay(3000);
}


texts: Save a fingerprint to the database of the fingerprint sensor

texts:
I'm using the Adafruit Kookye fingerprint module in my project. Since it can only allocate 256 fingerprints I need to make a program to free the memory and add additional users. I have made the following function at the library:

uint8_t Adafruit_Fingerprint::downloadModel(uint16_t id, uint8_t packet_1[], uint8_t packet_2[], uint8_t slot) {
  uint8_t packet[] = {FINGERPRINT_DOWNLOAD, slot};
  writePacket(theAddress, FINGERPRINT_COMMANDPACKET, sizeof(packet)+2, packet);
  uint8_t len = getReply(recvPacket);

  if ((len != 1) && (recvPacket[0] != FINGERPRINT_ACKPACKET))
   return -1;
  if (recvPacket[1] == 0x00) {
    writePacket(theAddress, FINGERPRINT_DATAPACKET, sizeof(packet_1)+2, packet_1);
    writePacket(theAddress, FINGERPRINT_DATAPACKET, sizeof(packet_2)+2, packet_2);
    return recvPacket[1];
  } else {
    return recvPacket[1];
  }
}

This function is working, it puts the fingerprints to the buffer 1 and when I call the function to save with the ID it also works. When I print the fingerprints in the sensor, the structure is exactly the same as if they had been added directly from enrolling. However, when I serach the fingerprints the sensor always returns that the user does not exist.

I don't know what's the problem.


texts: Error in uploading sketch to digispark attiny85 board

texts:
I'm trying to use Digispark attiny85 board and running into issues uploading the sketch.
The drivers are correctly installed. I have followed this page as a reference.
Below the sketch and the error message.

Thanks for any help


texts: Arduino Button switch LED without reset delay

texts:
trying to get a little helper working. Two LEDs, each one is on for 24hrs. Only one is on at the time. There should be a button to switch the states of the LEDs without restarting the delay.
Example: One LED turns on at midnight. In the mornin, somebody needs to turn that LED off and the other on, but the 24hrs delay should still be running without starting over.
Is it possible to change the Output pins? Looked up and down google and cant figure it out. First Arduino project and only itsy bitsy programming knowledge.
Heres the base of the Code without the button function
Im happy with every idea. Probably shouldnt be that hard, but im missing the logic with loops.
Thanks everyone.

void setup()
{
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(4, INPUT);
}

void loop()
{
  digitalWrite(10, HIGH);
  delay(3000);
  digitalWrite(10, LOW);
  delay(1000);
  digitalWrite(9, HIGH);
  delay(3000);
  digitalWrite(9, LOW);
  delay(1000);


texts:
I'm using the keypad library to return a number 1-9. (im fairly sure this returns an int)
I have an array (data) showing the state of each button press.
so i would like the number returned by the keypad (key) to be the index number that gets edited from 0 to 1 and from 1 to 0.
    //REMOTE KEYPAD TO CONTROL OUTPUTS OVER SERIAL

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},

};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

int iAm = 1;                                    //this is device number 1
float checkSum = 0.00;                          //check sum to send as serial
float voltage = 5.26;                           //system voltage
bool data[8] {0, 0, 0, 0, 0, 0, 0, 0, 0};       //keypad output call

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

void loop() {

  int key = keypad.getKey();

  if (key) {
        data[key] = 1;

    //checkSum = voltage * (iAm + data[0] + data[1] + data[2] + data[3] + data[4] + data[5] + data[6] + data[7] + data[8] + data[9]);
    //Serial.print(iAm);
    //Serial.print("/");
    Serial.print(data[1]);
    Serial.print("/");
    Serial.print(data[2]);
    Serial.print("/");
    Serial.print(data[3]);
    Serial.print("/");
    Serial.print(data[4]);
    Serial.print("/");
    Serial.print(data[5]);
    Serial.print("/");
    Serial.print(data[6]);
    Serial.print("/");
    Serial.print(data[7]);
    Serial.print("/");
    Serial.print(data[8]);
    Serial.print("/");
    Serial.print(data[9]);
    Serial.print("/");
    Serial.print(voltage);
    Serial.println("/");
    //Serial.println(checkSum);

  }

}

i can edit the index location by typing data[1] = 1 but not as a variable so i suspect an index cant be addressed as int? but i don't know what it should be addressed as or how to change it to that.


texts: How to perform two tasks in one loop in Arduino?

texts: I am trying to make a weather monitor using Arduino. I want my weather monitor to send me a message of the weather data every 5 hours using GSM sheild. Also, there is an LCD on my weather monitor which shows live weather conditions. The problem I am facing is that the delay of 5 hours in my code also applies to the LCD which updates the LCD every 5 hours and not every second as it should. Please tell me how to run these two functions simultaneously.


texts: Drive a 12V pump do I need a l293 driver

texts:
Me and my girlfriend are working on a small automatic plant watering system. Our first goal is to make an electrical 12V pump suck water out of a bottle.

As we were reading tutorials online we noticed that many people hook up a driver such as the l293 to their arduino in order to control the pump (essentially a brushed DC motor).

http://www.ti.com/lit/ds/symlink/l293.pdf

Our pump is 12V 4.2 W.

My question is do we really need a driver like that for just activating / deactivating the pump ?

In my understanding the driver offers an H-bridge setup allowing to control up to two motors in both directions.

Are there any other reasons to prefer this driver instead of a simple MOSFET / Transistor setup with such a simple use case like ours ?

Thank you for your help.

Best regards


texts:
Problem: Have an LED strip do some animation (say it takes 15 seconds for that line of code to run) meanwhile, have a sensor (tried methods: PIR sensor and ultrasonic sensor) watching to see if an object passes by.  If it senses an object, stop the light animation and make the lights do something else.

Issues: The PIR sensor takes too long to reset... I have the timing turned all the way to minimum and I am still able to count 12 seconds before it starts sensing motion again.  (Is there anyway to override this in the code?)  The other issue is the ultrasonic sensor, as far as I know, can't reliably run the first animation and watch for a change in distance then call an interrupt since an interrupt can only happen on FALLING, RISING, LOW, or CHANGE. This is an issue because the ultrasonic sensor is continuously sending LOW to HIGH then back to LOW for its pulses.

OVERALL QUESTION: How can I effectively sense if an object passes by a sensor, run new LED animation then back to where it left off without having to wait 12 seconds every time.  Is there some other hardware I could try? Please help!?


texts:
I have two Arduino Uno R3 boards and both of them now seem to have an issue. There's a micro sized 8 Pin chip near the dc power port. This seems to get incredibly hot (i managed to get a blister from touching it) and the "L" Led seems to stay dimly lit even when the reset button is pressed.

The Arduino Uno was working fine during operation and only started giving me this problem recently, i cant seem to find any visible short or loose terminal on the board.

I can see that the reset function is being used as my LCD does reset.
Would anyone have a reason for this mysterious issue?


texts: How to send and receive unsigned int from one arduino to another arduino

texts:
I'm trying to send some big numbers ranging from 0-62000 from one arduino to another via serial communication. I'm using unsigned int to hold values from 0 to 65535. And I'm using serial.print() and serial.write () to send numbers and serial.read()-'0' ; to receive numbers, but I'm unable to send and receive numbers above 9. Please help me.

Here is my code -

(For master)

const int Button_1 = 2;
unsigned int s =0;
void setup ()
{
   Serial.begin(115200) ;
   pinMode(Button_1,INPUT);
}
void loop()
{
  if (digitalRead(Button_1))
  {
     s = 61805;
     Serial.write(highByte(s)) ;
     Serial.write(lowByte(s));
     delay (5);
     s=0;
  }
  else
  {
     s = 60005;
     Serial.write(highByte(s)) ;
     Serial.write(lowByte(s));
     delay (5);
     s=0;
  }
}

(code for slave)

unsigned int upperByte, lowerByte, r=0,p=0;
void setup()
{
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT) ;
}
void loop ()
{
  If (Serial.available()>1)
  {
     upperByte = Serial.read();
     lowerByte = Serial.read();
  }
    r = (upperByte << 8) + lowerByte ;

   while (r==61805)
    {
        digitalWrite(LED_BUILTIN, HIGH) ;
    }
    while (r==60005)
    {
        digitalWrite(LED_BUILTIN, LOW) ;
    }
}


texts:
I'm trying to manipulate the ports of Arduino using C code. I have attached an LED to pin 8 and a tact switch to pin 13 (with a pull down resistor). The code works fine, and the results are printed on the screen. So, when the button is pressed, the byte PINB & (1 << PB5) equals 32, or 0b00100000.

However, if I try to use

if( PINB &(1<<PB5) == 32){

or

if( PINB &(1<<PB5) == 0b00100000){

the LED doesn't respond.

Here's the full code:

void setup() {
  DDRB |= 0b00011111;
  Serial.begin(9600);
  }

void loop() {
  Serial.print("PINB &(1<<PB5)");
  Serial.println(PINB &(1<<PB5));

  if( PINB &(1<<PB5) ){
    PORTB |= (1<<PB0);
    }
  else{
    PORTB &= ~(1<<PB0);
    }
  }

What am I missing?


texts: WARNING: Category '' in library *any library* is not valid. Setting to 'Uncategorized'

texts:
I'm using Ubuntu 14.04 with arduino Galileo and the newest arduino IDE from arduino.cc and every time I compile I got this warnings with any library in place of EEPROM, SD, Wire, Wifi and a lot of others.

When I check the boards manager I got the following:

Invalid library found in /home/User/.arduino15/packages/Intel/hardware/i586/1.6.2+1.0/libraries/Wire: /home/User/.arduino15/packages/Intel/hardware/i586/1.6.2+1.0/libraries/Wire

Anyone knows how to solve this?


texts: How to: soil moisture measurement with WaterMark?

texts:
I am new with Arduino, and i cant find documentation about how to connect Arduino with Watermark successfully.

I would like to connect my Arduino UNO with a watermark like this:

http://guideimg.alibaba.com/images/shop/72/08/19/4/watermark-soil-moisture-sensor-w-15-cable_3234944.jpg

Does anyone know any schema or documentation about how to do it? Have anyone tried it before?

I have found this: https://oceancontrols.com.au/datasheet/davis/ECS-014_07395-158_IM_06440_6470.pdf

but still not clear how to do it in Arduino.

Thanks you for your time.


texts:
In on of my projects i am using sparkfuns MicrOLED library. Downloaded it from github, installed as usual but no code calling that library compiles. Error is SPF_MicrOLED.h no such file or directory.

It is strange as the library is installed, example sketches are in the examples menu but they don`t want to compile ether, same error. Not sure what to do. Tried also to rename microled library folder but same error.


texts: How to disable Arduino Yun to work as Access Point and set it to work as needed?

texts:
I am using Arduino Yun and I would like to disable it to work as Access Point. That is, I don't want that it is displayed in the list of available networks.

Then I would like to set and use it (separately) in the following scenarios:

a) Arduino Yun connected just over a given Wi-Fi network (Ethernet connection disabled).

b) Arduino Yun connected just over Ethernet (Wi-Fi connection disabled).

How can I make it?

Note: In my previous attempts I tried to customize and/or disable someway the Wi-Fi connection (through the LuCI panel) in order to reach what I am looking for but in all of these cases I had to restore my Arduino Yun from scratch because it did not work anymore.


texts:
The INT0 pin of a custom Arduino-like board based on Atmega16 is configured in INPUT_PULLUP mode and connected to a N.O contact of a limit switch, the other end of the switch is connected to GND.

in the main loop an ac motor is activated each hour, and stops when hitting the limit switch:

void loop()
{
.....
.....
if((millis() - lastT) >= ONE_HOUR) {
    GICR &= 0xBF;  //disable INT0 interrupt
    digitalWrite(MOTOR_PIN, HIGH);
    lastT = millis();
  }
delay(5000); //time for motor to quit the limit switch
GICR |= 0x40;  //enable INT0 interrupt
.....
.....
}//end of main loop

disabling the INT0 for few seconds allow the time to the motor to release the limit switch because this motor has unpredictable direction of rotation... then the INT0 is re-enabled waiting for the limit switch to be hitted and the ISR to be excuted as INT0 pin becomes Low:

ISR(INT0_vect){
  digitalWrite(MOTOR_PIN, LOW);
  GICR &= 0xBF;  //disable INT0 interrupt
}

the INT0 is disabled to allow the next cycle of the motor after one hour...

the problem is that the motor stops sometimes in the middle before hitting the limit switch and sometimes it continue turning after hitting the limit switch... and the majority of times it work as expected...

I do not understand the reason for this behavior... and what are the elements to check...

EDIT: the full code

#define LIMIT_SWITCH     2       // pd2 (INT0)
#define HEATER_PIN      29       // pc7
#define MOTOR_PIN       27       // pc5

#define  ONE_HOUR (1*60*60*1000)

Si7021 sensor = Si7021();

unsigned long lastT;

float tmp , Setpoint;

void setup()
{
  Serial.begin(9600);
  Setpoint = 37;
  lastT = millis();
  pinMode(MOTOR_PIN, OUTPUT);
  pinMode(LIMIT_SWITCH, INPUT_PULLUP);
  GICR|=0x40;                        // enable INT0 interrupt
  MCUCR=0;
}

ISR(INT0_vect){
  digitalWrite(MOTOR_PIN, LOW);
  GICR &= 0xBF;                      // disable INT0 interrupt
}

void loop()
{
  tmp = sensor.readTemperature();
  if(tmp>Setpoint + 0.5) digitalWrite(HEATER_PIN, LOW);
  if(tmp<Setpoint - 0.5) digitalWrite(HEATER_PIN, HIGH);
  Serial.println(tmp);

  if((millis() - lastT)>=ONE_HOUR) {
    GICR &= 0xBF;                    // disable INT0 interrupt
    digitalWrite(MOTOR_PIN, HIGH);
    lastT = millis();
  }

  delay(5000);                       // time for motor to quit the limit switch
  GICR |= 0x40;                      // enable INT0 interrupt
}


texts:
For a project I'm doing I need the Arduino to be connected to two echo sensors (I have the HC-SR04). Currently I have 4 sensors that I can use, but I will need only 2 or 3.

I have almost no knowledge of coding and the Arduino, but I figured out how to connect it to one echo sensor, and that is working, which is great.

But now I need it to connect to two. I found example code with 3 echo sensors, but whenever I connect them my Arduino shuts down. I guess it is because it takes up too much power, my teacher said something like that. All lights turn off all of the sudden, and it doesn't reset. Only when I remove some the wires for the power, it works again.

So 3 isn't going to work. I figured I'd stick to two. Now the problem: Whenever I try to edit the code to two echo sensors (I basically just removed the trigPin3 and echoPin3 in the first part of the code, and the SonarSensor(trigPin3, echoPin3)), it doesn't work anymore. The monitor doesn't show any values anymore, while it did with the first code. It just shows zeroes now.

So my question is, how can I edit the example code so that it works with 2 echo sensors?

This is the code I found for the 3 echo sensors:

#define trigPin1 3
#define echoPin1 2
#define trigPin2 4
#define echoPin2 5
#define trigPin3 7
#define echoPin3 8

long duration, distance, RightSensor,BackSensor,FrontSensor,LeftSensor;

void setup() {
  Serial.begin (9600);
  pinMode(trigPin1, OUTPUT);
  pinMode(echoPin1, INPUT);
  pinMode(trigPin2, OUTPUT);
  pinMode(echoPin2, INPUT);
  pinMode(trigPin3, OUTPUT);
  pinMode(echoPin3, INPUT);
}

void loop() {
  SonarSensor(trigPin1, echoPin1);
  RightSensor = distance;
  SonarSensor(trigPin2, echoPin2);
  LeftSensor = distance;
  SonarSensor(trigPin3, echoPin3);
  FrontSensor = distance;
  Serial.print(LeftSensor);
  Serial.print(” – “);
  Serial.print(FrontSensor);
  Serial.print(” – “);
  Serial.println(RightSensor);
}

void SonarSensor(int trigPin,int echoPin) {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
}

And this is the one that IS working, but with 1 echo sensor:

#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
#define LEDPin 13 // Onboard LED

int maximumRange = 200;
int minimumRange = 0;
long duration, distance;

void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
}

void loop() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  if (distance >= maximumRange || distance <= minimumRange) {
    /* Send a negative number to computer and Turn LED ON
    to indicate "out of range" */
    Serial.println("-1");
    digitalWrite(LEDPin, HIGH);
  } else {
    /* Send the distance to the computer using Serial protocol, and
    turn LED OFF to indicate successful reading. */
    Serial.println(distance);
    digitalWrite(LEDPin, LOW);
  }
  //Delay 50ms before next reading.
  delay(50);
}

I hope someone can help me!

Many thanks, Leah.


texts:
I want to send/receive strings to/from an ENC28J60 via a C# application. I used my own "protocol" to do this. For example I send "" to Arduino and it replies with a string containing temperature values. This method works fine in Serial communication mode, but freezes in Network mode. What am I missing here? Is there a better method to do this? I'm new to socket programming. I'm using UIPEthernet.h by ntruchsess.

My server-side (Arduino) code:

void checkAndReceiveFromTCPClients(){
  size_t size;
  if (EClient = EServer.available()){
    char* strIn;
    if(size = EClient.available() > 0){
      strIn = (char*)malloc(size + 1);
      memset(strIn, 0, size + 1);
      EClient.read(strIn, size);
    }
    strIn[size] = 0;
    String strInput = String(strIn);
    strInput.trim();
    //This replies to client (sends string) with a string (EClient.write(answer)):
    InterpretInputString(strInput);
    //EClient.stop();
    EClient.flush();
  }
}

C# code:

string SendAndReceiveOverNet(string Command) {
    Byte[] data = System.Text.Encoding.ASCII.GetBytes(Command);
    NetworkStream stream = TClient.GetStream();
    stream.Write(data, 0, data.Length);
    data = new Byte[256];
    String responseData = String.Empty;
    Int32 bytes = stream.Read(data, 0, data.Length);
    responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
    return responseData;
}


texts:
My idea is to use Arduino to control the TV remote. Not make the Arduino become a TV remote, I want to make an Arduino that can touch button of a remote control.

Any ideas?


texts: How do I reset an ESP8266 with an FTDI and no reset button? I assume that it has something to do with the reset pin on the ESP8266, but I cannot find a step-by-step usage of the pin online.


texts: How to Measure many voltages (Uno) - Analog extenders a good option?

texts:
I am trying to make a battery capacity tester (3.7v li-ion 18650 battery) using arduino uno. If possible i'd like to test 20 or more batteries at the same time. I need to measure the voltage of each battery every 1 second.

The uno has 6 anolog inputs iirc so too little for this application.
I think using analog multiple extenders (connected using I2C) chained together to create enough analog inputs.
For example this one: https://nl.aliexpress.com/item/32858973834.html?spm=a2g0o.productlist.0.0.57206143DNgWKp&algo_pvid=526d42f2-f7ee-4781-932b-947744ac631e&algo_expid=526d42f2-f7ee-4781-932b-947744ac631e-0&btsid=89c452fa-1d7c-4ae9-9dd5-ed8fc9bff128&ws_ab_test=searchweb0_0,searchweb201602_8,searchweb201603_52
Do you think I'll be able to get relatively accurate voltage measurements using this approach?

The purpose of the circuit is to measure the amount of mah (battery capacity) of the 18650 battery which is being discharged via the 10Ohm resistor. The battery will be discharged from 4.2volt (fully charged) to approx 2.5V using the 10ohm resistor, each second the voltage drop over the resistor will be measured and using it and the time passed the integral of time*current will be calculated to determine the capacity.

This is the basic circuit used to connect each 18650 battery, the ANALOG1 pin will be connected to the input of the analog extenders:

(I based it off of the circuit from this video: https://www.youtube.com/watch?v=WScPyfQz_f8)
The idea is to measure the voltage drop over the 10Ohm10W power resistor and calculate the current using the known resistance value, calculate the integral of current*time to get a capacity value for the battery.

Is this a good approach? Would you recommend using analog extenders for this? If not what would be a better solution? Thank you very much!


texts: Writing new functions into progmem after main program is burned

texts:
I've been experimenting with writing very basic operating system-like programs on the Arduino, and so far I have been running user-defined programs on a small virtual machine I wrote.  This has been an interesting experience, but the VM runs on an assembly-like language and not C.

I want to be able to do something more.  I would like to be able to write a core OS, and then install new programs, written in C.  The core OS would get user input for which program to run, and then jump to that program.

Now, I know that I can do this trivially by writing the OS along with all of the programs into a single sketch. The programs are then just functions, and the OS just calls those functions.  However, I want to do this with functions I've written after I've burned the main OS.

From what I can tell, this is just a bootloader with additional user functionality.  However, I don't think that's quite right for two reasons:

First, I keep hearing that you can't write to progmem at runtime.  But isn't that what a bootloader does?  Which is correct?

Second, once a user program ends, I should return to the OS.  As far as I understand it, on the ATMega, once the main function terminates it jumps into a no-operation function and that's that.  I'd need it to jump back to the bootloader and continue the bootloader's operation.  Is that even possible?


texts:
As a project I have to build a SensorHub with multiple sensors. I am relatively new to the Arduino and circuit world, so I need a little help.

The Goal is to build hub with multiple sensors and to be able to measure power consumption of the entire thing and log the data from all sensors.

So I came up with the following part list:

Arduino Uno (Rev3)
Adafruit 10-DOF IMU L3GD20H + LSM303 + BMP180
Adafruit Ultimate GPS v3
Adafruit VCNL4010 Proximity and Light sensor
Adafruit INA219 High Side DC Current Sensor Breakout
Adafruit MicroSD card breakout board
of course breadboard, powersupply, calbes, etc.

Everything is connected like this:

My question is now if this thing will work as I expect. With the 10-DOF, GPS and VCNL4010 I'm pretty sure. They work all with I2C on different addresses and all of them need 5V.

The question is now if I can measure the needed power with this setup. Or does the INA219 need power to be able to get the power to the Arduino? Do you see any problems?


texts: Why is Wire.endTransmission(true) returning 10?

texts:
Question:

The follow code is printing 10 over and over again (with spaces in between). I have an I2C device connected at 0x60, and nothing connected at 0x61. I'm confused by this because the Wire.endTransmission(bool) docs say the only valid return types are 0,1,2,3, and 4. These return types are further supported by the Wire.endTransmission(), and the source code of the twi_writeTo function calls.

Code:

```

#include <Wire.h>

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Adafruit Motorshield v2 - DC Motor test!");

}

void loop() {
  // put your main code here, to run repeatedly:
  shieldConnected(0x60);
  Serial.println("\n");
  shieldConnected(0x61);

  delay(2000);

}

/**
 * Checks if an I2C device is connected at shieldAddr. This effectively checks if a
 * motor shield exists at that location.
 *
 * Note, this only works when everything's imported for some reason.
 */
void shieldConnected(uint8_t shieldAddr){
  Wire.beginTransmission(shieldAddr);
  Wire.write(1);
  uint8_t end = Wire.endTransmission(true);
  //shieldAddressValidator(shieldAddr);
  Serial.println(end);
}

```


texts:
I see there is an Arduino EnergyShield available, and am wondering what (specific) solar shield/panels/attachments can be used to power it. Thoughts?

Bonus points if someone can explain how long the solar unit would take to charge the Energy Shield if the Arduino was on but idling (low-to-nonexistent power output).


texts: ESP12F module not working as an access point

texts:
I have an ESP12F WiFi module and I need it to work in access point mode. I burned the example code to it using Arduino IDE and it worked at first. I could connect to the WiFi provided by it using my laptop. But when I removed it from power and connected it again it was not working. I couldn't even see its hotspot in my laptop WiFi. What happened to it? Can you please help trouble shoot it?

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#ifndef APSSID
#define APSSID "ESPap"
#define APPSK  "thereisnospoon"
#endif
const char *ssid = "ESPap";
const char *password = "thereisnospoon";

ESP8266WebServer server(80);

void handleRoot() {
server.send(200, "text/html", "
You are connected
");
}

void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point...");

WiFi.softAP(ssid, password);

IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", handleRoot);
server.begin();
Serial.println("HTTP server started");
}

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


texts:
Im a beginner working with arduino.
Im little familliar with java syn and its not hard for me to do the work with ide ;but i know python better....is there any Lib that let you program Arduino with Python?


texts: Setting 10 RGB Strips Independently from Single Arduino

texts:
I want to control 10 different 12V RGB LED strips independently from a single Arduino.

As a clarification - I've setup a bunch of NeoPixels and understand how to wire and control them independently. So now I'm looking to do something similar but rather than set color of individual LED's, I'm looking to set color of LED strips.

I've already done all the research to understand how to use a MOSFET to control a single strip - but that requires 3 PWM outputs on the Arduino board and I don't see any boards that have 3 * 10 = 30 PWM outputs.

Are there existing controllers that can abstract the power conversion and voltage control, so I can just send a color and brightness setting from the Arduino to each strip?


texts: Relay for controlling a water pump motor

texts:
I want to switch on and off a motor with arduino, used for pumping water. I need to have a idea which relay could be used with arduino.

Here is a photo of a similar motor:


texts: convert 32 bit long to 4 bytes and back again - CAN Bus

texts:
So after 2 days attempting this I can't get my head round it.

So I am using CAN bus to transfer accelerometer data and time data (the micros() function if under 71 minutes will output data that can be an unsigned long), however I have to send the data as bytes. I have managed to bit shift a 16-bit int into 2 bytes but I am having trouble extrapolating that method (will add later) to using longs. I am having trouble understanding the union method as I am new to creating my own functions, so, how would you guys accomplish this? As simple as possible please :)


texts: When should I use a transistor, mosfet, and when should I use a relay?

texts:
I am used to relays some, and they are useful, especially for large loads like a incandescent light bulb or other 120V AC device. However, it seems like overkill to use a relay for a bunch of LEDs linked together (parallel) that use 60 mA (too much for the Arduino). Also, it wouldn't work if you wanted to turn it on/off frequently or do PWM. I've heard some about transistors and MOSFETS and know a little about them. When should I use each one and how do I know what type to get? Also, it seems like relays can be more expensive than transistors/MOSFETS.

Edit: How can I use these with my Arduino?


texts: What is the equivilent of PORTx for Teensy (4.0)?

texts: I've seen people use code like PORTB |= 0x1 << 6 to set the sixth bit of PORTB in arduino. I understand that this is significantly faster than using digitalWrite. How can this be done using a modern Teensy (i.e. 3.6 or 4.0) if at all?


texts: I would like to set up a project with an ATtiny chip, such as the ATtiny84 or ATtiny85, in which I interface the microcontroller directly with an XBee for both wireless serial communication, as well as monitoring a digital signal from the Xbee (digital input to the ATtiny). As the Xbee chips can handle only 3.3V and will be damaged at higher voltages (such as 5V), I was wondering whether I can simply power the entire project at 3.3V so that all digital inputs and outputs will be at that voltage?


texts:
I'm building a MIDI synthesizer on Arduino Uno, and am considering user interface options.

I see on Adafruit and Sparkfun there are 16x2 LCD panels available that interface via I2C serial or by UART, but I think neither of those will work in my application:

The UART is clocked at 31250 baud to receive MIDI, and that's not a supported baud rate for these LCD devices;
I'm producing audio by driving an external DAC (MCP4725) over full-speed I2C; any transmission to another device would audibly jitter the DAC output;
SoftwareSerial would get around the UART clocking problem, but I believe it would stall the main loop while driving the output.

One option might be to roll my own software serial routine, carefully clocking it on the main loop, which (I believe) reliably runs at either 14.8KHz or 22.2KHz depending on the DAC protocol in use. I could set a SparkFun SerLCD into a slow data rate (2400 baud) and count passes through the main loop to time the data output.

Another option would be to use a secondary MCU -- I have a surplus Trinket M0 on hand -- and define a custom synchronous serial protocol between the two MCUs, and have the secondary relay commands to the LCD but that's getting into Rube Goldberg territory.

Any obvious options I'm overlooking?


texts: Endless loop on boot after reflashing ESP-12E with AT firmware

texts:
I flashed the ESP-12E from AT firmware 2.0 (running ok) to NodeMCU (running ok). When I reflashed it back to the AT 2.0 it is stuck in endless loop on boot:

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8

2nd boot version : 1.6
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
no GPIO select!
jump to run user1 @ 1000

rf_cal[0] !=0x05,is 0xFF

I am sure I flashed it correctly, it was not my first flashing of AT firmware. Just to be sure:

esp_init_data_default.bin -> 0x3fc000
blank.bin -> 0x3fe000
boot_v1.6.bin -> 0x0000
user1.1024.new.2.bin -> 0x1000
blank.bin -> 0x7e000

I can even reflash it to the NodeMCU firmware and it works, but reflashing to the AT firmware ends in the same endless loop again.

I suspect the problem is in initialization data, but I'm at my wit's end with it.


texts: Attiny85 not able to understand data from 433Mhz using VirtualWire.h

texts:
The basic plan is to have a Attiny85 pass information from a 433Mhz RF module to another chip/Arduino via I2C using VirtualWire and Wire libraries. I have been able to make this system work on their own using Arudino Nano's to debug, but the Attiny85 (A85) seems unable to grab the data from the RF 433 Mhz.

So have spent a few days doing some more research, and basically putting each component separate, to make sure what is being sent is correct.

433 Mhz transmitter is working by sending a 9 digit number, using VirtualWire.h.
Nano with a 433 Mhz receiver is receiving 9 digit
number, VirtualWire.h.
Attiny85 is sending either a no data, or the 9 digit number, to another Nano using Wire.h.
The Nano is getting only No Data, so the I2C is working between A85 and Nano.

Attiny85, on Pin 1 (pin 6 on chip) is not getting any data from the 433 Mhz, which works on (2). I connect the GND of the 433 RX to the chip.

Here is the Receiver code:

#include <VirtualWire.h>
#include <Wire.h>
void setup() {
  pinMode(A3, OUTPUT);
  Wire.begin(); // join i2c bus (address optional for master)
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(4000);   // Bits per sec
  vw_set_rx_pin(1);
  vw_rx_start();       // Start the receiver PLL running
}
void loop() {
  uint8_t buf[15];
  uint8_t buflen = 15;
  if (vw_get_message(buf, &buflen)) // Non-blocking
    {
      digitalWrite(A3, LOW);
      Wire.beginTransmission(8); // transmit to device #8
      for (int i = 0; i < buflen; i++) {
        Wire.write(buf[i]);
      }
      Wire.endTransmission();    // stop transmitting
    } else {
      digitalWrite(A3, HIGH);
      Wire.beginTransmission(8); // transmit to device #8
      Wire.write("no DATA");
      Wire.endTransmission();    // stop transmitting
     }
}

Here is the Transmitter code:

#include <VirtualWire.h>
int xPin = A7;
int yPin = A6;
int buttonPin = 2;

int xPosition = 0;
int yPosition = 0;
int buttonState = 0;
const char *controller;
void setup() {
  Serial.begin(9600);
  pinMode(12,OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(yPin, INPUT);
  pinMode(xPin, INPUT);
  pinMode(buttonPin, INPUT_PULLUP);
  vw_set_ptt_inverted(true); //
  vw_set_tx_pin(12);
  vw_setup(4000);// speed of data transfer Kbps
}

void loop(){
   xPosition = analogRead(xPin);
   yPosition = analogRead(yPin);
   buttonState = digitalRead(buttonPin);
if(xPosition > 0 || yPosition > 0) {
  String Data = (xPosition + yPosition);
  controller = Data;
  vw_send((uint8_t *)controller, strlen(controller));
  vw_wait_tx(); // Wait until the whole message is gone

} else {
  digitalWrite(13, 0);
  digitalWrite(4, 1);
  controller = "#s0_0";
  vw_send((uint8_t *)controller, strlen(controller));
  vw_wait_tx(); // Wait until the whole message is gone
}

Serial.println(controller);

}

So basically the A85 is not getting past if (vw_get_message(buf, &buflen)) { on pin 1. But does when using the Nano on pin D2, from the same transmitter, but not at the same-time of-course.

Am I using the wrong Pin on the A85? Chip pin 5 and 7 are used for the I2C so it only leaves analog pins so not sure they would work either. I also tried 8 Mhz and 1 Mhz when loading the A85.

I  have tried different Cores as suggested from Google, different versions of VirtualWire and clocked the Attiny 1Mhz, 8Mhz and 16Mhz. None of have worked.

Not sure what else I am missing?


texts: Does MFRC522 supports native SPI of Arduino Due?

texts:
Does MFRC522 library support native SPI interface of Arduino Due?

By native SPI I mean this one:

I came here with this question because the initializer asks for 2 pins: SS and Reset:

MFRC522(byte chipSelectPin, byte resetPowerDownPin);

SS pin can be any, but what about Reset?


texts:
I've got an Arduino V3+ and need to find the correct PIN number for its RX and TX-pin on the FTDI-connector.

How can I find out the correct number of them to use them with the SoftwareSerial-library?

Why I need these numbers:

I'm connecting a Sparkfun Bluetooth Mate/BlueSMIRF to the ArduiMUs FTDI headers and need to set a few settings in its command mode before it operates without flaws.
This is the code I'm using:

#include <SoftwareSerial.h>

int bluetoothTx = ???;  // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = ???;  // RX-I pin of bluetooth mate, Arduino D3
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  Serial.begin(9600);  // Begin the serial monitor at 9600bps

  bluetooth.begin(115200);  // The Bluetooth Mate defaults to 115200bps
  bluetooth.print("$$$");  // Enter command mode
  delay(5000);  // Short delay, wait for the Mate to send back CMD
  bluetooth.println("U,9600,N");  // Temporarily Change the baudrate to 9600, no parity
  // 115200 can be too fast at times for NewSoftSerial to relay the data reliably
  bluetooth.begin(9600);  // Start bluetooth serial at 9600
}


texts: ESP8266 upload data to google cloud platform

texts:
I am trying to upload information to my appspot created with Google App Engine. I am able to do it when I in my browser type:
http://myname.appspot.com/query?city=Copenhagen&temp=20&id=website
But I cannot get it to work on the ESP8266. Here is my code:

const char* MY_URL = "http://myname.appspot.com";

void uploadHTTP() {
    // Define the WiFi Client
    WiFiClient client;
    // Set the http Port
    const int httpPort = 80;

    // Make sure we can connect
    if (!client.connect(MY_URL, httpPort)) {
        return;
    }
    else {
        Serial.println("Connected to MY_URL");
    }

    String url = "/query?city=Copenhagen&temp=20&id=ESP8266";

    // Post to appspot
    if (client.connect(MY_URL, httpPort)) {

        // Sent HTTP POST Request
        client.println("POST " + url + " HTTP/1.1");
        Serial.println("POST " + url + " HTTP/1.1");
        client.println("Host: " + String(MY_URL));
        Serial.println("Host: " + String(MY_URL));
        client.println("User-Agent: Arduino/1.0");
        Serial.println("User-Agent: Arduino/1.0");
        client.print("Content-Length: ");
        Serial.print("Content-Length: ");
        client.println(0);
        Serial.println(0);
        client.println("Content-Type: application/x-www-form-urlencoded");
        Serial.println("Content-Type: application/x-www-form-urlencoded");
        client.println("Connection: close");
        Serial.println("Connection: close");
        }
    //Done
    Serial.println("");
    Serial.println("my HTTP done");
    Serial.println("");
}


texts: Why is AREF connected to a capacitor in the Arduino Pro Mini Schematic?

texts:
I'm currently looking at the Arduino Pro Mini schematic and have noticed that the pin AREF (analogue reference) is connected to a 0.1uF capacitor as shown below:

I have done some research and read this great explanation into AREF and now understand its purpose as a voltage reference. What I do not understand however is the purpose of the capacitor. Is it as a means of stabilising the pin when an external voltage is applied, or something else?

A full schematic of the Arduino Pro Mini can be sourced from here.


texts: This is for my project and I hope I can get the answer here. Can I have RFID module as my attendance and at the same time Fingerprint Scanner connected to solenoid lock for security using only one arduino? is it possible? thank you in advance


texts: I tried making a digital tachometer using an IR sensor but my lcd display is showing random characters

texts:
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 6, 5, 4, 3);
float value = 0;
float rev = 0;
int rpm;
int oldtime = 0;
int time;

void isr() //interrupt service routine
{
  rev++;
}

void setup()
{
  lcd.begin(16, 2);                //initialize LCD
  attachInterrupt(0, isr, RISING); //attaching the interrupt
}

void loop()
{
  delay(1000);
  detachInterrupt(0);           //detaches the interrupt
  time = millis() - oldtime;    //finds the time
  rpm = (rev / time) * 60000;   //calculates rpm
  oldtime = millis();           //saves the current time
  rev = 0;
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("___TACHOMETER___");
  lcd.setCursor(0, 1);
  lcd.print(     rpm);
  lcd.print(" RPM");
  lcd.print("   ");
  attachInterrupt(0, isr, RISING);
}


texts: Response from ESP8266 is returning unknown characters

texts:
I'm working on a project with Arduino UNO that needs connection with a cloud server, that is why I'm using ESP8266 module.

I'm already connecting to wi-fi and making GET and POST request but my problem is get the response from these requests.

Here is my code:

/* Doing all these steps to make the request
AT+RST
AT+CWMODE=1
AT+CWJAP="MyNetwork","MyPassword"
AT+CIPMUX=1
AT+CIPSTART=0,"TCP","myserver.com.br",80
AT+CIPSEND=0,270
*/

String data = "data=example";

String command = "POST /webservice/v1/dispositivo/atualizar_data_requisicao HTTP/1.1\r\n";
comando += "Host: " + SERVER + "\r\n";
comando += "User-Agent: Arduino/1.0\r\n";
comando += "Connection: Close\r\n";
comando += "Content-Type: application/x-www-form-urlencoded;\r\n";
comando += "Content-Length: " + String(data.length()) + "\r\n\r\n";
comando += data;

esp8266.println(command);

delay(2000);

String response;

while(esp8266.available()) {
  response += esp8266.readStringUntil('\r');
}

Serial.print("Request response: ");
Serial.println(response);

When I run this code the only response I can get is something like:

Recv 270 bxt⸮⸮C⸮
SEND OK

+IPD,0.569:HTTP/1.0 200 OK

But I was expecting a JSON.

Can someone tell me what I am doing wrong and how can I resolve it?

Edit.

Ok, after Code Gorilla helps me (Thank you so much) and a lot of research what I did was program Arduino UNO to send some commands that I invented to serial and program ESP8266 to read the serial and, depending of the command that it reads, do requests and stuff.

ESP8266 is a lot easyer to make requests and have a lot of others possibilities, like HTTPS requests, that you can't do using AT Commands.

When I create this ask I didn't know that I could program directly in ESP8266, but when Code Gorilla told me about it and helps me with some articles I could finally continue with my project.


texts: How to expand program memory on an arduino?

texts: Sometimes I run out of space of the program size for the embedded C program that I want to put on an arduino. So what chip do I need to expand the program memory of the arduino so that I can use bigger C programs with my arduino?


texts: Slave to Send Data after Receiving Command using I2C

texts:
I want to have my Slave Arduino to send signal to Master after the command was made. But the Slave Arduino does not proceeds to sending the signal after doing the command. What is wrong with my code?

Slave

void receiveEvent(int bytes) {
  dir = Wire.read();    // direction
  dis = Wire.read();    // distance
  spe = Wire.read();    // speed
  eStop = Wire.read();    // 1 or 0
  Serial.println(dir);
  Serial.println(dis);
  Serial.println(spe);
  mov = true;
}
void loop() {
    Wire.onReceive(receiveEvent);
  if (dir == 1 && mov == true && eStop == false){
      motor.Distance(dis);
      motor.Speed(spe);
      motor.Forward();
       Wire.onRequest(requestEvent);
      mov = false;
      fin = true;
    }
  if (dir == 2 && mov == true && eStop == false){
    motor.Distance(dis);
    motor.Speed(spe);
    motor.Reverse();
      Wire.onRequest(requestEvent);
    mov = false;
    fin = true;
  }

  else{
    motor.Stop();
  }
}
void requestEvent(){
    Wire.write(1);
    fin = false;
    Serial.println("sent");
}

Master

#include <Wire.h>

const byte interruptPin = 2;
byte dir = 0;
byte dis;
byte spe;
bool upd;

bool state= false;

void setup() {

  Wire.begin();
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), emergencyStop, CHANGE);
  Serial.begin(9600);

}
void loop() {
       if( state == false ){
       dir = 1;
       dis = 30;
       spe = 2;
       Wire.beginTransmission(9); // transmit to device #9
       Wire.write(dir);
       Wire.write(dis);
       Wire.write(spe);
       Wire.write(0);
       Wire.endTransmission();    // stop transmitting
       state = true;
       }
       if (state == true){
        if(Wire.available() > 0){
       Wire.requestFrom(9,2);   //6bytes from slave 9
          bool upd = Wire.read();
          Serial.println(upd);
        }
      }
}
void emergencyStop(){ // not working
  Wire.beginTransmission(9); // transmit to device #9
       Wire.write(0);
       Wire.write(0);
       Wire.write(0);
       Wire.write(1);
       Wire.endTransmission();    // stop transmitting

}


texts: Arduino Uno data logger shield recording nonsense time

texts:
I'm using an Arduino Uno with the Adafruit Data Logger Shield powered by a Voltaic 5V 2A battery pack. When writing to an SD card, the time stamp never changes (always reports the same now.unixtime). However, when powered from a laptop, the time stamp is correct and everything seems to be working.

The input voltage from the battery is confirmed to be just over 5V and not substantially lower the the laptop usb port.

Has anyone seen this before? Any ideas?


texts: How to listen for an incoming serial string inside loop with long delay?

texts:
I'm trying to build a datalogger using Arduino UNO, I'll use RS232 for the communication between PC and Arduino, the problem I'm facing now is that I'm using delay(10000) : 10 seconds as a timestep for data acquisition. however, I can't find any solution to receive a string from the serial input to Arduino while delay is executing. Here is the code :

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

void loop() {
  serialRoutine();
  dataLoggingEvery10Second(); // That's a function to receive data from the sensor and store it in SD card.
  delay(10000);
}

  // A function to handle all the serial in out
  void serialRoutine(){
  // print the string when a newline arrives:
  while(Serial.readString() == ""){
    String serstr = Serial.readString();
      /*
      *  Getters
      */
      if(serstr == "GETDATA"){
        Serial.println("Here is my data");
      }
      serstr = "";
  }
}

Any help would be highly appreciated !


texts: Attiny85, high output impedance, dim leds

texts:
I designed what I thought should be a very simple badge using the Attiny85 SU, schematic below:

The problem is the tiny doesn't seem to be sinking current properly. For testing I switched to a 20 PU on the breadboard and 100 ohm load resistors. At 3v supply this should give approximately 30 mA per pin, well under the rated 40 mA per pin and 200 mA total. However with the loads connected only pin 6 sinks any significant current, and appears to be higher impedance than it should be (1.6v across the resistor for 16 mA). The other pins seem to be very high impedance, they drop to ~7 mV (70 microamps) when the loads are connected. With the load resistors disconnected they function normally (digitalWrite HIGH = supply voltage - junction drop).

I'm using pinMode [this was a problem] (OUTPUT, N) [/this was a problem, should be (N, OUTPUT)] to set up pin N, and digital writes for on/off. I've been able to drive transistors before using an exactly similar setup, although admittedly these have much lower current requirements.

Anybody know what's going on here?

EDIT: Turns out I had accidentally swapped the order of OUTPUT and N in the pin mode command. Not sure why the compiler had no problems with this, but I am at least getting useful outputs now.

I'm gonna leave this up out of curiosity/etc, because I'm still getting higher impedance than I'd have expected on the outputs. With the 100 ohm load resistor, I'm only getting about 16 mA (expect closer to 25). Supply voltage from the CR2032 is ~2.48v under load.

Based on the graph on the datasheet (figure 22-19, PG 182), at 25 c ambient (currently 20) I should expect a voltage drop from VCC to output somewhere on the lower end between 400 and 600 mV when supplying 15 mA, but my readings at 16 mA above represent a voltage drop of almost 900 mV across the Tiny. Additionally the LEDs drop 2v at 10 mA, for which you'd expect approximately 300 mV drop across the tiny according to the graph, but mine is dropping almost 500 mV. I'm not sure if this is something in my setup or if the characteristic curves on the datasheet simply aren't that accurate for production models.


texts:
I am working in a project in which I need to control at the same time three NEMA17 stepper motors. In order to do so, I am using three DRV8825 drivers working at 12V connected to an Arduino MEGA.
This Arduino is generating the pulses in velocity ramps so that we have an accelerated movement to reach the goal.
The schematic I am using for connecting the drivers is the one that the manufacturer recommends:

With a digital analyzer, I can see that my velocity ramp is being generated properly:

In this picture below you can see how steps (ST) are generated once the direction (DR) is set for each of the motors. The time waiting after the direction change is bigger than the necessary established by the manufacturer and also does the duration of the step pulses.
Following this, the motors are supposed to make an accelerated movement until reaching a certain position and then, decelerate and stop.
Although, I am facing the problem that, in some cases, one of the motors (not always the same one) makes a few steps in the opposite direction of the movement and, after that, it executes the expected movement. This leads to, even of making the three motors perform the same movement, one of them finishes differently.
I tried to change the drivers but the same happens. Also, as I said before, I have checked that the pulses are correctly generated.
I would like to know if anyone has faced a similar problem or knows any reason that could lead to this strange behavior.
Thanks.


texts:
So I am not new to arduino, however, I am new with web servers. I am working on a project that can control a robotic arm that is at one location and I can be at my house. I know basic HTML, Basic CSS, Basic JavaScript, and a tiny bit of JQuery. Only reason I say basic is because I self taught all these languages to myself using codeacademy. So I have a few questions since I done research on the matter.

Can a project like this be done with just the languages I know? All the tutorials I have looked at say you have to know AJAX and JSON. I have no idea what these are.

Also, for the interface, I need to be able to take the value of the encoders on the robot and view them. I also need a button that will record the value at that point in time of the encoders so I can configure the points and maybe even name them. A box where I can see the points and their coordinates, and finally a box where i can place points in and then execute a sequence.

How tough should this be?


texts:
i have bought a module for transmitting data threw radio but with the NRF24 and the exemple code of the RF24 libary by doing exemple/RF24/GettingStarted i think to have something weird, i don't thing it's normal that when the client send something and the serveur doesn't send the same data back? Also with this exemple that i put the link under and the same cable at the same place it doesn't work with my kit that i put the link undernese, the thing that it's not working is that i can't receive the text data.

If you know an exemple with this kit or what do i need to do to make this kit work please tell me

I don't know why this two exemple doesn't work

when in the video he shows where to put the cable https://www.youtube.com/watch?v=57pdX6b0sfw&t=273

my arduino kit https://www.amazon.fr/product-reviews/B07ZCJPJ8B/ref=acr_dp_hist_1?ie=UTF8&filterByStar=one_star&reviewerType=all_reviews#reviews-filter-bar

the video that i follow for the second exemplehttps://www.youtube.com/watch?v=57pdX6b0sfw&t


texts:
I am not 100% sure this question relevant here , but question is I have lv maxsonar ez which need 5v. I am powering my uno with  9v battery. And I have few other sensors also connected to 3.3v. But I have neopixel 3 meter LED which is powering with external power source which is 5v 4 amp. So My question is shall I connect my sonar sensor to the external power or keep with my uno 5v power ?

Thanks


texts: FC-16 led matrix module based on MAX7219

texts:
EDIT:

const char  *pc[NUM_ZONES] =
{
  "ROOM", //0
  "SUBJECT", //1
  "GRADE",//2
  };

I did this and I can't get them to display every row simultaneously.

void loop(void)
{

 DateTime now = rtc.now();
 char buffer[] = "hh:mm";  // hours and minutes

 for (uint8_t i=0; i<NUM_ZONES; i++){
   P.displayZoneText(0,now.toString(buffer), PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
   P.displayZoneText(1, pc[1], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
   P.displayZoneText(2, pc[2], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);  // display
   P.displayZoneText(3, pc[3], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
 }
}

I can only display one row at a time like this, now it only displays the hour:min.

Tell me what am I doing wrong

EDIT2:

Or like this:

-this is my goal, to change the text based on hour

void loop(void)
{

 DateTime now = rtc.now();
 char buffer[] = "hh:mm";  // hours and minutes

   P.displayZoneText(0,now.toString(buffer), PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);

   if(now.hour()==21){
   P.displayZoneText(1, pc[1], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
   P.displayZoneText(2, pc[2], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);  // display
   P.displayZoneText(3, pc[3], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
   }
   P.displayAnimate();
}

And at the moment with this code it only displays the hour and minutes


texts: Scroll String Only On Second Line Using 2x16 LCD

texts:
I'm trying to scroll a string in the second row of the LCD while letting the string on the first row stay intact. I use Serial to run that part of the code as you can see. It work at first but when I try to make it run again it doesn't display anything on the second row.

I borrowed the code from :

http://code.nishantarora.in/arduino-lcd-projects/src/3f10686e7464665c5c59d7be772c00af7a4a93e8/scrollOneLine/scrollOneLine.ino?at=master

And made some changes:

// include the library
#include <LiquidCrystal.h>

// init the lcd display according to the circuit
LiquidCrystal lcd(9, 8, 7, 6, 5, 4);

// it's a 16x2 LCD so...
int screenWidth = 16;
int screenHeight = 2;

String line1;
String line2;

int stringStart, stringStop = 0;
int scrollCursor = screenWidth;

String CompleteString;
String stringArray[] = {"s=Plane", "i=Car", "h=Boat", "u=Rocket", "d=Jet",  "p=Submarine", "l=Truck", "b=Bicycle", "m=Skate", "enter=Train"};

String string1 = "String";

int countMovement=0;
int arraylimit = 9;

void setup() {

   lcd.begin(screenWidth,screenHeight);
   Serial.begin(9600);

}

void loop(){

   char ser = Serial.read();

   if ( ser == 'c' ) {
     CompleteString="";

     for (int i = 0 ; i <= arraylimit; i++) {
        CompleteString += stringArray[i] + " "; // Convert String Array To Single String
     }

     roop(string1,CompleteString);
  }

}

void roop(String line1, String line2) {

  countMovement = 0;

  while ( ( countMovement ) < (line2.length() + screenWidth )  ) {

     lcd.setCursor(scrollCursor, 1);
     lcd.print(line2.substring(stringStart,stringStop));
     lcd.setCursor(4, 0); // 1 = word eat array of words very cool
     lcd.print(line1);
     delay(300);
     lcd.clear();

     if(stringStart == 0 && scrollCursor > 0){
        // Serial.println(scrollCursor);
        scrollCursor--;
        stringStop++;
     } else if (stringStart == stringStop){
        stringStart = stringStop = 0;
        scrollCursor = screenWidth;
     } else if (stringStop == line1.length() && scrollCursor == 0) {
        stringStart++;
     } else {
       stringStart++;
       stringStop++;
     }

     countMovement++;

  }

  lcd.setCursor(4, 0);
  lcd.print(line1);

}

From what I can see using Serial as debugging is that the problem resides in the function "roop" and in specific the line:

 if(stringStart == 0 && scrollCursor > 0){

It seems that the statement is being pass on and so it doesn't move the string as it's suppose to. I could be wrong but placing a Serial call in there yields no result the second time the function is called but the first time it did.

Any help would be much appreciated! And I know the community will be grateful too since it's difficult from what I can see in post to achieve this and make it autonomous so that no big modifications needs to be done.


texts: How do I check if a password is right? (keypad input)

texts:
Im having a problem with my arduino code.Im trying to make an alarm system with a pir sensor.So when the pir activates and the buzzer starts buzzing i want to be able to type a set password in the keypad and the buzzer should stop buzzing. since my passcode is 4-digit (1331) I wrote this code, but it`s not working.

 while(i<=4,i++)
{
char key = keypad.getKey();

pass.append(key);
}
if(pass.evaluate())
{
  digitalWrite(buzzer, LOW);
    keypad.waitForKey();
    delay(6000);
}

My idea is that the program checks 4 times for the pressed key and adds it to the guessed password (im using the password library and the password is defined as well as int i=0;)
But for some reason when I type 1331 the buzzing continues. Please help me with that project and excuse my grammar, English is not my native language.

edit:
the full code:

#include <Password.h>
Password pass = Password( "1331" );

#include <Keypad.h>
int sensor = 11;
int buzzer = 10;
int i = 0;

const byte rows = 4; //four rows
const byte cols = 4; //four columns
char keys[rows][cols] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[rows] = {8, 7, 6, 9}; //connect to the row pinouts of the keypad
byte colPins[cols] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );

void setup() {
pinMode(sensor, INPUT);
pinMode (buzzer, OUTPUT);
digitalWrite(buzzer,HIGH);
delay(125);
digitalWrite(buzzer, LOW);
delay(125);
digitalWrite(buzzer,HIGH);
delay(125);
digitalWrite(buzzer, LOW);
delay(125);
digitalWrite(buzzer,HIGH);
delay(125);
digitalWrite(buzzer, LOW);
keypad.waitForKey();
digitalWrite(buzzer,HIGH);
  delay(125);
  digitalWrite(buzzer, LOW);
  delay(6000);

}

void loop() {

  char state = digitalRead(sensor);
  if (state == HIGH)
  {
    digitalWrite(buzzer, HIGH);
    while(i<4,i++)
    {
    char key = keypad.getKey();
    //keypad.waitForKey(); not sure if i should use that

    pass.append(key);
    }
    if(pass.evaluate())
    {
      digitalWrite(buzzer, LOW);
        keypad.waitForKey();
        delay(6000);
    }

  }
      }


texts: How do I use Sound Sensor LM393 + Speaker in Arduino

texts:
I have this voice sensor:

I need to know how bytes pass through soundsensor into arduino and get this bytes and put out in a speaker.

I read on the net a Lib PCM thats converts chars in voices, but how do I extract bytes from sound sensor in analog-in?


texts: How to increment and decrement an output voltage by using two buttons?

texts:
I'm trying to create a code using an Arduino Uno board to increment and decrement the output voltage of the Arduino Uno which is 5 volts and I need to step it up to 10 volts which I have done below.

The things that are missing on the schematic are two buttons. I want to be able to increment 0.5 volts with each press of Button-A until the Arduino is at 5 volts. With Button-B I want to be able to lower the voltage by 0.5 volts with each press of the button till value is 0.

I can do the calculations and the circuit design but I'm not much of a programmer. I just want to know if anyone can point me in a good direction of where I can get the right code. I have already looked at all the tutorials on the Arduino Website. I do know I have to work with the PWM functions as well as attachinterrupt() and Debounce() functions. Also, how do I set the increments so that I don't go over, say it takes 10 presses to get to 5 volts on the 11th press have it not do anything so I don't break anything. So can anyone please help me with any suggestions?

I have a low pass filter on the circuit for noise handling and like I said I need to add in the buttons to my schematic.

simulate this circuit – Schematic created using CircuitLab

Here is my code I have made. I'm using an LED to test the Vout aspect. So far I can only get my LED to flicker from 2 to 4 volts and my buttons A and B don't work. Can someone look over my code and see how bad I made this?

int PWMPin = 6; // output pin supporting PWM
int buttonApin = 9; // buttonA to pin 9 PWM
int buttonBpin = 10; // buttonB to pin 10 PWM
float value = 0; // read the value at 0
int fadeValue = value;

void setup()
{
  Serial.begin(9600); //initialize serial communication at 9600 baud
  pinMode(buttonApin, INPUT_PULLUP);
  pinMode(buttonBpin, INPUT_PULLUP);
  pinMode(PWMPin, OUTPUT);
}
void loop()
{
  {
    int port = analogRead(0);
    port = map(port, 0, 10, 0, 255);
    analogWrite(6, port);
  }

  {
  if (digitalRead(buttonApin) == LOW, fadeValue)
  {
  // fade from min to max in increments of 25.5 points: basically (0.5 volts)
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=25.5)

    digitalWrite(PWMPin, fadeValue);

    // sets the value (range from 0 to 255):
   Serial.println(PWMPin);
   analogWrite(PWMPin, fadeValue);
  }
  }

  {
    if (digitalRead(buttonBpin) == LOW, fadeValue)
  {
  // fade from max to min in increments of 25.5 points:
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=25.5)

    digitalWrite(PWMPin, fadeValue);

  // sets the value (range from 0 to 255): basically (0.5 volts)
  analogWrite(PWMPin, fadeValue);
  }
  }
}


texts: ESP8366: ets Jan 8 2013,rst cause:4, boot mode:(1,7)

texts:
I am trying to control esp8266 esp 01 with Alexa
This is my code:
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"

#define ssid "admin"
#define pass "admin0000"

#define device1 "arduino"

fauxmoESP fauxmo;

void wifi()
{
  WiFi.mode(WIFI_STA);

  WiFi.begin(ssid,pass);
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print("not connected\n");
    delay(100);
  }
    Serial.print("1");

}

void setup()
{
  Serial.begin(115200);
  wifi();
  fauxmo.createServer(true);
  fauxmo.addDevice(device1);
  Serial.print("device added\n");
    fauxmo.setPort(80);
   fauxmo.enable(true);

  fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
  Serial.printf("[MAIN](%s) state: %s\n",device_name, state ? "ON" : "OFF");
    if (strcmp(device_name, device1) == 0)
    {
      if (state)
        Serial.print("3");
      else
        Serial.print("2");
    }

  });
}

void loop()
{
  fauxmo.handle();
}

And I am getting an error after 10 - 20 sec
ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset

Anyone please help me to solve this issue


texts: exit status 1 'mcpButtonState' cannot be used as a function

texts:
I keep getting this error and I don't know why.

mcpButtonState is an array, and I would like to change one of its values using a line like this:

mcpButtonState(thisPin) = 0;

(it's inside of a for loop looping trough all my pins).
This is my complete code:

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h
#include <Wire.h>
#include "Adafruit_MCP23017.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);
Adafruit_MCP23017 mcp;

int mcpButtonPins[] = {0,1,2,3,4};
int mcpButtonCount = 5;
int mcpButtonState[5];

int analogButtonPins[] = {0};
int analogButtonCount = 1;
int analogButtonState[1];

int potiPin = A2;
int soundVolume = 15;

void setup() {
  mySoftwareSerial.begin(9600);
  //Serial.begin(115200);
  mcp.begin();
  for (int thisPin = 0; thisPin < mcpButtonCount; thisPin++)
  {
    mcp.pinMode(thisPin, INPUT);
    mcp.pullUp(thisPin, HIGH);
    mcpButtonState(thisPin) = 0;
  }
  //ANALOG BUTTON SETUP
}

void loop() {
  int potiValue = analogRead(potiPin);
  int newVolume = (potiValue / 1023 * 30);
  if(newVolume != soundVolume)
  {
    soundVolume = newVolume;
    myDFPlayer.volume(soundVolume);
  }
  for (int thisPin = 0; thisPin < mcpButtonCount; thisPin++)
  {
     if(mcp.digitalRead(thisPin) == 0 and int mcpButtonState(thisPin) == 0)
     {
      mcpButtonState(thisPin) = 1;
      myDFPlayer.play((thisPin + 1));
     }
     else if(mcp.digitalRead(thisPin) == 0 and int mcpButtonState(thisPin) == 1){}
     else {
      mcpButtonState(thisPin) = 0;
      }
  }
  //ANALOG BUTTON PLAYING
}


texts: How to control cold to hot (blue to red gradient) RBG LED strip/bulb with a rotary encoder?

texts:
I'm doing a project for university and I am struggling to code and set up a rotary encoder that can control hot-cold variations. Much like the idea of communicating temperature selected by turning a dial. I would either like to control a single strip of RGB LEDs or a single bulb (changing and fading between colours at the same time).

I would like to have the dial turn from 0 - 180 degrees and relate to intense blue changing to intense red and all the colours in between as increments.

I have an Arduino Uno.

Thank you!


texts: How do I transform data for a column to data for a row, for a led matrix

texts:
I have a 8x8 led matrix. I'm using LedControl.h library to control the matrix, which has 3 ways to light up the leds: setLed, setRow and setColumn. I've found that setColumn it's really slow, it's using setLed to print columns. With all my code, I can only print 3 times a second with setColumn. The function setRow is way faster, I'm guessing that the design of the matrix is allowing to print the rows directly. I can print more than 10 times a second with setRow, so I have to use it, since speed is crucial to my project. In my code, the data i have to print is stored in an array of 8 bytes. This is how it looks like when I use setColumn
for(int i = 7; i >= 0; i--)
    lc.setColumn(0, i, vector[i]);

i is the row to be printed, and vector[i] is a byte value, indicating which leds to be on or off. Column 0 is the left-most one, while column 7 is the right-most one, so i go from 7 to 0 to print from right to left, because that's what I have to do. My goal is to transform somehow to data in vector[i], to data that I can use it using setRow. So that's what I've done so far.
byte mask = 128, x;
for (int j = 0; j < 8; j++){
  x = 0;
  for(int p = 0; p < 8; p++){
    x = x | (valueVector[p] & mask);
    if (p != 7)
      x = x >> 1;
  }
  if (j != 7)
  mask = mask >> 1;
  lc.setRow(0, j, x);
}

Now i print the rows from row 0 to row 7, from top to bottom. Since I'm printing from top to bottom, this means I have to take the last bit of every column (last bit of every element in vector), and put it in a byte variable. I was thinking to make a byte mask = 128 (b1000000, do a AND logic between to mask and the vector value in order to take the bit I'm looking for, and then making a OR to put the bit in the x byte. After every mask operation, I shift the x variable to the right, in order to make space for the next bit. After i'm done with a row, I shift the mask to the right, in order to take the second bit from the value in the vector. The result I get, is quite odd, I can't explain it, it's not good at all. What I'm i doing wrong with the mask and shifts? I hope I explained well what I'm trying to do. If necessary, I can provide more information. Thanks.


texts: Using NRF24L01 as transmitter and receiver (transceiver)

texts:
I am using the NRF24L01 module to communicate between multiple Arduinos. For this example I will have a master transmiter (tx) Arduino and a salve receiver (rx) Arduino to illustrative better my problem.
Master (Tx) code:
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>

RF24 radio(9, 10); // NRF24L01 used SPI pins + Pin 9 and 10

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

    radio.begin();
    radio.openWritingPipe(27);
    radio.stopListening();
}

void loop() {
    char buf[32];
    buf[0] = 123;

    auto res = radio.write(buf, sizeof(buf));
    if (res) {
        Serial.println("worked");
    }
    else {
        Serial.println("** error **");
        delay(1000);
    }

    delay(700); // wait 700 ms

}

Slave (Rx) Code
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>

RF24 radio(9, 10); // NRF24L01 used SPI pins + Pin 9 and 10

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

    radio.begin();
    radio.openReadingPipe(1, 27);
    radio.startListening();
}

void codeThatMakesMasterAckStopWorking()
{
    // Code that will be changed
}

void loop() {

    if (radio.available()) {
       char buf[32];
       radio.read(buf, 32);
       Serial.println("received data");
       codeThatMakesMasterAckStopWorking();

    }

}

If I execute this code it works great just as it is. The master (tx) always gets an acknowledgment every time it sends data. Also the range of the NRF24L01 works great. The problem occurs when the slave sends data becoming a transmitter instead of a receiver. In other words if I replace the method codeThatMakesMasterAckStopWorking with:
void codeThatMakesMasterAckStopWorking()
{
    radio.stopListening();
    radio.openWritingPipe(1234); // send to some other node that is not master
    char buf[32];
    radio.write(buf, 32);
    radio.startListening();
}

The master (Tx) is able to send the data because the slave prints the message "received data" but without acknowledgment. The master keeps printing ** error ** even though the slave is receiving the data. I been doing a lot of tests and this are my findings:
// does not work (master stops receiving acknowledgment and prints '** error **')
void codeThatMakesMasterAckStopWorking()
{
    radio.stopListening();
    delay(200);
    radio.startListening();
}

// works (master receives acknowledgment and prints 'worked')
void codeThatMakesMasterAckStopWorking()
{
    radio.stopListening();
    delay(10);
    radio.startListening();
}

There are times when I want my slave arduino to stop listening and transmit a message to another arduino. When it sends a message to a different arduino the master does not receive an acknowledgment anymore even though the slave is listening again. Why could this be?