texts:
I've been messing around with accelerometers for Arduino for a school project. I bought the SODIAL GY-521 accelerometer + gyroscope module for Arduino. It uses de Invensense MPU 6050. I managed to connect it onto my board and successfully detect it, but it returns values of -1 on all output ports. I was expecting there to be a port for every axis of acceleration and rotation but it seems that this isn't the case. How should I connect the module into my Arduino, and how should I program the Arduino to read my data?

I tried to follow the Arduino Playground example but the result was as explained above.

Thank you for all answers.


texts:
As a programmer I am new and lack some knowledge in electronic and I will appreciate the help.

I wish to connect 3 Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix (https://www.adafruit.com/products/1487) can some one please provide me a scheme how to connect/tile 3 these NeoMatrix 8x8 to one Arduino Uno.

Thanks a lot


texts:
When I read about mega2560 I saw it has 54 digital that can be used as input or output.
later on I saw the some of them are used for things like communication.

So I would like to know if the communication pin can still be used as output ? (to power leds)


texts:
Today I tried to update the sketch on my Arduino Uno, but was unable to due to this error:

Sketch uses 1,870 bytes (5%) of program storage space. Maximum is 32,256 bytes.
Global variables use 188 bytes (9%) of dynamic memory, leaving 1,860 bytes for local variables. Maximum is 2,048 bytes.
D:\Users\User\Desktop\arduino-1.6.10\hardware\tools\avr/bin/avrdude -CD:\Users\User\Desktop\arduino-1.6.10\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM4 -b115200 -D -Uflash:w:C:\Users\User\AppData\Local\Temp\build2f7b4a32c3810b2d8e42648954faba05.tmp/nes_controller.ino.hex:i
An error occurred while uploading the sketch

Nothing will upload to the board now. I tried uploading a simple sketch with empty setup() and loop() functions, I've tried different PCs and gotten the same error, I've swapped USB cables, I've double-checked that I'm using the right COM port, I've disconnected every wire from the Arduino pins - nothing has helped.

The old sketch is still running fine on the Uno. It was uploaded a few days ago using the exact same setup I'm trying right now.

The Arduino IDE doesn't even indicate any errors, everything compiles and looks good until "An error occurred while uploading the sketch"


texts: Bluetooth Master and Slave to track device's locations

texts:
I'm trying to create an app for my science fair that uses bluetooth to track people in a determined place.
I was thinking about one Arduino system to receive all the information and transmit through a network and some Arduino slaves to duplicate the signal and cover the hole place.

Resuming...

I'll have:

Arduino slaves placed all over the place to track people
One Arduino connected to the network to receive all the information from the slaves and pass it through the network.
Some kind of web app inside the main Arduino with an API to manage the data and make it friendly for third-party apps

I was wondering of what kind of equipment should I buy to make this happen. Thanks!

Each cellphone with it's bluetooth enabled will work as a person (sending signal) - my Arduino slaves will receive the signal (find bluetooth around it) and send the device name and signal strength to the arduino master - The arduino master (connected to the network) will interpenetrate the responses and send the results to the built-in web server - Apps will make requests to the web app to get this data and show in a plant where're these people.

Basically it will work like these bluetooth stickers that you can plug in to your keys, phone e etc... and with the app you can search for them in your house via bluetooth from your cellphone.

Here's a better explanation:
Link


texts: Button circuit draws all power away from LEDs

texts:
I'm very new to Arduino, so please forgive me if I don't know the proper terms for things.

Whenever I press the button on the board, the LEDs all shut off.

I can't host the image files on imgur, and I don't know how well Flikr will work with it.

Now:

The resistors being used are 220 ohm resistors for the LEDs. The one for the button is a 10k ohm resistor.

This also happens without a resistor in place. I tried simply replacing the button with a wire from the positive to a row, with a wire leading from there to another row, back to ground.

What do I do to fix this?

Edit: Sorry about the images being extremely low quality, they've been updated.

Here's the code, but it's mostly irrelevant:

//DEFINE STUFF BABYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
int ButtonState2 = 0;
int ButtonState1 = 0;
int ButtonState0 = 0;
const int ButtonPin2 = 2;
const int ButtonPin1 = 1;
const int ButtonPin0 = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
  digitalWrite(10, LOW);
  digitalWrite(9, LOW);
  digitalWrite(8, LOW);
  digitalWrite(7, LOW);
  digitalWrite(6, LOW);
  digitalWrite(5, LOW);
  digitalWrite(4, LOW);
  digitalWrite(3, LOW);
  pinMode(ButtonPin2, INPUT);
  pinMode(ButtonPin1, INPUT);
  pinMode(ButtonPin0, INPUT);
  Serial.print(78);
}

void loop() {
  // put your main code here, to run repeatedly:
  ButtonState2 = digitalRead(ButtonPin2);
  ButtonState1 = digitalRead(ButtonPin1);
  ButtonState0 = digitalRead(ButtonPin0);
  if (ButtonState2 == HIGH){
    digitalWrite(13, HIGH);
    }
    else{
      digitalWrite(13, LOW);
      }
}


texts: Programming the ATMega328P without Arduino board always returns the error: avrdude: stk500_recv(): programmer is not responding

texts:
I have a microcontroller: ATMega328P.
I don't have any Arduino Uno board.

I want to program the ATMega328P using my FTDI programmer.

But when I try to program the ATMega328P without Arduino board I always get this error:

avrdude: stk500_recv(): programmer is not responding

I've followed this YouTube Tutorial to build this.

And ended up with this diagram:

All the connections seems OK.

I choose the board: "Arduino Pro or Pro Mini" because only with this one I can choose the correct processor: "ATMega328P (5V, 16MHz)"

The port is correct: "/dev/ttyUSB0"

And as for the the programmer I've choose: "USBasp", which I don't know if this is correct. I've used this FTDI programmer to program the STM32 microcontroller and the programmer was "Serial", which I don't see the very same option here.

I'm lost, what am I missing up here?

BTW I've seen this, this and this but couldn't get it fixed.


texts:
I want to parse a large number to sync time on my arduino. For this i send it a string with the current time in Unix time format wich looks somethink like this:

  1535441277

For this I just call a php script wich echos the time() function.

But with  string.toInt()I'm unable to parse it. I suppose the number is too large for an int or a long. But I can't put it directly into the setEpoch() method from the RTCzero libary because it accepts as input datatype only uint32_t. So how can I parse large numbers on a system where double isn't implemented. And I don't just try to parse the entire HTTP-Response. I iterate thru the response and at the relevant line I write all the chars into a char-Array. I also have removed the \r and \n chars.


texts:
Hey everyone I know this is a pretty common question, and I have read/tried almost everything on all the other posts here and on the arduino.cc forums, but I have been unable to fix my problem. Basically I have been using my Arduino Leonardo for a little over a month now for all sorts of things and have never had this issue with the Arduino not showing up under the port tab on the menu. I have no idea why this just started happening to me, I am using the same cable, etc, and was hoping someone could help me out. I am on a MacBook Pro by the way.

Thanks in advance.


texts:
I'm new here. I'm not a native speaker, so pardon my English.

I just received my Arduino Leonardo today. I tried some basic calculations and stuff like blinking and LCD interfacing. Its interesting.

I am now trying to make a tachometer with the Leonardo. I'm following this tutorial.

I guess the board they've used differs from the Arduino Leonardo (ie pin 3 is interrupt0 in the Leonardo but it is pin 2 in the Arduino Uno board used in the tutorial). I tried changing the pins on the program and reconnecting the circuit but it doesn't work.

This is the code from the tutorial:

/* Optical Tachometer
 *
 * Uses an IR LED and IR phototransistor to implement an optical tachometer.
 * The IR LED is connected to pin 13 and ran continually.
 * Pin 3 (interrupt 0) is connected across the IR detector.
 *
 * Code based on: www.instructables.com/id/Arduino-Based-Optical-Tachometer/
 * Coded by: arduinoprojects101.com
 */

int ledPin = 13; // IR LED connected to digital pin 13
volatile byte rpmcount;
unsigned int rpm;
unsigned long timeold;
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void rpm_fun() {
  //Each rotation, this interrupt function is run twice,
  //so take that into consideration for calculating RPM
  //Update count
  rpmcount++;
}

void setup() {
  lcd.begin(16, 2); // intialise the LCD
  //Interrupt 0 is digital pin 2, so that is where the IR detector is connected
  //Triggers on FALLING (change from HIGH to LOW)
  attachInterrupt(0, rpm_fun, FALLING);
  //Turn on IR LED
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, HIGH);
  rpmcount = 0;
  rpm = 0;
  timeold = 0;
}

void loop() {
  //Update RPM every second
  delay(1000);
  //Don't process interrupts during calculations
  detachInterrupt(0);
  //Note that this would be 60*1000/(millis() - timeold)*rpmcount if the interrupt
  //happened once per revolution instead of twice. Other multiples could be used
  //for multi-bladed propellers or fans
  rpm = 30*1000/(millis() - timeold)*rpmcount;
  timeold = millis();
  rpmcount = 0;
  //Print out result to LCD
  lcd.clear();
  lcd.print("RPM=");
  lcd.print(rpm);
  //Restart the interrupt processing
  attachInterrupt(0, rpm_fun, FALLING);
}

Can anyone help me to fix the project? Has anyone here tried this project before?

Thank you!


texts: Arduino writes file to SD but not content to file

texts:
I'm using an Arduino UNO, the Extended Database Library (EDB), and an microSD Card to read/write 2 database tables. I've managed to create both ".db" files on the SD (they show up in Finder when I load the microSD directly onto my Mac).

I can also populate them with placeholder data, but this data does not seem to be actually written to the file (and thus doesn't survive reboot).

Also, trying dbFile = SD.open(db_name1, FILE_WRITE); returns false, even though the files do exist on the drive?

Here's my create code:

#include <SPI.h>
#include <SD.h>
#define SD_PIN 10  //SD read/write pin
#define TABLE_SIZE 8192  //256*32
#include "Arduino.h"
#include <EDB.h>

char* db_name1 = "/DB/SENSOR1.db";
char* db_name2 = "/DB/SENSOR2.db";
File dbFile;

struct sensorLog1 {
  unsigned int id;
  float input;
  unsigned int timestamp;
}
sensorLog1;
struct sensorLog2 {
  unsigned int id;
  float input;
  unsigned int timestamp;
}
sensorLog2;

// Setting up EDB object
inline void writer (unsigned long address, const byte* data, unsigned int recsize) {
  dbFile.seek(address);
  dbFile.write(data,recsize);
  dbFile.flush();
}
inline void reader (unsigned long address, byte* data, unsigned int recsize) {
    dbFile.seek(address);
    dbFile.read(data,recsize);
}
// Create an EDB object with the appropriate write and read handlers
EDB db(&writer, &reader);

void setup() {

  Serial.begin(9600);

  createDB(db_name1, "sensorLog1");
  createDB(db_name2, "sensorLog2");

  dbFile = SD.open(db_name1, FILE_WRITE);  // Doesn't work!
  if (!dbFile) { Serial.println("File does not exist"); }

}

void loop() {}

void createDB(char* db_name, char* table_name) {

  // create file
  dbFile = SD.open(db_name, FILE_WRITE);
  db.create(0, TABLE_SIZE, (unsigned int)sizeof(table_name));

  // populate with placeholder data
  for (unsigned int i = 1; i <= 20; i++) {
    table_name.id = i;
    table_name.input = 0;
    table_name.timestamp = 0;
    EDB_Status result = db.appendRec(EDB_REC table_name);
  }

  // check data
  Serial.println(db.count());  // returns '20'

  // close file to write
  dbFile.close();

}


texts: Why do my temperature sensor values become inconsistent when additional hardware is added to the board?

texts:
I have this strange problem. My TMP 36 sensor works fine when it is the only thing connected to my Arduino Uno board. The voltage measurements, and thus the temperature, are accurate and consistent. However, when I attach an LCD screen to the Uno and have a program print the TMP's measurements to the screen, the values become inconsistent, and can change up to 10 degrees F from one reading to another. (I have the sensor take a measurement every second.) This does not happen when the LCD screen is not plugged in. I decided to remove separate connectors from the screen and see when the measurements became consistent again. I tried this once and found that a ground wire that goes to connection 5 on the screen caused to value to change when I repeatedly inserted and removed it from a ground pin. The TPM values were changing even when there was nothing else connected to the LCD (it wasn't on) except for the ground wire. I don't understand how this is possible, and I don't know if this is a hardware or software issue.

I rewired the LCD screen starting with sensor wires, then ground wires, and then the two 5V connections, with one of them having a 220 ohm resistor. I did this while the circuit was powered, and watched the values for any large changes. The first change was a few seconds after I wired the last 5V wire. The sensor measured 80 degrees F and then 85 degrees F one second later. It then went to 81 for a few seconds, then 87. The values continued to change, but not by as much as previous times. By the way, the temperature in the area that the Arduino is in is about 82 degrees F.

TMP values do not change by more than 3 degrees F when the LCD is not connected to the screen. I don't understand what could be causing this. Has anyone else had this problem before, or know the cause?

Here is the layout.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);
const int sensorPin = A5;
const float baselineTemp = 20.0;

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

void loop() {
  int sensorVal = analogRead(sensorPin);
  Serial.print("Sensor value: ");
  Serial.print(sensorVal);
  float voltage = (sensorVal / 1024.0) * 5.0;
  Serial.print(", volts: ");
  Serial.print(voltage);
  Serial.print(", degrees C: ");
  float temperature = (voltage - .5) * 100;
  Serial.print(temperature);
  Serial.print(", degrees F: ");
  float fahrenheit = (temperature * 1.8 + 32);
  Serial.println(fahrenheit);
  delay(1000);
  lcd.begin(16,2);
  lcd.print(fahrenheit);
  lcd.print(" degrees F");
  float averageTemp;
  if(temperature < baselineTemp) {
    lcd.setCursor(0,1);
    lcd.print("Below room temp");
  }
}


texts:
I'm new to arduino. I'm doing a project where I need to send a RFID UID to php code. The UID will be detected by the arduino and the rest will happen at the php side. for that I need to get this UID at oho side. I'm using RFID-RC522 and arduino mega 2560. how can I do this?

also I found couple of posts about ethernet. is it the only solution for this? if I use an ethernet shield will it block any ports which I'm using on arduino for connecting the RFID things?

thank you


texts: Need debug Software that can be used with Arduino IDE

texts:
Background: I have made a standalone Arduino board using Atmega328PB.  I have written code for a clock which lights LEDs based on the time.  After a day or so it locks up.  Sometimes it reboots.
I would like to get debug software that will tell me where in the code it is locking up or crashing.
It could be a memory issue - stack and heap crashing(?).
Compiler tells me sketch is using 62% of 32256 bytes storage space. Global variables use 34% of dynamic memory leaving 1332 bytes for local variables of 2048 bytes total.

Question:  Is there relatively cheap ( < $100) debugging software that is not very complex I could use to solve this issue?


texts: How do I set up bluetooth to wirelessly control servo's connected to an arduino from my PC?

texts:
I have been working on a project that includes two servos, one is on X axis the other is Y, the Arduino takes my cursor's X,Y coordinates over a Visual C# program and translates them through the Arduino and to the two servos in order to effectively control both servo's via my mouse. The problem is that I want this to be a wireless connection from the PC to the Arduino, I've been having so many issues with it, the Arduino has a wireless signal and will connect to my PC, but once I connect the output port to the Arduino serial monitor, tera term, or any other program used in similar ways; the Arduino doesn't receive any output commands from the terminal.
Here's the source code without any bluetooth:
#include<Servo.h>

Servo serX;
Servo serY;

String serialData;

void setup() {

  serX.attach(11);
  serY.attach(10);
  Serial.begin(9600);
  Serial.setTimeout(10);
}

void loop() {
}

void serialEvent() {
  serialData = Serial.readString();
  serX.write(parseDataX(serialData));
  serY.write(parseDataY(serialData));
}

int parseDataX(String data){
  data.remove(data.indexOf("Y"));
  data.remove(data.indexOf("X"), 1);
  return data.toInt();
}

int parseDataY(String data){
  data.remove(0,data.indexOf("Y") + 1);
  return data.toInt();
}

I've tried so many different source codes to set up bluetooth, I'm not sure which one I should put on here. I feel like it could be something with the visual C# application, I don't know if it is properly communicating with the Arduino either.


texts: How can I power a servo and Arduino from the same power supply?

texts:
I have an ESP8266 NodeMCU which I'm using for an automatic blinds project. The NodeMCU struggles to power the servo on its own, so at the moment I am using a 5 V supply for the servo and a USB cable for the NodeMCU (with a common ground).

The servo is an inexpensive MG996R which is rated up to 7.2 V I've read that NodeMCU can take 5-10 V on the VIN pin.

After I'm done prototyping, I want to only use one power supply. What could I use? Ideally it would be something with just a wall adapter and then I can cut the other and connect that to servo and MCU.


texts:
I am uploading data using Thingspeak and I would like to get only values stored in a field. Is there any way to get this in a cvs http request?

When you call a cvs http url, you get:

What I am trying to get is just the value in field2: 10,10,12,12,16 without the headers.


texts: Suggest me Arduino device with USB for Mass storage

texts:
I want to make a temperature data logger by using Arduino.

I can read a data every 1sec and I want to store 30days data with date&Time.

In data logger, I want to write a temperature data with date&time in the .csv file and this file will be generated after I attaching USB.

So, Please suggest me Arduino board with USB compatible(working on 3V battery) and also suggest me EEPROM who able to store 30 days data.


texts: Having really weird experience with string concat

texts:
Having really bad day with concat. I'm not quite sure where i did wrong..
Have a look at my function below.

void sim900aSendHttp(String bid, String lati, String longi) {
  Serial.println("BUSID:"+bid+",LAT:"+lati+"LONG:"+longi);
  String httpget = "http://uumresearch.com/bustracking/update_location.php?busid="+bid+"&latitude="+lati+"&longitude="+longi+"";
  //String httpget = "http://uumresearch.com/bustracking/update_location.php?busid=KDF8860&latitude=6.533415&longitude=106.33345";
  Serial.println(httpget);
  serialSIM800.println("AT+HTTPPARA=\"URL\",\"" + httpget + "\"");
  delay(3000);
  serialSIM800.println("AT+HTTPACTION=0");
  delay(8000);
}

The problem is with:

String httpget = "http://uumresearch.com/bustracking/update_location.php?busid="+bid+"&latitude="+lati+"&longitude="+longi+"";

where serial monitor only  shows

http://uumresearch.com/bustracking/update_location.php?busid=KDF8860

missing "lat" and "longi" variables in the string concat.

Both variable confirmed available to the function as printed by

Serial.println("BUSID:"+bid+",LAT:"+lati+"LONG:"+longi);


texts: Does WiFiClient work on a Yún to send data over a certain IP and port to be received by a Python socket?

texts:
I haven't been able to get the example code from the page WiFi:Client:connect() to work on my Arduino Yún. Is this not how I'm supposed to send data over WiFi to be read by something like a socket?

If not, how would I go about doing so? (This is the only solution I've found from the internet).


texts:
I'm trying to choose between square or round LEDs.  I would like to select an LED that will "project" light and I cannot find any information comparing the two types.

Which style of LED will project light better?

Projection, for the purposes of this question, means casting light "in-line" with the LED.  For example, an LED right out of the box with straight leads plugged into a breadboard on a flat table will stand vertically.  In this case, I would like to project as much light onto the ceiling as possible.  I hope this makes sense.

If it matters, I'd like to use water clear blue LEDs.


texts:
I am attempting to play a wav file from an SD card using a Teensy 3.5. I am using this buzzer and I have the following code currently:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioPlaySdWav           playSdWav1;     //xy=557,157
AudioOutputPWM           pwm1;           //xy=889,184
AudioConnection          patchCord1(playSdWav1, 0, pwm1, 0);
AudioConnection          patchCord2(playSdWav1, 1, pwm1, 0);
// GUItool: end automatically generated code

void setup() {
  // put your setup code here, to run once:
  Serial.begin(4800);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Play");
  playSdWav1.play("sound.wav");
  delay(100);
  while (playSdWav1.isPlaying()) {
    delay (100);
  }
}

I don't know which pin is supposed to be outputting the PWM signal. I tried searching "patchCord1" to see what the parameters for it are, but was unsuccessful. The code was generated by The Audio System Design Tool.
As for the hardware configuration, I am attempting to wire the I/O pin to various PWM pins (to check for output) with no success. I have GND to Analog Ground and VCC to 3.3V (250 mA max). This is according to this diagram.
Which PIN is the Teensy supposed to output the pulses to?
Edit:
I can get the buzzer to work by using manual PWM (analogWrite), so I know that it functions.


texts:
I've recently built my Arduino Incubator, which consists of a DHT22 sensor, an LCD Keypad Shield, some fans, resistors, e.t.c.

I uploaded the sketch, and everything seemed fine. However, when I try to select the temperature and humidity I want, it won't let me change anything, and it says "Temperature: NanC, Humidity: Nan%".

What am I doing wrong? I didn't write the code myself. I copied it from a guy who made his incubator and wrote his code himself. He has the incubator project on github.

As you can see in the pictures he posted, everything appears to be working fine. What would be the problem? I don't have a lot of Arduino knowledge, although I am OK with reading and tinkering with code.

The display below, shows NaN when I try to select my own temperature/humidity. When I see the current temperature/humidity, it works fine. The sensor works with no problems at all, though I didn't connect a pullup resistor. I am going to try adding one. However, to me it seems like the problem isn't that. I get NaN errors when trying to select my own value. The buzzer beeps, the servo turns and the fan works fine. As said above, DHT sensor works and sends the values.

Useful Links:

The code (Github)

The schematic (Github)

The whole incubator project (Github)

Update - 7/1/2019
Thanks to Jot, everything works fine now! He corrected my code, and he adviced me to reset the values in the EEPROM. I would have given up the project, unless he had helped me. I have now fully finished the build, even though I plan to add some features in the future.

I want to add:

A backup power source (lead acid battery)
Bigger ventilation holes
Design improvements
The ability to control everything using the serial monitor, so I can connect to the Arduino via Internet (Using an MFP Storage Server which I have)
A larger box for more eggs
A system which turns the eggs automatically
A pump which pumps water to the sponge automatically as well

However, nothing could be done without Jot's help. Again, thanks a lot to Jot for his help, and the efforts he put in order to help me. I really appreciate that, since I have not any kind of Arduino knowledge (I'm 14 years old), and I found his advices and comments very very useful.

I have now put 5 eggs inside the incubator, and it is right now working. I am counting backwards from today, and in about 21 days I am going to have chickens!

Here are some pictures of the machine for those who are interested (or just curious!):

The incubator working, with the screen turned on:

The "egg hatching" room:
(Inside, there is a wet sponge, all the devices and of course, 5 eggs!)


texts: Mac shortcut for next window - IDE 1.8.7 problem

texts:
How do I use the keyboard to cycle through Arduino windows on a mac?

In my System preferences, I have (default):

Keyboard -> Shortcuts -> Move focus to next window =  Cmd ⌘   `

It works perfectly in all other programs, but in the Arduino IDE, it only swaps between the last two windows. If I have three(or more) windows open, it is a real pain to find the one in the background.

I am using fully updated MacOS 10.14 and Arduino IDE 1.8.7


texts: Using esp-wroom-32 without a development board

texts:
There are lots of examples on the internet on how to build Arduino from scratch such as IN THIS LINK. I will like to do the same but with the esp32.
I have this development board:

And I am able to program it with the Arduino framework/IDE thanks to THIS VIDEO.

Now the question
How can I flash my code and run it on a standalone ESP-WROOM-32 chip like this one:

I do not want to use voltage regulator etc as I am planning to run it from a 3.3V battery.
Before asking this question this was my research:

In this video (https://www.youtube.com/watch?v=n43rHugPbTg) Hugatry does exactly what I am looking for but he does not explain what pins he is using. Moreover what happens if I connect my 5v serial to the chip? will it burn?

I went directly to espressif website and looked for the schematics (https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32d_esp32-wroom-32u_datasheet_en.pdf). It is hard to understand I just want to do something simple.

This blog (http://blogs.oregonstate.edu/copaps/resources/programming-esp32-on-custom-pcb/) explains how but the pins are different than my esp-wroom-32 chip.

Looking more on the internet/youtube everyone explains how to solder it. But I haven't found a diagram that will enable me to flash it and run my code. Also will I have to burn a bootloader like with arduino?
What I am about to try is to buy a 5V to 3.3V serial converter connecting TX with RX and RX with TX. Providing 3.3V power to the 3.3V pin and connect the last cable to ground. If I try that will it work?


texts:
I am trying to use this library to print QR codes using Arduino. There is a limit on the number of characters allowed in the string to be printed.

printQR("This is the string to be QR encoded !!! Tralalala. Some other random characters !!!");

When I scan the generated QR code, the string seems to be truncated. Did anyone run into this before? Or is there any way to get around this issue by raising the number of characters allowed in the string?

Thank you.


texts:
I've got an old rc car laying around, of which i would like to swap the insides, but re-use some of the parts that are already in there. The car runs 2 dc motors: one for steering, one for throttle. The dc motors are both connected to H-bridges in the original setup to make their direction switchable. This is done via 8 transistors. 4 for the throttle and 4 for the steering.
The transistors for steering are 2x S8050 (NPN) and 2x S8550 (PNP).
For throttle it uses 2x 2SD882 (NPN) and 2x 2SB772 (PNP).
I found a schematic in an online post of a arduino H-Bridge setup. It look promising, but it uses 2n4403 and 2n4401 transistors. I was wondering if I could copy the schematic, replace the Arduino 5v power source (as depicted in de schematic) with the battery voltage source of the car, and replace the transistors in the schematic with one pair of the transistors I described above (so 2x 2SD882 and 2x 2SB772 or 2x S8050 and 2x S8550) Would the arduino be able to switch the described transistors? Would the 1K ohm resistors in between the arduino and the transistors suffice?
I am planning on making this schematic twice, once for throttle and once for steering. The throttle output is max 11.5v and the steering uses around 5v. Therefore the throttle circuit would be powered from the battery voltage and the steering circuit would be powered of a 5v regulator.
Can this be done this way?


texts:
What is the maximum current that can be supplied to an Arduino Mega board before frying/breaking?

Basically i have several components connected to my board which draw a total current of 1.6A (which i calculated through a table), and thinking of using a 9V 2A power supply. I know that the arduino voltage limit is 7-12V but just wondering about the current as I can't find it on the datasheets?

Thanks in advance!


texts:
Does anyone know where I can find a Chlorine Sensor to use with the Arduino? It would need to be water proof. I've googled, but I couldn't find anything.

EDIT
Requirements: relatively inexpensive (under $100us), works with Arduino, waterproof and used to detect chlorine in water.


texts:
I'm trying to make an RC controller.
I have a problem with my LCD.

I have already double-checked the wiring and the connections are great.
I made a PCB with Kicad and order it to JLCPCB. I have some mistake, you can see the soldered wire.

Before the PCB, I did my project with a breadboard and it worked fine.
const String menuElem[4] = {"Models", "Trims", "Reverse command", "Channel"};

const int rs = 3, en = 4, d4 = 5, d5 = 6, d6 = 7, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void menu() {
  lcd.clear();
  //lcd.setCursor(0,0);
  //byte pos = 0;
  //int sizeOfanArray = *(&array + 1) - array;
  byte menuElemLength = *(&menuElem + 1) - menuElem;
  for (byte i = 0; i < menuElemLength; i++) {
    lcd.setCursor(2, i);
    lcd.println(menuElem[i]);
  }
  showMenuNav(currentMenuPos);
}


texts:
For whatever reason the delay function is not working (it is not delaying at all) with my ESP32 development board. Has anyone come across a similar issue before? It's not working with other sketches, in either the loop or set up functions. A sample sketch:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <BleMouse.h>

// mouse object
BleMouse ble("test", "me");

/** I2C pins **/
#define I2C_SDA 33
#define I2C_SCL 32

// I2C object
TwoWire wire_custom = TwoWire(0);

// Sensor object
Adafruit_BNO055 bno = Adafruit_BNO055(55, 0x28, &wire_custom);

/**************************************************************************/
function definitions
...

/**************************************************************************/
void setup(void)
{
  wire_custom.begin(I2C_SDA, I2C_SCL, 400000);

  Serial.begin(115200);

  ble.begin();

  if (!bno.begin())
  {
    Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
    while (1);
  }
  delay(1000);
  bno.setExtCrystalUse(true);

  // updating range
  bno.setMode(Adafruit_BNO055::OPERATION_MODE_CONFIG);
  delay(1000);
  write_register (0x28, 0x0A, 0b00111010);
  bno.setMode(Adafruit_BNO055::OPERATION_MODE_NDOF);
  delay(10000);
  byte result = read_register (0x28, 0x0A, 1);
  Serial.print(result);
  Serial.print("\n");
  Serial.print("\n");
}

/**************************************************************************/
void loop(void)
{
  sensor_calibration ();

  sensor_data (x_placeholder, y_placeholder);

  transform_sensor_data (x_placeholder, y_placeholder, x, y);

  if (ble.isConnected()) {
    ble.move(x, y);
  }
}


texts: Is there any way I can program an Arduino using another Arduino,without the need of any computer. I want to store the programming code in the EEPROM of the "Programmer Arduino" and using any interface like SPI, I2C or Serial, burn this code to the Second arduino. Is it possible? How can it be implemented ?


texts: Determine what size power supply I need to run stepper motors

texts:
I have recently purchased two 7.4V, 1A, Planetary Gear Unipolar Stepper Motors as well as two Cytron 3A 4-16V Dual Channel DC Motor Drivers. I was told that I would need these to run the motors off an Arduino board. The question I forgot to ask was: what size power supply I would need for something like this?

I am just looking to learn how to code these arduino boards. I was hoping to get something that I could plug into a wall to save me from buying multiple batteries.


texts: Temperature sensor reading is higher than the actual temperature

texts:
// Tells the Arduino to read A2 and stores the value in “Vin”
Vin = analogRead (tempSensor);

// Converts the voltage value to temperature and stores it into the “TC” variable (in °C)
TC = 500.0 * (Vin / 1024.0);

The temperature shown is about 50.25°C, sometimes it is showing 36-38°C   degrees, but the actual temperature is about 25-26°C.

Why this is happening?

Code:

Vin = analogRead (tempSensor);
TC=(500.0*Vin)/1023.0;
TF = ((9.0*TC)/5.0)+32.0;
lcd.setCursor(0, 1);
lcd.print(TF);
lcd.print((char)223);
lcd.print("F ");
lcd.print (TC);
lcd.print((char)223);
lcd.print("C");
delay(1000);


texts: Basic if endif not working and I'm puzzled

texts:
I got this small code I'm trying things on for like an hour.

int receivers = 0;
#if defined(PPM_RECEIVER)
  receivers++;
#endif

And I just cannot get it working, It keeps returning a "'receivers' does not name a type" on line 4.


texts:
I need an answer fast.I want to make a keyboard class to handle a few buttons attached to my arduino. I want to use interrupts.The problem is I have to use the same interrupt function for all my buttons(it would beimpractical to create a routine for each button).So inside the routine I must know at least what pin fired the interrupt. How can I solve this?(I belive it can be solved by changing some registers but that would be too complicated).PS:there are only two buttons(pins 2 and 3 are enough)

Edit:
   Isn't possible to create/call an interrupt routine inside a class? (I know that the routine actually doesn't exist initially because the object of the class type wasn't created). Can this be done?

class Keyboard{
  private:
    struct btn{
      boolean pressed;
      uint32_t pressTime;
    };
    btn button1;

  public:
    void int_handler(){

    }
    Keyboard(){
      attachInterrupt(digitalPinToInterrupt(2),this->int_handler,RISING);
      attachInterrupt(digitalPinToInterrupt(3),this->int_handler,RISING);
    }
};


texts: Serial comms failure after long time - can't open COM port

texts:
I've been using an Arduino UNO to log data: it's queried by a LabView VI over a VISA connection. It'll happily sit there and log for days, but very occasionally one of the VISA functions will fail.

After this, I can't open the COM port again (in LabView or elsewhere) and the only way to restore communication is to unplug and replug the USB cable. The Arduino hasn't crashed because I can see the other results of the program it's running working fine, but Serial comms are a gonner.

Has anyone experienced this? Do you know if this is an Arduino problem, a Labview problem, a Windows problem? Or something else?

I'm writing a minimum working example to try and catch this happening in the most simple code possible, but since the error usually takes several days to show up I can't tell you the results yet!


texts:
I'm trying to repurpose an RGB LED (pictured) and use an Arduino board I've just gotten to reprogram the lights. I'm very new to electronics engineering and I don't really know how to get started. How would I connect it to the Arduino? What kind of wire(s) would be best for soldering this to as well as connecting to the Arduino? Can this be programmed like any other LED?
Images:
https://i.stack.imgur.com/u14Bd.jpg
https://i.stack.imgur.com/2inQB.jpg


texts:
I'm using this library for my DS3231 which have a Atmel 24C32 on it.
i have a float value which increases by 0.5, like:

27.50

28

28.50
...

the code is like this:

float lowTemp= 10.5

float highTemp= 10.5

void setup(){
  lowTemp = i2c_eeprom.read(100);
  highTemp = i2c_eeprom.read(101);
}
void loop(){
  if ((menuswtichStatus == HIGH) && (lcdWelcome == HIGH)) {
    previousMillis = millis();
    lcd.clear();
    menuScroll++;
    lcdClear = 1;
    lcdClear2 = 1;
  }
  if (menuScroll == 1) {
    lcd.setCursor(0, 0);
    lcd.print("Temperature set:");
    lcd.setCursor(0, 1);
    lcd.print("Minimum  ");
    lcd.print(lowTemp);
    lcd.print((char)223);
    lcd.print("C ");
    if (plusSwitchstatus == HIGH) {
      lowTemp += 0.5;
    }
    if (minusSwitchstatus == HIGH) {
      lowTemp -= 0.5;
    }
  }
  if (menuScroll == 2) {
    lcd.setCursor(0, 0);
    lcd.print("Temperature set:");
    lcd.setCursor(0, 1);
    lcd.print("Maximum  ");
    lcd.print(highTemp);
    lcd.print((char)223);
    lcd.print("C ");
    if (plusSwitchstatus == HIGH) {
      highTemp += 0.5;
    }
    if (minusSwitchstatus == HIGH) {
      highTemp -= 0.5;
    }
  }
  if (menuScroll == 3) {
    lcd.setCursor(0, 0);
    lcd.print("   Saving the");
    lcd.setCursor(0, 1);
    lcd.print("   Settings...");
    delay(1000);
    i2c_eeprom.write(100, lowTemp);
    i2c_eeprom.write(101, highTemp);
    delay(1000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("    SETTINGS");
    lcd.setCursor(0, 1);
    lcd.print("     SAVED!");
    delay(2000);
    menuScroll = 0;
    lcdClear = 0;
    lcdClear2 = 0;
  }
}

i have the library and stuff up there, it's just an example of my code...

The float value is not saving(written), what's the solution?


texts: TinkerCAD switch seems to be not working (always closed)

texts:
I am using TinkerCAD to simulate the functionality of a slide switch. Please comment if you think this question is off-topic.

/*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */
#include <LiquidCrystal.h>

const byte pin8 = 8;

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  Serial.begin(9600);      // open the serial port at 9600 bps:
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("Welcome.");
}

void loop() {
  byte val = digitalRead(pin8);
  Serial.println(val);
  if(val == HIGH)
  {
    lcd.setCursor(0, 1);
    lcd.print("Switch on right.");
  }
  else
  {
    lcd.setCursor(0, 1);
    lcd.print("Switch on left.");
  }
}

The serial monitor and the output of the LCD screen are showing the slide switch to always be on the right side (not creating an open circuit when the switch is on the left side).

As seen in the picture, the switch is on the left. And the code, I think, is correct. So it should display, "Switch on left." This is because pin8 is low (not connected to 3.3V).

So I'm very confused. The switch appears to be shorting all three rails to which it's connected. When the switch is removed, that part becomes open; pin8 is low.


texts:
Simple question: I'm researching before buying. Can any of the Arduino products output current on a 4-20mA scale? I've seen them with Analog inputs but not outputs. And if they do not, are there add on cards/Shields/Modules that you can add to use that as a function?

Thanks a bunch!


texts: Does the ESP8266 somehow remember wifi access data?

texts:
Today I did some tinkering with an ESP8266, trying out OTA and writing a webserver. To find an error, I reduced the sketch to just the following lines:

#include <ESP8266WebServer.h>

ESP8266WebServer server(80);

void setup() {
  Serial.begin(115200);
  server.on("/", []() {
    Serial.println("Sending response...");
    server.send(200, "text/plain", "Hi there!");
  });
  server.begin();
}

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

Notice that there is no code to connect to a Wifi network. However, the chip still connects to my local, WPA2-secured, network on every boot. I can ping the chip, my browser can get the "Hi there!" message via http, the Serial message gets printed.

How is this possible? Does the ESP8266 somehow retain the Wifi information, maybe because of some old OTA data that was not completely overwritten?

I'm using platformio. Here's my entire platformio.ini:

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino

I posted the compile and upload log here: https://pastebin.com/BtGrFZiu


texts: driver is not showing up in Port assignments mac

texts: arduino nano, the driver is not showing up in Port assignments. It has worked with this operating system before. I’ve messed something up.  “OS X EI Capitan ver. 10.11.3 I have check the posts but the serial port is a no show


texts: Unreliable function of transistor, pump and ESP32

texts:
I have a 12 VDC pump, 8.5A, connected to a MOSFET transistor PSMN5R6-100PS,127.
The connection from the transistor to transformer, pump and a ESP32:
1    Gate   --> port to ESP32
2    Drain  --> (-) pump
3    Source --> Gnd ESP32, (-) transformer
(+) transformer to (+) pump
This is, as I understand it, how it ought to work. But with this configuration it doesn't...
But changing 3    Source --> (-) transformer, removing the Gnd connection to the ESP32, then it works. It, however, seems to be some kind of leakage in terms of current because the pump has a "clucking" sound, not fully activating, just making a sound. Sometimes it doesn't work at all, where a reset makes it work again. Any ideas how I can fix it reliably?


texts: I have bought 10 Arduino Mega 2560 clones and all of them have the same problem. When I connect the to my PC I get a message that windows cannot recognize that device and the LED at the board in R17 blinks non stop. normally this led stops when the arduino is ready. Also in the Arduino IDE I don't see the port option enable.


texts: changing bitrate of audio recording and taking samples from audio in arduino

texts: I am looking to make a baby cry detection module that is a part of a bigger project i.e. IOT based baby monitoring system. Using AI, i have a dataset (of baby crying and not crying) to train model using binary classification through logistic regression. The problem is that the dataset has a 10kbps sample rate. and arduino records audio on 192kbps probably. so i need the arduino recorded audio to be 10kbps. secondly i need 100 weights or samples from the arduino recorded audio. so lets say the audio is of 5 seconds, so i need a sample after every 50ms so that the total samples would be 100. the main problem is i don't know how to take samples from an audio being recorded or a prerecorded audio using arduino. The 100 samples would then be multiplied by the 100 samples from the trained model and then added and then sigmoid function will be used so that at the end we can know whether the baby is crying or not. All the deployment of the model will be done in arduino. Any help regarding taking the samples or bitrate, would be much appreciated. Thanks in advance! :)


texts: Connect multiple pins to same VCC using breadboard

texts:
Ok so I am pretty green as far as AVR programming is concerned so bear with me.

I am doing a project with an ATmega32 MCU on a dev board which has 4 VCC pins.
The project includes a GPS, SD card and a TFT display. Currently, the GPS and SD card take up 2 out of the 4 VCC pins for powering themselves up. I have two free left.

The display controller I have is the SSD1289:

I've connected it to my MCU, the VCC pin on the display took up one more VCC pin so I have one VCC left.
I've been reading up and I've found that the LED_A and RD pins need to be connected to 3.3V, that is VCC.
The LED_A pin should also have a resistor on the line connecting it to VCC.

First question - can someone confirm this is the way to connect it?

Second question - Is it possible to, for example, connect the VCC and RD pins of the display to the same VCC using a breadboard? So then I have one VCC left to connect to LED_A pin through a resistor? I don't know if multiple pins can share the same VCC. Will the voltage drop if I connect two pins to it?
Is this safe to do?


texts: Consulting and inserting a string into an array if it doesn't exist (Arduino IDE) 1

texts:
Sorry that I repeat my question, I can't enter to my user...

In the project I'm doing, I connect an arduino mega with ethernet and Post some Strings to the server. The arduino mega has a receiver(315MHz). I have some arduinos nano connected with PIR sensors that sends a some int with transmitters (315MHz). What I want to do is a list in my arduino mega that stores the values sent by the arduinos nanos to use them to my server (using POST). my question is the following:

If I had an empty array, what I would like to do is

listOfSensors[]={}

void funtion (String sensor){
    if (sensor is inside listOfSensors){
         //dont do anything
    }
    else {
         add sensor to listOfSensors
    }

I have been looking for hours, but I haven't found anything so far... Anyone has any idea? Thanks!!


texts: Can I connect an RFID reader to the ICSP header?

texts:
I am connecting an RFID reader to my Arduino mega.  The directions that I have found say that I need to use pins 50-53.  I also noticed that the ICSP header contains (what looks like) a secondary connection to these pins:

http://arduino.cc/en/Reference/SPI

Can I connect my RFID reader to the ICSP header:


texts: How do I update library h-file in arduino create online editor?

texts:
I'm working on a sketch that includes i2c with a SSD1306 OLED and need to update a constant in Adafruit's h-file in the library.

How can I do this in the online editor?

/Jonas


texts: Can I use this replacement motor without modifying the circuit?

texts:
I have a demo that spins a motor, but the leads on my motor broke. I happen to have another motor lying around that I'd like to swap in, but it's of a different type. Here's my circuit:

This is the old (broken) motor: https://www.sparkfun.com/products/11696. It has an operating voltage range of 1.0 to 3.0V DC and a no load speed of 6600±10% RPM (@1.0V DC, 110mA).

The new motor that I'd like to use is part of this kit: https://www.sparkfun.com/products/12866. It's a 6VDC motor with a No Load Speed of 90±10rpm and a No Load Current of 190mA(max.250mA).

I'm running this off a Sparkfun Redboard, which is UNO R3 compatible.

Can I swap in the new motor without any circuit changes? Will I have to add additional power for the new motor? Or should I change the circuit with a larger resistor or something else?


texts: local libraries and include dependencies

texts:
I'm using PlatformIO in Atom for Arduino programming. I get dependencies error when build. This is my reproduction sample code:

/lib/mylib/mylib.h

#ifndef MYLIB_H
#define MYLIB_H

#include <Arduino.h>

void fn();

#endif

/lib/mylib/mylib.cpp

#include <mylib.h>

void fn()
{
  Serial.println("fn1");
}

/lib/mylib/myclim.h

#ifndef MYCLIM_H
#define MYCLIM_H

#include <Arduino.h>
#include <DHT.h>

void fnclim();

#endif

/lib/mylib/myclim.cpp

#include <myclim.h>

void fnclim()
{
  Serial.println("fnclim");
}

/src/main.cpp

#include <Arduino.h>
#include <mylib.h>
#include <myclim.h>

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

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

The above code is compiled without errors. But, if I remove the line #include <myclim.h> in main.cpp, I get the follow error:

Processing pro16MHzatmega328 (platform: atmelavr; board: pro16MHzatmega328; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/pro16MHzatmega328.html
PLATFORM: Atmel AVR > Arduino Pro or Pro Mini ATmega328 (5V, 16 MHz)
HARDWARE: ATMEGA328P 16MHz 2KB RAM (30KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf

LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 17 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <mylib>
Compiling .pioenvs/pro16MHzatmega328/src/main.cpp.o
Compiling .pioenvs/pro16MHzatmega328/lib2cc/mylib/myclim.cpp.o
In file included from lib/mylib/myclim.cpp:1:0:
lib/mylib/myclim.h:5:17: fatal error: DHT.h: No such file or directory

*************************************************************
* Looking for DHT.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:DHT.h"
* Web  > https://platformio.org/lib/search?query=header:DHT.h
*
*************************************************************

compilation terminated.
*** [.pioenvs/pro16MHzatmega328/lib2cc/mylib/myclim.cpp.o] Error 1

I'd like to know why it is happen. Some times, I need include myclim.h in main.cpp, but sometimes I don't. Why is it happens if DHT dependency is ok?

Thank you!


texts: SPI Arduino slave not recieving data correctly

texts:
Using an STM32L476RG Nucleo microcontroller board as the SPI master and an Arduino mega as a slave with pin 52 for SCLK, pin 53 for SS and pin 51 for MOSI on the Arduino. There is no issue with the STM32 transmission as the USB logic analyzer I'm using (parallel to the arduino) shows a correct output on the master side so this is an Arduino issue:

The problem is the Arduino isn't recieving properly. The arduino code:
    #include <SPI.h>
#include<stdint.h>
#define SPI_SCK 52
#define SPI_MISO 50
#define SPI_MOSI 51
#define SPI_SS 53
char dataBuff[500];

//Initialize SPI slave.
void SPI_SlaveInit(void)
{
  // Initialize SPI pins.
  pinMode(SCK, INPUT);
  pinMode(MOSI, INPUT);
  pinMode(MISO, OUTPUT);
  pinMode(SS, INPUT);
  //make SPI as slave

  // Enable SPI as slave.
  SPCR = (1 << SPE);
}

//This function returns SPDR Contents
uint8_t SPI_SlaveReceive(void)
{
  /* Wait for reception complete */
  while(!(SPSR & (1<<SPIF)));
  /* Return Data Register */
  return SPDR;
}

//sends one byte of data
void SPI_SlaveTransmit(char data)
{
  /* Start transmission */
  SPDR = data;
  /* Wait for transmission complete */
  while(!(SPSR & (1<<SPIF)));
}

// The setup() function runs right after reset.
void setup()
{
  // Initialize serial communication
  Serial.begin(9600);
  // Initialize SPI Slave.
  SPI_SlaveInit();
  Serial.println("Slave Initialized");
}

// The loop function runs continuously after setup().
void loop()
{
  uint32_t i;
  uint16_t dataLen = 0;
  Serial.println("Slave waiting for ss to go low");
  while(digitalRead(SS));

  i = 0;
  dataLen = SPI_SlaveReceive();
  for(i = 0 ; i < dataLen ; i++ )
  {
    dataBuff[i] =  SPI_SlaveReceive();
  }

  //  Serial.println(String(i,HEX));
  dataBuff[i] = '\0';

  Serial.println("Rcvd:");
  Serial.println(dataBuff);
  Serial.print("Length:");
  Serial.println(dataLen);
}

The message i'm transmitting is my full name and is 12 characters long. The master first sends the length of the message (12 in this case) so the arduino knows how many characters to recieve and then the message is transmitted. On the logic analyzer output everything looks fine and I can see the message. However I keep getting results like this in the Arduino serial monitor:

I should also note I'm using a sparkfun logic level converter between the master and slave to step the STM32 3.3v signal to 5v for the arduino input: (Imagine the arduino is not uno but master in the following image with the pins changed to the ones I've listed above)

I'm seeing no message next to 'Rcvd:' and a length of 0 most of the time, if not than a number much larger than 12. What seems to be the issue?


texts: uSDaemon in Linino / Arduino Yun Mini hogging the syslog

texts:
There is an annoying problem with Linino One / Arduino Yun Mini as the syslog (logread) is full of messages from uSDaemon, complaining about missing files.

ls: /sys/bus/scsi/drivers/sd/*/block/sd?: No such file or directory
handle umount errors
check umount

(and so on, three lines every two seconds, so every other meaningful information is pushed out of the syslog pretty soon)

If I disable the uSDaemon with
/etc/init.d/usd disable
the syslog is OK, but is there any functionality actually lost if uSDaemon is not running, beside being unable to read from a non-existing uSD card reader?


texts:
For a project of mine I have always wanted to build an electronic load and I am mostly done. However I have found myself stuck at one part that I thought would be simple but has thus only caused headache.

The problem is that I have a keypad connecting along with a TFT display to an Arduino. I want to enter for example my current for the electronic load and display the value that I set on my display. I have tried the simple code for keypads that is available on tutorials all over the web but what happens is that it displays the key I press but if I press another one it erases the first and displays the second in the same spot. I want to be able to have 4 or 5 digits that can all show up in order. I have found some different code and modified it. I can now display multiple digits but the issue is that if I press for example 4 a 4 will show up but if I press a 5 another 4 will show up and then if I press a 5 again then a 5 will show up on and on.

Additionally it resets the screen even though I don't have a reset function in my code. So every time I press a key the screen will reset to white and then show the numbers. If anyone has time to help me out it would be greatly appreciated.

EDIT: Thank you for everyone's help and I have solved the problem. However I haven't found a way to incorporate a decimal point into it. This code is the code that works except for the decimal point.

  #include <Keypad.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

String v1;
String num;

const byte ROWS = 4;
const byte COLS = 4;

char hexaKeys[ROWS][COLS] = {
  {'1', '4', '7', '*'},
  {'2', '5', '8', '0'},
  {'3', '6', '9', '.'},
  {'A', 'B', 'C', 'D'}
};

byte rowPins[ROWS] = {31, 22, 23, 24};
byte colPins[COLS] = {25, 26, 27, 28};

Keypad kpd = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS );

#define BLUE    0x001F
#define WHITE   0xFFFF

#define DATAOUT 11//MOSI
#define DATAIN 12//MISO
#define SPICLOCK  13//sck
#define SLAVESELECT0 10//ss

void setup()
{
  uint16_t id = tft.readID();
  tft.begin(id);
  tft.setRotation(1);
  tft.fillScreen(WHITE);
  tft.setTextColor(BLUE, WHITE);
}

void loop() {
  v1 = GetNumber();
  v1.toInt();
}
String GetNumber()
{
  char key = kpd.getKey();
  // while (key != '#')
  {
    switch (key)

    {
      case NO_KEY:
        break;

      case '0': case '1': case '2': case '3': case '4':
      case '5': case '6': case '7': case '8': case '9':
        num = num + key;
        tft.setTextSize(5);
        tft.setCursor(10, 50);
        tft.print(num);
        break;
    }
    key = kpd.getKey();
  }
  return num;

}


texts: How do I send an arduino PIN state to a local PC using the ethernet connection?

texts: As a PIN goes high I need to trigger an event that will send the IP or MAC of the arduino and the PIN state over the wired Ethernet to a local computer. I am using an Ethernet shield to send and receive from the arduino but I am stumped on how to send and process the information at the PC. I will have 42 Arduinos on the network all set to send PIN information over the wired Ethernet. Sounds simple but after a days research I am now looking at other solutions.  I currently have the faithful Uno with the network shield as my prototype. For the final install I can purchase any of the arduino range like the Yun,Duo etc. if this would help. Any direction would be welcomed.


texts:
I'm currently struggling interfacing an SPI device using just 3 pins (CLK, DATA, NSS).

Wiring up? Connecting MOSI/MISO together?

How do i read since it's half duplex?

In ESP32 there are flags which can be set (SPI_TRANS_USE_RXDATA, SPI_TRANS_USE_TXDATA). How can i accomplish this in the Arduino environment? i didn't see a such option and the API seems a little bit limited.

Thanks for any advice.


texts: UART communication - Serial is always empty

texts:
I have a payment terminal which uses UART (or simply speaking Rx, Tx, Gnd pins) and I have an Android tablet app which is connected to the terminal using USB to DB9 adapter based on PL2303 chip. The Android app works well and it uses https://github.com/felHR85/UsbSerial to support serial communication. The protocol is very simple, basically Android sends strings like "REQINFO,4", "L2,xxx,xxx,*" etc. and recieves back a string statuses.

I'm trying to replace Android app with Arduino UNO, for which I naively assumed would be enough just to connect Tx,Rx of the terminal with Rx,Tx pins of the Arduino and also to connect Gnd pins. But I can't get it working. The only thing I noticed is when I connect Arduino Rx to terminal Tx, the terminal's screens briefly shows "Connecting..." but that's probably because it detects some incoming voltage. When it comes to reading Serial (or also I tried SoftwareSerial) nothing is ever returned.

String data = "";

void setup() {
  Serial.begin(9600);
  while (!Serial);
  delay(1000);
  Serial.println("REQINFO,4");
  delay(1000);
}

void loop() {
  if (Serial.available())  {
    char c = Serial.read(); // also I tried readString() and readStringUntil()
    if (c == '\n' || c == '\r') {
      Serial.println(data); // jsut to see it in the montor
    } else {
      data += c;
    }
  }
}

So do I miss anyting in order to have a proper communication? Thanks.


texts: Change/declare a constant in setup and use it in loop

texts:
I want to change or declare a constant in the setup() and then, I want to access it in the loop().
I have searched a lot, but the only questions I found could be solved by declaring the constant in the beginning of the program. That doesn't work for me because I am using the Adafruit BMP388 and I can't use the pressure before the setup().
I also tried declaring the variable before the setup() and changing it inside the setup(), but it didn't change when I used it in the loop().
How can I solve this?


texts: what will be the sampling frequecy of my arduino Mega 2560 code. How would I calculate it?

texts:
void setup() {
    // initialize the serial communication:
    Serial.begin(9600);
    pinMode(10, INPUT); // Setup for leads off detection LO +
    pinMode(11, INPUT); // Setup for leads off detection LO -
}

void loop() {
    if ((digitalRead(10) == 1) || (digitalRead(11) == 1)) {
        Serial.println('!');
    }
    else {
        // send the value of analog input 0:
        Serial.println(analogRead(A0));
    }
    //Wait for a bit to keep serial data from saturating
    delay(1);
}

EDIT

This sketch is for plotting raw ECG signal having a baud rate of 9600. but when I use these data for calculating heart rate then I want sampling rate for calculation but I don't get the value by this sketch. How will I calculate the frequency from the coming raw data? As it does not show a clear picture.


texts: How to clear of contents of string in Arduino?

texts: Currently I convert the characters in char received[20] to string using String randomString(received) and I am able to display it using Serial.println(randomString). After displaying the string, I would like to know the easiest way to clear out its contents.


texts: LED Matrix Display with dissimilar brightness

texts: So far I have seen in LED matrix related projects that the brightness is controlled in an entirety manner. That means the   brightness of total display can either be reduced or increased. How can we display only a part of the display with more brighter than the remaining matrix? Appreciate if anyone provide some pseudo logic to achieve this.


texts: Simulink with arduino : data acquisition

texts:
I'm working on data acquisition from a sensor attached to the Arduino : MPU6050 using a model in Ssimulink. I have installed the hardware support in Simulink but I don't know how to start building the model. The model must read the data from the Arduino by deploying it into the Arduino.

My connection Arduino <=> MPU6050 is :

Arduino    MPU 9150
3.3V       VCC
GND        GND
A5         SCL
A4         SDA
DIGITAL 2  INT
GND        AD0

update : i have use a s-function but I get the following error:
_The call to realtime_make_rtw_hook, during the after_make hook generated the following error: Could not download the model to the target hardware. Verify the connection between the computer and target hardware.

The build process will terminate as a result.

Caused by: Could not download the model to the target hardware. Verify the connection between the computer and target hardware._

But the target is definitely connected, and downloading others module (like led blinking ) with simulink is working fine. I've also tested this on a different PC with Windows 8 (64bits) with the same result. Can anyone give me a hint please?


texts: What does []() argument in function mean?

texts:
I am working in ESP8266 AsyncWebserver library and have been using this [](parameter) as an argument to some functions as shown below but does not really know what it means. Being a neophyte I am curious to know what does this convention means, its functionalities and how to use it. Hopefully experts here would help me with this.

server.on("/page",HTTP_GET,[](AsyncWebServerRequest * request){
    some code....;
    request->getParam("Param1")->value();
});


texts: Are any Arduino boards especially suited for low-power operation?

texts:
The Arduino project has done an excellent job in providing a portable software interface to a number of different hardware systems.

Are there any Arduino-compatible systems which are especially applicable for very low power battery-based operation?  Specifically, in an application where a device wakes up periodically (e.g. for data collection) or activated by a user button press?


texts: Possible to determine at runtime whether a pointer is declared PROGMEM?

texts: Is it possible to determine at runtime whether a pointer points to PROGMEM'ed values or regular values? This would give some flexibility when writing code that handles both.


texts: Decreasing large DC motor power usage by coasting

texts:
I'm working on a class project - an electric bike competition. Part of the requirements for the final grade is having a "race advantage system" on your bike. Basically, just something unique that will give you an edge in a final competition where the winner is the bike that goes the furthest on motor power in half an hour. Speed doesn't matter. I was thinking of using an Arduino is some way to do this.

We're using 2 12 volt, 7 amp hour batteries which could be powered in series or parallel. The motors are pretty large, I didn't get any specifics on them though.

My idea was to let the motor coast when it reaches a certain speed, and to turn it on again once it goes under it. I would have to do this with a relay because of the high amounts of electricity we're working with (unless someone knows of a transistor that could handle that while being powered by an Arduino, but I couldn't find one).

My question is: Would repeatedly coasting and starting the motor based on the bike speed increase the "lifetime" of the motor on limited battery power?

The only concern I have is starting the motor again. I'm afraid that could be the point where the most power is consumed, and would make this idea useless. I've searched for similar things online, but I haven't found anything about it. I hope this fits in Arduino, I wasn't sure whether to post it here or electronics.


texts:
How do I wire an L293D motor controller chip to a nodeMCU?
I have tried to follow the instructions from this tutorial: lastminuteengineers.com
One problem. I don't have a 5v pin?
Are there any alternative ways to wire this?
All of the other tutorials i see, only say to use a special other motor driver board with an L293D embedded in it, and with extras connected to the board.


texts: I searched for answers but I didn't found any answers to my problem. Actually, I use my Arduino with a 16x2 LCD screen. But as the title says, only the half of the screen displays (8x2), the other side just doesn't turn on. Do someone knows how to solve this problem?


texts: I need to determine the flash size of my ESP8266 on my NodeMCU module in order to flash the AT firmware onto the board. Apparently different boards come with differently-sized flash memories. Can anyone tell me the easiest way to find the flash size?


texts:
I want to create a simple module in which a GPS transmitter moves and transmits positional data to the Arduino board via a Bluetooth Transmitter.
Basically, I need a two-piece bluetooth set, in which the transmitter is attached to the GPS and the receiver is attached to the Arduino UNO.
I would like for the GPS to be able to move from far away.

How would I do this? Does anyone know what products can do this? Would I use TinyGPS or a simple GPS module?

Thanks,
Mark


texts:
Project(skip to here if you don't care): I wanna use the rfid tags as products that i send to a mobile app and from there a suite of different applications.
I succeded with a mfrc522 but only for 3cm since that was max for that. Now i am looking to get at least 10cm and i bought the sparkfun rfid and id-la20.

Problem(here):I have an sparkfun rfid qwiic reader but i don't have a qwiic cable.
Also i am using an arduino uno R3 and an id-20LA. I am looking for wiring and code to read a simple rfid tag.

Also, unrelated question. If i wanted to read with this setup and after that add a bluetooth send the id tag via bluetooth on an android app. Both bluetooth and rfid would be on software serial. I saw that uno supports only 1 serial at a time. My question. Should i get an arduino Mega?


texts:
According to the ATmega328P datasheet, the total current from all I/O pins must not exceed 200mA.

Let's say that an Output pin sources 30mA and an Input pin sinks 10mA. The total current should be 30+10=40mA or 30-10=20mA?


texts: Encoder coupled with motor shaft.Encoder is giving larger redings than expected

texts:
I am a rookie and i dont have much experience on arduino. please help me.
I intend to build a robot that will drive on a straight path even on nonuniform surfaces like the ones we see in agricultural fields(It is just a prototype, so i want to run it on normal offroad surfaces).The robot has 4 motors, one for each wheel. I plan to use encoder feedback method to drive straight.
Right now, I have coupled a slotted disc to the shaft of a dc motor and i am trying to get the counts from the encoder and display the count after a certain interval(5 seconds) on serial monitor. The count that i get is way off the mark. The disc is having 30 slots. With just 2 to 3 rotations I am getting a count of around 180.

I am using arduino R3.
Encoder output:- Pin2 (external interrupt)
motor Pins :- 8,9
I am attaching the code below.

const int motorPin1  = 8;  // Pin 14 of L293
const int motorPin2  = 9;  // Pin 10 of L293
const int encoder_pin = 2;
volatile unsigned int count = 0;
 int time1 = 0;
 int time2 = 0;
void setup() {
  // put your setup code here, to run once:
  pinMode(motorPin1, OUTPUT);
    pinMode(motorPin2, OUTPUT);
    pinMode(encoder_pin,INPUT);
    digitalWrite(encoder_pin,HIGH);
    attachInterrupt(0,encoder,RISING);
    Serial.begin(9600);
     digitalWrite(motorPin1,HIGH);
    digitalWrite(motorPin2,LOW);
    time1 = millis();
}

void loop() {
  // put your main code here, to run repeatedly:
    time2 = millis();
    if(abs((time2 - time1) > 5000))
    {
    digitalWrite(motorPin1,LOW);
    digitalWrite(motorPin2,LOW);
    Serial.println(count);
    }
}

 void encoder()
 {
  count++;

 }

the end of code

The disc that i have mounted on the shaft doesn't rotate in vertical plane exactly. But i do get the blinks on the encoder when i rotate the shaft with my hand.Can that misalignment be the reason.


texts:
I'm trying to do something to this affect:

const string first_color = strip.Color(0, 60, 0, 0);

With the intended outcome being that I could use first_color wherever I'd have used strip.Color(0, 60, 0, 0) before.


texts:
I have a very simple setup which works fine with an Uno.

#include <SevenSegmentTM1637.h>
#include <SevenSegmentExtended.h>

const byte PIN_CLK = 2;
const byte PIN_DIO = 3;
SevenSegmentExtended display(PIN_CLK, PIN_DIO);

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

  display.begin();
  display.print(F("TEST"));
}

void loop() {}

When I use the very same setup with a Pro Mini (XCSOURCE ATMEGA 328P, 5V 16Mhz), the display doesn't light up. I get monitor outputs and can blink the onboard LED, but no reaction from the TM1637 display.

I get this output in the console:

�E%MA1e� 10001111
Acknowledged: 0
ADDR :  11000000
DATA0:  0
write byte: 84
ADDR :  11000000
DATA0:  1111000
write byte: 69
ADDR :  11000000
DATA0:  1111000
write byte: 83
ADDR :  11000000
DATA0:  1111000
write byte: 84
ADDR :  11000000
DATA0:  1111000

Does anyone have an idea how to debug or fix this?


texts: seeeduino can-bus shield v2: can't read can bus and write on SD card

texts:
I'm using a seeeduino V4.0 and a CAN-BUS shield v2.0 with industrial grade SD card.
I'm using the default library given by the wiki of seeed.
I've simulate a can bus with two mcp2515. I can read it without trouble and everything is fine.
I can write/read on the SD card with the exemple given in the SD library.
But when I use this example, the can bus and SD card start without error. The can bus read normally and show the can bus data. But when I read the SD card, the file is created but completly empty.
I've tried to modify to write on a .txt instead of .csv and when I try a
myFile = SD.open("test.txt", FILE_WRITE);
if (myFile)
{
  ...
}
else
{
  Serial.println("error: file not reachable");
}

The "myFile" return false.
ps: I don't ask a lot of question here. Sorry for bad formating my question.


texts: What sensors can measure 3-axis acceleration?

texts:
I'm currently measuring vibration, temp and noise using an Arduino and various inexpensive sensors. The acceleration sensor i found was sensors that measured the gravity on 3-axis of the sensor. But i'd like to measure acc, not gravity, as it moves in the direction of the sensor. For example, if an object is moving front-dir in a horizontal location, the x-directional acc is measured.

Could you tell me if you know the acc soensor i want.


texts: Serial not declared in this scope, newbie mistake most likely

texts:
Ok, newguy with a little VBA coding experience going to pull hair out soon. It is probably a simple thing I have missed but I would like someone to point out where I went wrong. I modified a sketch that used an lcd to use the serial monitor instead but I sometimes run into this "not declared in this scope" issue. Doing something wrong, please point me in the correct direction.

#include <Wire.h>
#include "RTClib.h"

RTC_DS3231 rtc;
DateTime now;
char daysOfTheWeek[7][12] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};

void showDate(void);
void showTime(void);
void showDay(void);

void showDate()
{
  serial.print(now.day());
  serial.print('/');
  serial.print(now.month());
  serial.print('/');
  serial.print(now.year());
}

void showDay()
{
  serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
}

void showTime()
{
  serial.print("Time:");
  serial.print(now.hour());
  serial.print(':');
  serial.print(now.minute());
  serial.print(':');
  serial.print(now.second());
  serial.print("    ");
}

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

  serial.println("working....")
  //wire.begin();
  //delay(2000);
  if (! rtc.begin())
  {
    Serial.println("Couldn't find RTC Module");
    while (1);
  }

  if (rtc.lostPower())
  {
    Serial.println("RTC lost power, lets set the time!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}

void loop ()
{
  now = rtc.now();
  showDate();
  showDay();
  showTime();
}


texts: Using an Atmega8 Chip with an Arduino Uno instead of an atmega328

texts:
This question is posted here as a reference question (its actually a follows  on from comments in my earlier question "How to expand program memory on an arduino?") -( Edgar Bonet suggested this question and who answered 1 below  in the comments there).

I think its a useful question to others new to arduino. I have posted an answer too. But you can of course add your answer too. I dont know everything about arduino- still learning. It does not refer to the version of the Uno that uses a surface mount atmega328-but the version with removable atmega328.

1) If I take out the atmega 328 chip from its socket on the Uno and replace it with using atmega8-16PU instead and I burn a bootloader-does that mean I can use the arduino Uno with the atmega8 like the atmaga328 (but with a subset of the features of the 328)?  The atmega8 is of course an older chip than the 328 (and is significantly cheaper) but it still has same pinouts.

2). I am using the 16mhz crystal in my project. So using an Arduino Uno with atmeg8 chip does this mean that the bootloader will set the fuses on the arduino's atmega8 to use the crystal on the arduino Uno pcb? Or does the bootloader set the fuses on the arduino's atmega8 to use its internal oscillator?

3) So hw much memory is left after writing bootlader to atmega8 ?

4) Can I burn the bootloader more than once?


texts: Does the Arduino pro-micro 3.3v use an 8MHz crystal or a 16MHz crystal with a clock divisor of 2?

texts:
I am trying to convert some 5v Leonardo-compatible boards to run at a lower 3-3.7v voltage, so that I can power my project using LiPo batteries.

As far as I can tell, the default Leonardo settings (and pro-micro settings) will not run at this voltage. When I power the boards (which expect 5v) from a lithium battery, typically the system does not start at all. My two theories are that either the 16 Mhz xtal oscillator does not start resonating, or that the brown-out detection of the boards precludes booting at the lower voltage.

I would like to modify the boards to run on lower power. Since the pro-micro exists in a 3.3v variant, I presume there is some way to get the Atmega32u4 chip working at lower voltages. I have reviewed the Atmega32u4 datasheet and schematics from sparkfun, as well as examined the fuse bit differences between the 3.3v and 5v versions of the pro micro. As far as I can tell, the only difference in configuration is the brown-out detection. The clock source settings are configured for a crystal between 8Mhz and 16Mhz, so this could be the same for both boards.

I wasn't quite able to understand the build system for the Catarina bootloader, which might give hints as to how the clock is handled. It seems like both the 3.3v and 5v boards bootloaders are built from the same source, but with a different "CPU frequency" variable. However, there are quite substantial differences in the .hex file outputs and I wondering if there is something fancier going on.

As far as I can tell, it's possible to get an 8MHz clock on the Atmega32u4 either by using a 16MHz xtal with a clock divisor of 2, or using an 8MHz xtal with a clock divisor of 1.

Since the pro-micro 3.3v is the "mainstream" supported board using the Atmega32u4 at a lower voltage, I would like to configure my project to be compatible. Which means I need to build in a compatible clock source, if possible.

Does anyone know more details of the pro-micro 3.3v/8Mhz configuration that might help clarify how to set this up?


texts: WS2812 - First are white and then they turn red/yellow/orange near the end

texts:
I'm trying to power about 150 WS2812 LEDs from my ESP8266 NodeMCU board (running NeoPixel Arduino code). The first few LEDs are white, but about half way down, the LEDs turn yellow, then they turn orange, and at the end they're basically red.

Could this be caused because of the power draw? The strip itself is currently drawing about 900 mAh, and I am powering the ESP8266 with a 1.5A 5v supply. The LEDs are running off 3.3v directly from the ESP8266.

Also, after like 2 minutes, the LEDs turn off completely. The board never disconnects from my WiFi. They just turn off. I can turn them on again right after.


texts: How to read analog pins from a second Arduino

texts:
I've run out of analog pins on Arduino Uno and don't have time to order new parts. I've heard you can connect two Arduinos and I have access to another UNO. If I did that, could I read the analog pins of the second Uno on the first one?

I'm planning to control 7 servos with separate potentiometers.


texts: Does a pin (input pin Arduino) still float when connected to GPIO on RPI?

texts:
I am currently testing my application on an Arduino, and I experience floating pin issues. My program reads the pin status of input pins, which are configured as

pinMode(5, INPUT);
digitalWrite(5, HIGH);

but still they tend to float sometimes.

Will this be solved when I connect the pin directly to a GPIO pin on a RPI? Specifically when the application running on the RPI is not active yet (thus the GPIO pin will not actively high or low yet).

Both the PI and and Arduino will be powered at the same time, but the application on the Arduino will be active much faster than the application on the RPI.

So my concern is that while the RPI is still booting and loading the app, the Arduino might still 'suffer' from floating pins, which gives undesirable output to the things my Arduino controls.

Or, will the fact that the RPI and Arduino both have power, share the same ground, will result in a stable input on the Arduino?

PS: not an expert on electronics, hence the question. I can't test this yet as I don't have all the hardware of this project.


texts:
So i have taken apart this old remote i found, and removed the IR-LED and replaced it with wires.

I thought that i would just be able to put the wire that used to go to the positive side of the IR-LED, to a pin on my Arduino UNO (and negative to GND), and just use the same IR decoding library to decode the signal, as if it was from an IR sensor.

But as it turns out, i receive undecipherable nonsense (or so it seems), like 5+ different codes from pressing the same button on the remote.

If i connect the 2 pins from the remote to the IR-LED on my breadboard, and an IR receiver to my Arduino i receive the signal you would expect, which in my case is "24137D" in HEX (1 on the remote) every time.

So my question is: Why does this happen and is it even possible to do what i am trying to do. Why? Why not? And if possible how is this done?

Here is the code i am using:

#include <IRremote.h> //https://github.com/z3t0/Arduino-IRremote

#define IR_Pin 7

IRrecv irrecv(IR_Pin);
decode_results results;

void setup() {
  Serial.begin(9600);
  pinMode(IR_Pin, INPUT);
  irrecv.enableIRIn();

}

void loop() {
    if(irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume();
  }

}

Maybe the answer is obvious and i just don't understand how IR works. If so feel free to link some documentation that can help me.

Thank you.


texts: Can Arduino Uno's serial handle to foward push through 1-wire protocol?

texts:
tl;dr on on digital ouput/input I would like to communicate with a 1-wire device, whose protocol requires precision to ~15 microseconds. My question is if Arduino Uno's serial communication can be as quick as to support to map the digital pin via serial->USB to my host computers app which should implement the 1-wire protocol?

long version
The mode in which I thought to use my Arduino was, to attach it to a host computer and run the logic of what should be done on the host computer, having the Arduino only receive the data (for the pins) and return the state of the pins.

The challenge which prompts me to this question is that the Serial communication is not really that quick, compared to the timing requirement of some protocols (e.g. 1 wire) I wish to implement.
For example: 1-wire-protocol's timing requirements (i.e. range of micorseconds) could easily be kept from code running on the Arduino Uno's Atmega328 directly, which at 16Mhz and assumed 2 cycles per command would allow somewhat a resolution of 2/16Mhz = 0,125 us.

If alternatively the data/instruction for the 1-wire protocol should be mapped via the serial interface to an application running on an PC attached to the Arduino I wonder if the time requirements of the 1-wire protocal can be reached?

It boils down to a question if the Serial communication can have a temporal granularity as small as the about 1 to 15 microseconds needed to implement the 1-wire protocol - not within arduino itself - but in the attached PC's application.


texts: Has anyone used an Arduino to transfer software to an Apple IIe?

texts:
Yes, you read that right.  An Apple IIe.

I have many retro computers and I was thinking that since the Apple II line of computers (especially the IIe) have pretty speedy serial ports that it should be somewhat simple to use an Arduino to send data to/from the Apple.

My issue is that all of my every-day computers are USB based with no RS232 serial.  I guess I could boot up an old Linux laptop that has a serial port but that seems too cumbersome given my limited desk space.  :-)

Anyway, I've Googled but I'm not finding anything.

Since most Apple IIe disk images are pretty small (<144k or so) they should fit pretty easily into, say, an Arduino DUE that I have.  Or better yet, using the DUE to mount as a USB device that could send over to the IIe would be great.

So, my question is, does anyone know of any site that explains how this could be done?

Thanks!

EDIT

OK, turns out it WAS pretty easy getting the Arduino DUE to send to the Apple IIe.  I simply connected 3 wires from TX1/TR1/GND to the Apple IIe serial port (SSC).

Now, when I launch ADT Pro and start sending, the IIe is receiving garbage.  Bunch of "9d9d9d9d" all over the place.

Here's my code:

// ADT.ino

int incomingByte = 0;

void setup() {

    Serial.begin(9600);
    Serial1.begin(9600);

}

void loop() {

    if(Serial.available() > 0) {

        while(Serial.available() > 0) {

            incomingByte = Serial.read();

        }

        Serial1.write(incomingByte);
        delay(100);
    }

}

The ADT Pro software is set to send the data over the USB port and it's obviously sending data to the IIe.  I'm just wondering if the formatting is wrong or something.


texts:
I need to read the registers of a message gotten from onReceive(). I read here that

There's nothing "magic" about the register pointer:  it's simply the first data byte in the packet.  So just write your I2C slave code so it examines the first received byte and treats it as an "opcode" for deciding how to interpret the rest of the packet.

So I thought that since hosts set registers by calling write() twice, I could just make my onReceive() handler function twice, like this
byte CURRENT_REGISTER = 0x00;

void onMessage(int numBytes){
  if(CURRENT_REGISTER == 0x00 && numBytes == 1){
    CURRENT_REGISTER = Wire.read();
    return;
  }

  char msg[numBytes];
  for(int i = 0; i < numBytes; i++){
    msg[i] = Wire.read();
  }

  //logic function goes here

  CURRENT_REGISTER = 0x00;
}

But then i noticed here that

This first byte written here 'r' moves the register pointer to the register with address 'r'. You can think of the pointer as a read/write head.
Now that the pointer is 'pointing' at the specific register you wanted, this command will replace the byte stored in that register with the value 'v'.

which made me think after endTransmission(), it only sent one message, which would ruin this idea.
Is this the case, and if so how can I obtain the registers as a slave?


texts: Getting all data of my JSON object from Serial.read() at once

texts:
I'm new to Arduino and I'm building a project that fetches data from a website (using ESP8266) and then transfers them to my Arduino UNO via serial port.
Data coming from ESP8266 every 20s - [{"x": 0,"y": 0,"rgb": [255, 200, 174]},{"x": 1,"y": 0,"rgb": [255, 200, 174]},{"x": 2,"y": 0,"rgb": [255, 200, 174]}]
But when I print the data like this

void loop() {

  if (Serial.available()) {
    Serial.write(Serial.read()); // This line prints only one character out of whole string

    data =  Serial.read(); // so this doesn't work

    DeserializationError error = deserializeJson(response, data);
    if (error) {
      Serial.print(F("deserializeJson() failed: "));
      Serial.println(error.f_str());
      return;
    }
    for (JsonObject elem : response.as<JsonArray>()) {
      int x = elem["x"]; // 2, 2, 2
      int y = elem["y"]; // 2, 2, 2
      JsonArray rgb = elem["rgb"];

      int rgb_0 = rgb[0]; // 255, 255, 255
      int rgb_1 = rgb[1]; // 255, 255, 255
      int rgb_2 = rgb[2]; // 255, 255, 255
      //Serial.print(x);
    }
  }
  delay(1000);   //then it waits 1 second and goes from the start
}

How can I make it to get the whole string and save it into a variable?
Thanks, much for answering.


texts: I want to get incomming call number and compare it

texts:
Hello i want to get and compare incomming call number, it works but not as I want.
When im calling from good number it print that I was calling form saved number when the number is stop calling i need to do it on start. And else is printing when nobody is calling. How can i do it? Here is my code:

String d = "";
void setup()
{
  Serial.begin(9600);
  Serial1.begin(9600);
  Serial1.println("AT");
  delay(500);
  Serial1.println("AT+CLIP=1");
  delay(1000);
  Serial1.println("AT+CPIN=1439");
}
void loop()
{
 d = Serial1.readString();
 if(d.indexOf("xxxxxxxxx") >=0)
   {
 Serial.println("call is from saved number");
    } else {
       Serial.println("call is not from saved number");
      }
}


texts: Why are characters with value above 127 "padded" with 1s to be 16 bits long, while ones with values 0-127 aren't?

texts:
I am using the Arduino IDE to run and monitor, with an Arduino Nano clone.
This code shows what I mean by the question:
char foo = 127;
char bar = 128;
Serial.println(String(foo, BIN));
Serial.println(String(bar, BIN));
foo = 383;
bar = 384;
Serial.println(String(foo, BIN));
Serial.println(String(bar, BIN));

prints
1111111
1111111110000000
1111111
1111111110000000

It still happens if I then cast the elements to char, but not if I cast them to uint8_t:
char foo = 127;
char bar = 128;
Serial.println(String((char)foo, BIN));
Serial.println(String((char)bar, BIN));
Serial.println(String((uint8_t)foo, BIN));
Serial.println(String((uint8_t)bar, BIN));

1111111
1111111110000000
1111111
10000000

It behaves the same if I do some arithmetic as well:
char foo = 127;
char bar = 128;
Serial.println(String(foo / 64, BIN));
Serial.println(String(bar / 64, BIN));

1
1111111111111110

Why is this? If I assign a number bigger than 255, but smaller than 384, it behaves like for numbers below 128, but above that, it does it again, so it's obvious that only the least significant 8 bits of the value are stored as expected, but in cases where (n mod 255) > 127 (so the 8th bit is 1) they are retrieved from memory together with another 8 bits, which are all 1s.
I can live without an answer to the above issue, what I really need to have confirmed is the following:
If I were to store and retrieve a uint16_t as two elements of a char[], it would always be safe (and not undefined behavior) if I did it as follows, right?:
uint16_t foo = 34952;
char bar[2];
bar[0] = foo >> 8;
bar[1] = foo;
uint16_t extracted = (uint16_t((uint8_t)bar[0])) << 8 | (uint8_t)bar[1];

Thank you in advance for any help you can provide.


texts: backup battery for FeatherWing DS3231, RTC

texts:
I am working with slightly modified example code for the Adafruit FeatherWing DS3231 RTC (real time clock) board. The DS3231 chip itself is from Maxim. Since the cell is described as a "backup battery" a literal interpretation suggests that you don't need the backup battery in order to operate the board if the board itself is powered and you don't mind that the device cannot remember the time when board power is lost. I might be taking the term "backup battery" too literally since it doesn't seem to work.

The Adafruit (Arduino) code:

> #include <Wire.h>
> #include "RTClib.h"
> RTC_DS3231 rtc;
> void loop()
>{
>     rtc.adjust(DateTime(2018, 1, 1, 0, 0, 0));
>     DateTime now = rtc.now();
>     Serial.print(now.year());
>     Serial.print(" ");
>     Serial.print(now.month());
>     Serial.print(" ");
>     Serial.print(now.day());
>}

The output is:

2165 165 165

The Maxim datasheet says this about the VBAT line which is the line between the DS3231 chip and the missing backup battery:

  Backup Power-Supply Input. When using the device with the VBAT input
  as the primary power source, this pin should be decoupled using a
  0.1μF to 1.0μF low-leakage capacitor. When using the device with the VBAT input as the backup power source, the capacitor is not required.
  If VBAT is not used, connect to ground.

So I connected it to ground and it makes no difference. I can't buy a battery until tomorrow morning. Can somebody please confirm that the backup battery is actually essential. EDIT: I installed a battery and it makes no difference.

Aside: A good reason for not having a backup battery if possible is to have fewer user serviceable parts.


texts: Most efficient method to turn a gear extremely slowly?

texts:
I have a gear that needs to have roughly one rotation per day.  It does not have to be smooth or consistent.  So far, the best I have come up with is to have a stepper motor with an arduino that sleeps, wakes up once an hour maybe and turns the stepper a little bit.

Which arduino should I use for this and is there perhaps a simpler method?  Is there any way to fully cut power then when powered on the arduino advances the motor and then shuts off?

Any ideas?

I want to run off of a 9v battery and get as much time as possible.

edit: adding details as requested

the rotation needs to happen slowly over the 24 hour period.  The tube being turned is a light plastic 1" diameter tube that weighs about 2 lbs.


texts: Arduino Uno won't upload code and overheats

texts:
We are using an Arduino Uno R3 connected via USB to a computer. The main problem is that we can't upload any code to the board. We get this error in the Arduino IDE console:

  avrdude: ser_open(): can't open device ".\COM1": The system cannot find the file specified
  Problem uploading to board. Visit http://www.arduino.cc/en/Guide/Troubleshooting#upload

My computer may not recognize the board, the IDE won't find any port (COM) and on the board I got the three LEDs turned on, they don't even blink, they stay turned on as long as I have connected the Arduino to the computer. Apart from that, the Arduino heats too much and too fast. I don't have anything connected to it yet. I've tried resetting the board with its built-in button, I've also tried changing the USB cable, even the computer, different system architecture and OS. I don't to want to mess up the board even more, so I don't know what to do. Could you point out what's the problem with my board?

If you need more information, I will try to post as much as you need to help me out.


texts:
I have a question concerning the LM35 sensor: if I'm not too concerned about accuracy (I don't mind having 2 or more degrees off), is it possible to use the LM35 sensor at higher temperatures than the normal range? The project that I'm thinking of using this sensor, temperatures should reach 200 degrees, maximum.

Thanks!


texts: Why my Arduino output active on reset using relay module?

texts:
I have a problem with relay module when I reset the arduino all the relay go active i.e all the light turned on by itself which is  a drawback of my project .Arduino pin output is negative by default i.e on reset after sending command through hc-06 it becomes positive i.e relay  become inactive. In the other hand when I use LED instead of relay module it Works fine I used One Pin ground and other to my output with 330ohm resistor. Any helping word in this regard will be appreciated greatly.
Sorry for my poor English.


texts: Does Arduino.cc sell the Ethernet Shield?

texts: I can't find more information on the Ethernet Shield. Arduino.cc has docs about it but where do I buy it? Is Arduino.org the sole provider? I've read about the political schism between the two companies and I'd rather not buy from them.


texts: Using Arduino to create a countdown that unlock a box

texts:
Am new to Arduino. So permit me if I sound so novice.
I want to create a countdown device (a clock that will countdown or something) that will unlock a box when the time is up.
As an example, let say, I set the clock to start counting down from 2hours, but when it remains 5mins for the countdown to elapse, the box will unlock
What are the things needed for it to work as all examples I see are mostly for opening the door or box when the temperature changes.


texts: Can ZigBee API and ZigBee AT work together in the same network?

texts:
I'm currently trying to make 3 arduinos talking to each other with ZigBee, and it's kinda working.
But I currently use AT mode on the Bees and it's a little bit harsh when I have to switch the destination address in the Coordinator of the network (1 Coordinator and 2 Routers)

Can I put the Coordinator in API mode (to make it easier to switch addresses with xbee-api for Arduino) but still be able to communicate with the AT routers and be able to send/receive data from them?

Thanks for your answer :)


texts:
I have a brushed motor hooked up to a NodeMCU that moves a plate left (moveLeft) and right (moveRight). When a button (buttonOpen) is pressed, it turns to the left until the plate hits a limit switch (limit1), then the system stops and the motor driver goes to sleep. Then when a different button (buttonClose) is pressed, it moves the plate to the right, until a different limit switch (limit2) is pressed.

Now the thing is that I need the DC motor to brake once the limit switch is triggered, otherwise it will slowly roll over the switch (which is bad).

I noticed that I needed to apply the brake for at least a fraction of a second to get the motor to stop. If the brake is too short, the motor will continue to spin. That is why I created a loop that lasts 0.8 seconds (stopMotor)

The problem is that the brake is only being applied when the motor moves right. But when it moves left, it does not get applied and coasts to a stop. I can't figure this out for the life of me. I really need to to brake and stop in either direction.

Here's the code.

const int IN1 = 13;
const int IN2 = 12;
const int Enable1 = 14;
const int buttonOpen = 2; // Yellow
const int buttonClose = 0; // Black
const int limit1 = 5;
const int limit2 = 4;

void setup()
{
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(Enable1, OUTPUT);
  pinMode(buttonOpen, INPUT);
  pinMode(buttonClose, INPUT);
  pinMode(limit1, INPUT);
  pinMode(limit2, INPUT);
}

void moveLeft()
{
  digitalWrite(Enable1, HIGH); // wakes up driver
  digitalWrite(IN1, LOW); //
  digitalWrite(IN2, HIGH); // spins counter-clockwise
}

void moveRight()
{
  digitalWrite(Enable1, HIGH); // wakes up driver
  digitalWrite(IN1, HIGH); //
  digitalWrite(IN2, LOW); // spins clockwise
}

void stopMotor() //brake motor for 0.1 seconds to avoid coasting then place             driver to sleep
{
  int period = 80L;       // 0.08 seconds
  for( int tStart = millis();  (millis()-tStart) < period;  ){
    digitalWrite(IN1, HIGH); // brake
    digitalWrite(IN2, HIGH); // brake
  }
  digitalWrite(Enable1, LOW); // Sleep driver
}

void loop(){
  // Move motor right
  if (digitalRead(buttonOpen) == LOW){
    while(digitalRead(limit2) == HIGH){
      moveRight();
      yield();
    }
  }
  else
    (stopMotor());

  // Move motor left
  if (digitalRead(buttonClose) == LOW){
    while(digitalRead(limit1) == HIGH){
      moveLeft();
      yield();
    }
  }
  else
    (stopMotor());
}


texts: Build an improved GSM antenna for arduino mkr gsm 1400

texts: I want to use an Arduino MKR GSM 1400 in my area wich has a bad connectivity on mobile internet. On my phone it's very weak and if i drive to the next village it works sometimes on the arduino with the given standard antenna but I want it to work in a wider range. Is there any antenna available specifically for mobile connections wich you can put on a arduino? And how do you call them and where can I buy such a thing or even build it myself? Do you have any suggestions for such an antenna? And is there something I can improve with just using software to strengthen the signal?


texts:
I have an Arduino Micro and an MPU6050 gyro/accelerometer board; I want to read DMP data from the MPU6050, but the sketch requires the use of the interrupt pin, of which I have none of the interrupt pins available and they cannot be switched around.

I'm wondering how to go about reading the DMP data when needed. I've tried but always just receive the value 180 for any reading.

Thank you!