text:
RFID-RC522 not working with Arduino Uno clone
I am using this library https://github.com/miguelbalboa/rfid, and using DumpInfo.ino from it:
/*
 * --------------------------------------------------------------------------------------------------------------------
 * Example sketch/program showing how to read data from a PICC to serial.
 * --------------------------------------------------------------------------------------------------------------------
 * This is a MFRC522 library example; for further details and other examples see: https://github.com/miguelbalboa/rfid
 *
 * Example sketch/program showing how to read data from a PICC (that is: a RFID Tag or Card) using a MFRC522 based RFID
 * Reader on the Arduino SPI interface.
 *
 * When the Arduino and the MFRC522 module are connected (see the pin layout below), load this sketch into Arduino IDE
 * then verify/compile and upload it. To see the output: use Tools, Serial Monitor of the IDE (hit Ctrl+Shft+M). When
 * you present a PICC (that is: a RFID Tag or Card) at reading distance of the MFRC522 Reader/PCD, the serial output
 * will show the ID/UID, type and any data blocks it can read. Note: you may see "Timeout in communication" messages
 * when removing the PICC from reading distance too early.
 *
 * If your reader supports it, this sketch/program will read all the PICCs presented (that is: multiple tag reading).
 * So if you stack two or more PICCs on top of each other and present them to the reader, it will first output all
 * details of the first and then the next PICC. Note that this may take some time as all data blocks are dumped, so
 * keep the PICCs at reading distance until complete.
 *
 * @license Released into the public domain.
 *
 * Typical pin layout used:
 * -----------------------------------------------------------------------------------------
 *             MFRC522      Arduino       Arduino   Arduino    Arduino          Arduino
 *             Reader/PCD   Uno/101       Mega      Nano v3    Leonardo/Micro   Pro Micro
 * Signal      Pin          Pin           Pin       Pin        Pin              Pin
 * -----------------------------------------------------------------------------------------
 * RST/Reset   RST          9             5         D9         RESET/ICSP-5     RST
 * SPI SS      SDA(SS)      10            53        D10        10               10
 * SPI MOSI    MOSI         11 / ICSP-4   51        D11        ICSP-4           16
 * SPI MISO    MISO         12 / ICSP-1   50        D12        ICSP-1           14
 * SPI SCK     SCK          13 / ICSP-3   52        D13        ICSP-3           15
 */

#include <SPI.h>
#include <MFRC522.h>

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

MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance

void setup() {
    Serial.begin(9600);     // Initialize serial communications with the PC
    while (!Serial);        // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
    SPI.begin();            // Init SPI bus
    mfrc522.PCD_Init();     // Init MFRC522
    mfrc522.PCD_DumpVersionToSerial();  // Show details of PCD - MFRC522 Card Reader details
    Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
}

void loop() {
    // Look for new cards
    if ( ! mfrc522.PICC_IsNewCardPresent()) {
        return;
    }

    // Select one of the cards
    if ( ! mfrc522.PICC_ReadCardSerial()) {
        return;
    }

    // Dump debug info about the card; PICC_HaltA() is automatically called
    mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

When I connect everything correctly and upload that sketch, this shows up in my Serial Monitor:
I have tried this with another cheap Arduino Uno, I connected it exactly the same and scanned one card, everything works perfectly fine:
So I guess RC522 module is working fine, and there is probably issue with that Arduino Uno board.
What I tried next without any success is:

Copy bootloader from working Arduino Uno to this Arduino Uno that is not working.
Switch ATMEGA328P from working Arduino Uno to this Arduino Uno that is not working.

I tested all pins (on board that is not working) for PWM and Digital Output functionality with Firmata Test, and everything is fine in this test.
You can take a look on images of this Arduino Uno board here.
So my question is: something is wrong with the board itself or I am doing something wrong?
Thanks!

reduce you sketch to the minimum code required to demonstrate the failure and post the sketch

@jsotola I posted a code that I am using. I think I can't reduce it, its example code from RC522 library. What confuses me the most is that why the code is not working on that Arduino Uno but works perfectly fine on another very identical Arduino Uno.

thanks  for including the code .... actually, you can reduce the code .... delete everything in the loop() block .... the failure already exists in setup() ............ please  recheck your wiring ...... if you are using a breadboard, then rebuild the circuit on another part of the breadboard

@jsotola I reduced a code as you say and checked wiring (I am using a direct connection from module to a reader with a female to male cables), still same results.

Try using this code:
#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>

#define SS_PIN 10
#define RST_PIN 9

#define SERVO_PIN 3
Servo myservo;

#define ACCESS_DELAY 2000
#define DENIED_DELAY 1000
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.

void setup()
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();          // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522

  myservo.attach(SERVO_PIN);
  myservo.write( 70 );
  delay(7500);
  myservo.write( 0 );
  Serial.println("Put your card to the reader...");
  Serial.println();

}
void loop()
{
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent())
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial())
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++)
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "69 C8 E2 2A") //change here the UID of the card
  {
    Serial.println("Authorized access");
    Serial.println();
   myservo.write( 70 );
 delay(7500);
  myservo.write( 0 );

  }

 else   {
    Serial.println(" Access denied");

    delay(DENIED_DELAY);

  }
}


text:
Digital input on one pin is copied to other pins
I am working on a phase detection project in which i am trying to find the order in which the incoming signal comes. I converted the 240v 50hz Ac signal to a 7v 50hz square pulse. when i connect one(7v 50hz) of the three lines to a digital pin on arduino it is properly detecting, but the problem is if i check the unconnected pins via oscilloscope i am getting the same signal which i connected as input, so when i connect another line to any other pin the two signals are getting added.

(Image 1)this is what i see in the DSO when i connect one line to the arduino pin and observe other pins
.(Image 2)this is what i get after i give another line as input to arduino and observe the pins.
i tried with 2 to 3 boards but i still get the same problem.

simulate this circuit – Schematic created using CircuitLab
this is the schematic i used for converting the sine wave into square wave, i used 4n33 optocoupler for this purpose.

7V into a 5V input pin...?  It's not the input pin that you're seeing the noise on, it's the entire Arduino.  If you operate out of specs then you can expect strange things to happen.

actually i converted 7v to 5v and tried but still i got the same result, so i tot it was not the problem.

Is your signal purely positive, or is it ±7V?

what exactly is the project that you are trying to build?

it is +7v only .

An input pin has a very high impedance. It is so high, that it can read a signal from a nearby pin. Everything changes when you connect a oscilloscope to that pin. You know that the ground wire of a oscilloscope is connected to earth ground of the power plug? You are trying to read the mains 50Hz and that oscilloscope introduces probably the most 50Hz noise. Can you show us a schematic or drawing of your circuit?

i have added the schematic .i hope its helpful for providing a solution.

Set all unused pins as input with pull-up or output then see again the results.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Eclipse "CDT Core Builder" error
I installed an Eclipse Version: 2018-12 (4.10.0) for Arduino.
I’ve got an CDT Core Builder error  when I try to compile.
I’ve searched but cannot fix the problem.

It is strange, because I added AVR Eclipse Plugin and GNU AVR-GCC toolchain.
Also creating new project C/C++ -> Arduino Project. According some sources it works. But mine shows CDT error.

I have no clue what you installed. If you want to make arduino in eclipse easy use my sloeber at sloeber.io

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Can you save data to heap section in Arduino memory?
On normal computers, heap will be cleaned as you close the program, but can I save data to Arduino's heap with malloc function. And will it be cleaned after I power off the Arduino?

Yes, you can use malloc (though it's seldom a good idea on such a small memory system). Will it get "cleaned"? No. It will get lost. There is no such thing as "cleaned". You remove the power the memory is erased. With no power to maintain the memory state there is no memory to "clean". And nothing to do that "cleaning".

@Majenko So I will lose the data when Arduino is powered off right?

Yes. Like you lose your word document when you unplug the power from your computer.

@Majenko Thanks! It will be great if you can post that as answer.

Yes, you can use malloc() on the Arduino - however it is not something I would recommend you use since memory is at a premium and excessive use of malloc() and free() causes heap fragmentation which can eat your memory up and cause random crashes (String is the biggest culprit of this).
I am not sure what you mean by "clean" the memory.  When power is removed the content of the memory is lost. The whole of the SRAM forgets its contents if there is no power to maintain that state.  A bit like when you unplug your computer it "forgets" that Windows is loaded.
If you want to retain information with the power removed you need to use the EEPROM.


text:
Using Arduino as ISP and SoftwareSerial at the same time
I'm trying to use my Arduino Uno as an ISP to program an ATTiny85 and at the same time check my board by using the SoftwareSerial library to output the values I'm getting from my sensor.
Is this actually possible? Or does it require 2 different setups? Because I found a lot of tutorials and threads about one or the other, but never both. Which I find odd because once you send your program to the chip you might want to test it as well (or debug it).
Many thanks for your help and input! :)

Sure you can. You'd need to modify the ArduinoISP sketch to include whatever serial functionality you desire.

Would adding a code like that work for example?
`#include <SoftwareSerial.h>
char anyChar;
void setup(){
Serial.begin(9600);   //to serial monitor
Serial1.begin(9600);  //connected to Attiny (RX to tx and TX to rx)
}
void loop(){
if(Serial1.available() >0) {
anyChar = Serial1.read();
Serial.print(anyChar);
}
}`

Possibly, though it may interfere with ISP programming. You should provide a facility (maybe a switch connected to a GPIO pin) to switch between programming and testing mode.

To keep things simple I would recommend using two Arduino's. One for the ISP and one for the test harness. Alternatively @Majenko's suggestion using a GPIO pin and switch to toggle between to two modes (programming and test harness).

I'm not really sure, but in the Arduino ISP example there is an if that looks if the ISP is in program-mode. You could try adding in the else statement of that if the Software Serial part.


text:
Arduino Nano, Uno and Mega - XBee connection difference
I have a simple sketch working on arduino Uno and Nano sending data using an XBee.
However, if I run the project on an Arduino Mega it does not work.
What differences between Uno/Nano and the Mega could be causing issues?
Connection:  I just connect 3.3V->3.3V, Gnd->Gnd, and have tried various ports for DIN and DOUT (normally pins 2/4, but have tried A0/A1, 22/23 etc..).
Sketch: pastebin
Have brought a second Mega in case of hardware faults, but the problem persists.  Have stripped anything which might be tying up a timer.  Am choosing the right board type in the arduino IDE.

Update: changing the sketch to use HardwareSerial works, but I'd like to understand what's different between the devices here.

Not all arduino Mega pins support 'change interrupts', which is needed for Software Serial.  Only the following can be used for RX:
10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Mega has 4 hardware serial ports, no excuse to be using software serial.


text:
ESP8266 TCP/IP communication
So I'm looking into having a TCP communication between 1 ESP8266 Chip (Station) and 2 ESP8266 (Clients) connected to that station. Every time I find a code including the TCP, they only include things like client.print(). But how can I write a message to a certain IP address in that network.
When I do client.print() it sends the message to ALL the clients. But I want to be able to do something like client1.print() and client2.print()

WiFiClient object wraps a TCP socket. A normal TCP socket is connected to IP address and port. WiFiServer starts a listening socket on a port. If server on listening socket is contacted by a remote client socket, it creates a local socket connected with the remote client socket on a free port and returns a WiFiClient object wrapping the socket. Everything you write or print to a WiFiClient is send to that one remote socket.
If one of your client boards creates a WiFiClient and connects it to IP address and port of the WiFiServer on your 'server' board, then you get there a WiFiClient from server.available() and this two WiFiClient objects are connected. What you write/print on one side you read only from the WiFiClient object on the other side.
client socket
if (client.connect(serverIP, PORT)) {
  client.print("request\n");
  String response = client.readStringUntil('\n');
  Serial.println(response);
  client.stop();
}

server side
WiFiClient client = server.available();
if (client && client.connected()) {
  String request = client.readStringUntil('\n');
  Serial.println(request);
  client.print("response\n");
  client.stop();
}


text:
How to program an Arduino pro mini using native serial port (on my mainboard)
How can I program my Pro Mini using the native RS232 Serial port on my Mainboard (aka com1).
Google-ing did not really help and a quick search here for "pro mini programming com1" did not deliver any results.
I already have a MAX232 module connected between the Pro Mini and the PC.
I have already tested the com1 port for function by sending stuff to an Arduino mega via its usb-to-serial port and echo-ing that to com1.
Which succeeded (at least sort-of [receiving some random clutter in between characters or missing some characters at all])
I did try the obvious (i.e. selecting pro mini from the board menu and then selecting the com1 port and hit upload).
But that did just produce a timeout-error…
An Option to set the programmer to simple Serial Connection or something similar does not exist to my knowledge (well it does but only if we're talking about STM32 based boards like the blue pill).

please break the word "clump" into separate sentences

you must reset the board in the moment of Upload. the USB chip on Uno or Mega does the reset

Or connect the DTR signal (conditioned by the MAX232) through a 100nF capacitor to the RESET pin.

@Majenko the module does not offer dtr to the outside world and does not even offer the second channel of the ic …

Then you will have to do a manual reset at just the right moment. Good luck.

or can one define a custom upload method like its done with the stm32 based boards...

alternative is ISP flashing over the ICSP header with a programmer or other board as programmer.

To upload a hex file to Arduino over Serial interface, the bootloader must be active. The bootloader is active after reset. It waits a short time if a new application is uploaded. If not, it jumps to existing application.
To reset the MCU on Arduino boards with independent USB chip a circuit connected to DTR line of serial is used.
On a board like the Pro Mini there is no chip for USB neither an auto reset circuit. You must reset the board with the reset button right before avrdude sends the hex file. avrdude tries ten times, so you have 10 chances to time it right after you hit the Upload button.
Some USB-to-TTL-Serial adapters (or RS232 adapters) have the DTR line and it can be used to reset the board.
Or use ISP flashing over the ICSP header with a programmer or other board as programmer.

my module does not offer that line. damn that the ide does not print when avrdude does its attemps to make an estimation on when to press the button. i guess i simply asked for something that sounded great in theory and just not works in practise due to some minor detail...

just found that it does print w/ some flag set in the preferences

do not think i do get the Timing Right but it helps in the manner that i know i just wanted the impossible... gonna close this thread

Open the IDE, select File:Preferences and turn on Verbose Outputs.
Press & Hold Reset on the Promini.
Start the download. At the end of compilation you will see something like

Sketch uses 960 bytes (2%) of program storage space. Maximum is 32256 bytes.

Then the IDE will try and download 3 times.
Release Reset when you see the line above - it may take a few tries to get the release timing correct.


text:
Can you current-limit Arduino 101 GPIO pins?
A number of questions ask about max possible in/out current on a GPIO pin, that's not my question here. I'm asking if it's possible to set a maximum current limit on a GPIO pin, such that any attempts to draw more than that current would result in the Arduino entering a constant current mode e.g. reducing the pin voltage?
I've read this, this, this, and skimmed the Curie datasheet, but I don't see a feature like this mentioned anywhere.
The only half-answer I have seen is on the Ruggeduino website, which explains that they have added a fuse to each GPIO pin to avoid overcurrent draws due to short circuits.
For context - I have an external sensor that claims to be more reliable with a small amount of constant current. I didn't know if I could easily add that limitation (e.g. max 15mA at 3.3V) into the GPIO pin as a safety measure, so I went on a search to find out which has eventually led me here

you could add an external circuit that accomplishes the current limiting that you need

Which sensor is it and who claims that? I have not heard of something like that for a sensor.

INPUT_PULLUP should be fairly current-limited, but might not help...

No. I have never heard of a microcontroller with constant current or current limiting on the GPIO pins.
You may get a drive strength on the pins of an FPGA, but I have never seen such a thing on a microcontroller.
In general, if you have a need to reduce the voltage as the current increases you would just slip a resistor in the circuit. Or for more precise control using the GPIO pin to control a constant current source or constant current sink is the normal way of doing it.
GPIO pins are generally designed for communicating with other logic level devices. They require minimal current. Some microcontrollers provide a higher drive strength to work with larger fanouts (lots of devices connected to one pin, such as in SPI buses), but they are not intended for providing power to a device or giving control over their current.

Ok, that makes sense. Kind of what I expected, and I am happy to have someone other than myself confirm. (I can only accept the answer in 7 more minutes as I'm new to this SE site...)

Point of clarification: CMOS needs minimal input current for logic signals. (they have nearly infinite input impedance.) TTL is another story

@DuncanC CMOS has a relatively high capacitance on the gates though, and that means a higher drive strength for a high fanout count to get them thar capacitors charged fast enough.

Typically port pins do have some current limiting inherent in the design of the chip. But it isn't something that should be used as protection. More line a fact that should be taken into account when implementing a design.
Say a 3.3 volt processor has a maximum rating of 12mA. With a 5 mA draw from the pin the high output voltage might be 3.0 volts. When 12mA is drawn from the chip the output voltage might only be 2.5 volts. It is important to check the data sheet to determine what you will get under the expected conditions.
A port with an internal pull up option may be considered more like (but not like) a constant current source. But that's stretching things a bit.

Really? At ≈1/3 of its rated max power, its voltage would droop by almost 10%? I would have expectred the output to be "stiff" enough to keep the voltage at the spec'ed voltage up to nearly the max current draw. Are there readily available current;/voltage graphs for the various models of Arduinos? And are they consumable by mere mortals? I'm pretty comfortable with most spec sheets, but I'm a CS guy, not an EE.

"I would have expectred the output to be "stiff" enough to keep the voltage at the spec'ed voltage up to nearly the max current draw." My example did not use a specific processor. This is a problem I see often, assumptions. What I am saying is that the specs need to be read. Because the capability is specified, and not all chips will have "stiff" outputs. And also the specification over the temperature range must be considered if that would be a condition that it will operate. The 12mA I was thinking of was maximum output of the ESP8266. Yes it can put out 12mA but with quite a voltage drop.

And the Intel Curie (used in the Arduino 101, that the question was about) is specified with a maximum current of 20mA.


text:
TinyDuino RadioHead compile error with TinyZero
I have a stack of TinyDuino boards including
TinyZero and 433MHZ Long Range Radio TinyShield.
I previously has this processor and had no problem compiling the sketch
and uploading it.
With the TinyZero now I get the following error.
RadioHead.h:463:29: error: RHutil/atomic.h: No such file or directory
   #include <RHutil/atomic.h>

Obviously there is a file missing, when I tried to copy the file from the web
I got another error saying:
    sketch/RHHardwareSPI.cpp: In member function 'virtual void RHHardwareSPI::begin()':
RHHardwareSPI.cpp:99:58: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'BitOrder' [-fpermissive]
     _settings = SPISettings(frequency32, bOrder, dataMode);
                                                          ^
In file included from sketch/RHGenericSPI.h:13:0,
                 from sketch/RHHardwareSPI.h:10,
                 from sketch/RHHardwareSPI.cpp:7:
/home/ktsirakos/.arduino15/packages/TinyCircuits/hardware/samd/1.0.8/libraries/SPI/SPI.h:50:3: error:   initializing argument 2 of 'SPISettings::SPISettings(uint32_t, BitOrder, uint8_t)' [-fpermissive]
   SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) {
   ^

What the board does is to get Accelerometer values and send it to a receiver with the same RadioHead board.
I think it is because of the ARM of the TinyZero processor because the RadioHead.h header file includes these lines of code.
    // This is an attempt to make a portable atomic block
#if (RH_PLATFORM == RH_PLATFORM_ARDUINO)
#if defined(__arm__)
  #include "atomic.h"
 #else
  #include <util/atomic.h>
 #endif
 #define ATOMIC_BLOCK_START     ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
 #define ATOMIC_BLOCK_END }
#elif (RH_PLATFORM == RH_PLATFORM_UNO32)
 #include <peripheral/int.h>
 #define ATOMIC_BLOCK_START unsigned int __status = INTDisableInterrupts(); {
 #define ATOMIC_BLOCK_END } INTRestoreInterrupts(__status);
#else
 // TO BE DONE:
 #define ATOMIC_BLOCK_START
 #define ATOMIC_BLOCK_END
#endif

Any suggestion if it is possible to run these 2 together? (TinyZero and RadioHead)?
Thank you very much in advance.

When using the newest RadioHead and a new official arduino Zero with a new bootloader from arduino.cc, it should work according to the RadioHead page: https://www.airspayce.com/mikem/arduino/RadioHead/ How old is the core software for the TinyZero?

Helly @Jot , the software has been build to run on this processor: https://tinycircuits.com/products/tinyduino-processor-board?variant=14479557959

Konstantinos Tsirakos, that is with the atmega328p microcontroller, the same as in the arduino uno, nano, pro mini and so on. That is very compatible. The arduino zero and clones with samd21 processors are not so compatible. There are even a few different official arduino boards with the samd21 (arduino M0, arduino zero, arduino mkr). I think they build a new core environment for the TinyZero which is somehow going in its own direction or is too old.

The problem was with the drivers, I updated them from the site you send to me and everything worked ok with that. :)

That's very nice. I try to keep up with the newest software/firmware/bootloaders. For me, a arduino clone is no problem, as long as I can use the arduino software. I stay away from other "compatible" boards that have their own core.


text:
Is my board broken by soldering?
I've soldered a featherwing on my feather, then unsoldered it because it had stopped working: after the soldering of the featherwing, I was unable to upload new software to the board.
But now that the featherwing was removed, I still can't upload a software onto the board.
Here's the complete log I get:
$ ~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/tmp/arduino_build_190205/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"
         User configuration file is "~/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

I used to have this error from time to time before, but I always was able to make it work, either by using another USB port, choosing the right port for the arduino or rebooting Linux, but now nothing I do works.
So, I think I might have broken the board because of the soldering/unsoldering.
I attached the pictures of both sides of the board.

Three LEDs continue to blink: the red one when I connect the board to the USB, the battery one and the RX one when there is an attempt at transmission.
Can you tell me whether the board looks damage?

no, it does not look damaged, but it does look like it needs a cleaning ...... is that really the question that you want to ask?

Well, I'd like to know if it looks like a hardware issue (maybe there's soldering that prevents the upload of a sketch or something else).

look for bits of solder that may be bridging adjacent copper traces ..... the pictures are not clear enough to do that ...... you have also left out important information ..... it is unknown how the featherwing was connected

What type of soldering paste / flux are you using?

It looks like you have soldering paste all over the circuit board. If enough paste bridges a gap between the ceramic resonator and the IC, it can attenuate the oscillator signal to the point where the board won't work.
I use an old tooth brush and Isopropyl alcohol to clean excess soldering paste. As the alcohol evaporates, a lot of moisture forms on the circuit board, so it's important to ensure it's completely dry before you power it up.
Try cleaning the circuit board and see if that fixes the problem.
EDIT:
I would like to show you how much soldering paste it takes to stop a 328P from working. The following image shows the bottom of a perfboard with 0.1" hole spacing. You can see the soldering paste bridging the gap between pins 8, 9, and 10 of a Atmega328P DIP IC. Pin 8 is ground, and pins 9 and 10 are connected to the crystal / capacitors. All three pins are connected together via the paste, and since I forgot to clean the board before "final assembly", it's possible other pins are connected together via the paste.

The circuit board is from a "kitchen clock project", and was taken the day it stopped working. There are no mechanical connections to this circuit board except for the 328P's IC socket. This clock worked for 3 months, then it quit suddenly. I re-booted it once, it worked for an hour, then it quit again. The only factor that changed after the first three months was a change of seasons (the ambient temperature in the kitchen was reaching 90+ degrees F during the day). I don't know if the "blobs" of paste were touching each other when I assembled it, but they were when it failed. How does thick soldering paste start moving around on it's own? With some heat and Capillary action of course :)
Cleaning the board with Isopropyl alcohol fixed the problem, and the clock has been running for the past 6 months without issue.
EDIT 2
When I monitor pin 9 of a 328P on a 5V Arduino Uno, this is the waveform I see.

You can see the small amount of voltage change the oscillator has to make for the 328P to sense it, and function correctly (800mV peak to peak). If the soldering paste is conductive, capacitive or perhaps both, connecting this signal through the paste to ground, power or several other pins can disrupt the signal to the point where the IC fails to operate.

"If enough paste bridges a gap between the ceramic resonator and the IC, it can attenuate the oscillator signal to the point where the board won't work."  Can you please backup your comment. Why do you think this would affect the 26MHz signal? Or is this only your opinion?

What 26MHz signal are you referring to? The OP is using an Adafruit Feather 328P running at 8MHz / 3.3V: https://learn.adafruit.com/adafruit-feather-328p-atmega328-atmega328p/overview My answer is not an opinion, it's a fact, and it happened to me. Excess soldering paste that bridges the gap between GND and the oscillator circuit can attenuate the signal to the point where the board stops working. No oscillator means no "uploading" either. I will edit my answer to provide proof.

My mistake I thought the Feather was a ESP8266 board. Then excessive flux on the board certainly had nothing to do with the failure. As far as the white residue, yes that is typical of a no clean flux. I have worked for electronic manufactures for the past 35 years. The past 33 designing electronic hardware. When I started the company I worked for used a freon based cleaner. It worked great but it was bad for the environment. They went to no clean and the boards certainly did not look as good. The next company used a water soluble flux, better, but now use no clean. Same with current company.

I was looking at the flux on the board and not looking at all the stuff on the board. Looking for failure cause. But the focus is off so I didn't spend much time on it. I never noticed the 328P text on the board.

By "paste" do you really mean "flux"? Solder paste is something completely different. It's microscopic solder balls suspended in flux used for reflow soldering of SMD components.

My container says "Kester soldering paste" on it, not "solder paste". It looks similar to the one here: https://www.worthpoint.com/worthopedia/vintage-kester-soldering-paste-oz-476848944 The word "flux" does not appear on the container. The product inside the container looks the same as the paste or flux in the OP's picture. I left a comment for the OP yesterday to clarify exactly what they are using.

Your paste is probably full of contaminants. You should try this with solder with a flux core. Also try and not go overboard on the flux as you did.

There is flux on the board and that is not going to cause the problems you are seeing. At worst the flux may have an affect on the ability to get a proper lock at 2.5GHz, and that is unlikely.
Clean the board and use magnification to look for damage to the copper foil on the board and inside the plated holes. That will most likely be the problem.
This was from a question regarding no-clean fluxes but the information also applies to the use of regular flux as well.

Today, one of the most common reasons to remove no-clean fluxes is to
  prevent malfunctions in circuits with clock speeds over 1 gigahertz.
  "When you get above 1 gigahertz, the electronscan conducted on the
  outer surface of the conductor. If you have flux on those conductors
  that have those high clock speeds, it can interfere with these fast
  signals."
  http://www.circuitnet.com/experts/73284.html

Most electronics are not cleaned after soldering. The company I work for went to a no clean process 20 years ago.

What 2.5GHz signal are you referring to? The OP is using an Adafruit Feather 328P running at 8MHz / 3.3V: https://learn.adafruit.com/adafruit-feather-328p-atmega328-atmega328p/overview Unfortunately, I don't know anything about "no-clean fluxes". I use Kester Soldering Paste. It has a distinctive color, just like the color of the soldering paste in the OP's pictures. I have a few hundred modules / circuit boards manufactured in China that have a white residue on them. Is this what "no-clean flux" looks like?

My mistake I thought the Feather was a ESP8266 board.  Then excessive flux on the board certainly had nothing to do with the failure. As far as the white residue, yes that is typical of a no clean flux. I have worked for electronic manufactures for the past 35 years. The past 33 designing electronic hardware. When I started the company I worked for used a freon based cleaner. It worked great but it was bad for the environment. They went to no clean and the boards certainly did not look as good. The next company used a water soluble flux, better, but now use no clean. Same with current company.


text:
Esp8266-01 AT Commands returns partially
Im trying to get html response from server via esp01 module
when using the serial monitor in arduino studio everything works fine
here is the serial monitor output
AT+CIPSTART="TCP","aaaa.aaaa",80

CONNECT

OK
AT+CIPSEND=43

OK
>
Recv 43 bytes

SEND OK

+IPD,227:HTTP/1.1 200 OK
Date: Sat, 19 Jan 2019 18:42:58 GMT
Server: Apache
X-Powered-By: PHP/7.2.11
Vary: Accept-Encoding,User-Agent
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

10
Hello from server

0

CLOSED

but when im trying to do the same from the sketch my response is returned partially
AT+CIPSTART="TCP","aaaa.aaaa",80

CONNECT

OK
AT+CIPSEND=43

OK
>
Recv 43 bytes

SEND OK

+IPD,227:HTTP/1.1 200 OK
Date: S

it ends on the first letter of date for some reason
here is my sketch
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX //serial for comunication with esp
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.setTimeout(5000);//dont know if i need this

  delay(10000);

  //check wifi module
  mySerial.println("AT");
  delay(1000);
  if(mySerial.find("OK"))
  {
    Serial.println("Initializing");
  }else{
    Serial.println("Error initializing");
  }
}

void loop() { // run over and over

  Serial.println("go");
mySerial.println("AT+CIPSTART=\"TCP\",\"aaaa.aaaa\",80");
delay(1000);
    while(mySerial.available()){
    Serial.write(mySerial.read());
     delay(1);
  }
mySerial.println("AT+CIPSEND=43");
delay(1000);
    while(mySerial.available()){
    Serial.write(mySerial.read());
     delay(1);
  }
mySerial.println("GET /load.php HTTP/1.1");
delay(100);
    while(mySerial.available()){
    Serial.write(mySerial.read());
     delay(1);
  }
mySerial.println("Host: aaaa.aaaa");
delay(100);
    while(mySerial.available()){
    Serial.write(mySerial.read());
     delay(1);
  }
mySerial.println("");
delay(2000);

    while(mySerial.available()){
    Serial.write(mySerial.read());
     //delay(100);
  }

delay(5000);

}

what is the reason for this behavior?
how can i fix this?

your while (mySerial.available()) ends at the first gap between bytes. the Serial at 9600 baud is very slow

https://majenko.co.uk/blog/reading-serial-arduino

looks like your sketch is not waiting for the data stream to finish

@Juraj increasing baud did not help

@jsotola how can i add that?

found the solution
i had t wait for serial input without delay function
String sendCommand(String command, const int timeout)
{
  String res = "";
  mySerial.println(command); // send the read character to the wifi
  long int time = millis();
  while( (time+timeout) > millis())
  {
    while(mySerial.available())
    {
      // The esp has data so display its output to the serial window
      char c = mySerial.read(); // read the next character.
      res+=c;
    }
  }
  //Serial.print(response);
  return res;
}

It's OK to accept your own answer if it solves the problem. I think you get 15 rep for that.


text:
Strange values on Serial Monitor even with matched baud rate

I am using the Adafruit Flora, connected with a Max 4466 microphone sensor. When I read values from the pin numbered 12 (which is marked as a11 for analog input on the schematic of the flora) I get random characters in the serial monitor as shown in the attached image, with my code. Trying to read other pins that are connected to nothing doesn't read any information. My baud rate in the serial monitor and the code are the same as you can see in the image.
Looking at the max 4466 explanation on the Adafruit website it says you don't need a capacitor or anything and can just directly plug the out pin on the MAX 4466 to the analog pin on an Arduino. I'm not sure if a different protocol has to be followed for a Flora instead of an Arduino. It also says to convert the information to an actual signal I need to use the FFT libraries, but I don't think this input being read is even correct.
If the FFT library is the problem here, I would need help on how to use it because there is no clear value being read in the example code. I had to set up a delay in the code otherwise the IDE would crash from all the info.Additionally, the VCC on the max is connected to 3.3V, the GND to GND, and the OUT to the #12 pin on the Flora.

Try to print "Hello World" and nothing else. Tell us the result.

You can't concatenate string and value inside Serial.println().
Print them using two different Serial.println().
int pin12;
int A12 = A12;

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

void loop() {
  // put your main code here, to run repeatedly:
  pin12 = analogRead(A11);

  Serial.print("pin 12 is ");
  Serial.println(pin12);

  delay(5000);
}


text:
Problem “Didn't find PN53x board” Arduino NFC Card Reader
i am using the elechouse PN532 RFID Module with an Wemos D1 mini in the Arduino IDE.
I use the ISO1443a_uid example from the elechouse library. All works fine if i plug the USB Cable into the wemos and the demo runs. But if i press the reset button on the Wemos D1 mini then the Serial brings this output:
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v0fd86a07
~ld
Hello!
Didn't find PN53x board

Sometimes it works fine but mostly comes this error.
Here is the sample code (i am using the I2C Mode):
* When the number after #if set as 1, it will be switch to SPI Mode*/
if 0
 #include <SPI.h>
 #include <PN532_SPI.h>
 #include "PN532.h"

 PN532_SPI pn532spi(SPI, 10);
 PN532 nfc(pn532spi);

* When the number after #elif set as 1, it will be switch to HSU Mode*/
elif 0
 #include <PN532_HSU.h>
 #include <PN532.h>

 PN532_HSU pn532hsu(Serial1);
 PN532 nfc(pn532hsu);

* When the number after #if & #elif set as 0, it will be switch to I2C Mode*/
else
 #include <Wire.h>
 #include <PN532_I2C.h>
 #include <PN532.h>
 #include <NfcAdapter.h>

 PN532_I2C pn532i2c(Wire);
 PN532 nfc(pn532i2c);
endif

oid setup(void) {
 Serial.begin(115200);
 Serial.println("Hello!");
 pinMode(D2,INPUT_PULLUP);
 pinMode(D1,INPUT_PULLUP);
 nfc.begin();

 uint32_t versiondata = nfc.getFirmwareVersion();
 if (! versiondata) {
   Serial.print("Didn't find PN53x board");
   while (1); // halt
 }

 // Got ok data, print it out!
 Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
 Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
 Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);

 // Set the max number of retry attempts to read from a card
 // This prevents us from waiting forever for a card, which is
 // the default behaviour of the PN532.
 nfc.setPassiveActivationRetries(0xFF);

 // configure board to read RFID tags
 nfc.SAMConfig();

 Serial.println("Waiting for an ISO14443A card");

oid loop(void) {
 boolean success;
 uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
 uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

 // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
 // 'uid' will be populated with the UID, and uidLength will indicate
 // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
 success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);

 if (success) {
   Serial.println("Found a card!");
   Serial.print("UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
   Serial.print("UID Value: ");
   for (uint8_t i=0; i < uidLength; i++)
   {
     Serial.print(" 0x");Serial.print(uid[i], HEX);
   }
   Serial.println("");
   // Wait 1 second before continuing
   delay(1000);
 }
 else
 {
   // PN532 probably timed out waiting for a card
   Serial.println("Timed out waiting for a card");
 }

What is wrong? why is it not alltimes working after a reset?

I've had one of those elechouse PN532's sitting in a drawer waiting for the right project to come along - wow!! they sure are flakey in I2C mode - little less flakey when I added pullup resistors to SCL and SDA - but 50/50 at best - never had an issue with it in SPI mode

I2C on the PN532, at least using the library you are using, is not very reliable - even with adafruit library and using IRQ and RESET pins, it's still a 50/50 chance that the board is detected. I've tried many things to make mine work and have come to the conclusion that I should either use SPI or HSU mode - these are 100% reliable - and since I'll only ever need to read NFC tags, I think I'll stick to the MFRC522

EDIT:
Try using Elechouse library, it worked better for me.

This might be irrelevant, but I wanted to share.
I had a similar issue, not related to the sketch code.
So make sure:

Connect wires to the NFC module at 90 degrees - there should be angular headers included. Also the wires should be above the antenna - the white strip.
There shouldn't be any wires underneath the NFC module or they should on significant distance.
Soldered wires work better on the NFC module.


text:
Badly formatted characters using JDY-30 bluetooth module
I have a JDY-30 bluetooth module and have it wired like this (except using an Arduino Uno):
It is working, but I need to use it with a 115200 baud rate instead of the default one of 9600.
I also got that working.
Here is the code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial (2, 3); // RX, TX

// state | RXD | TXD | GND | VCC | EN

void setup () {
  mySerial.begin(115200);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
}

void loop() {

  while (mySerial.available()) {
    delay(10);
    Serial.write(mySerial.read());
    delay(10);
  }

  while (Serial.available()) {
    mySerial.write(Serial.read());
  }

}

But when I type things I often get badly formatted characters.
Some examples:

16:32:33.212 -> +VERSION=Firmware V3.0.6,Bluetooth V4.0 L⸮
16:32:38.990 -> +VERSION=Firmware V3.0.6,Bluetooth V4.0 LE

more:

16:33:27.144 -> +NAME=CC61-A
16:33:30.054 -> +NAME=CC41-A

If I also use 115200 baud rate for the Arduino, then it gets really worse.
Is there a solution for this?
See more about the JDY-30 here:
http://myosuploads3.banggood.com/products/20181203/20181203214419JDY-30-SPP-Bluetooth-Module.pdf

It is impossible to reliably receive using SoftwareSerial at 115200 baud. The UNO is just too slow for that.

Also the 3.3V logic of the bluetooth unit is right on the HIGH threshold of the 5V logic of the Arduino. There is little margin for error, which makes it very prone to noise.

@Majenko what about writing, is that reliable? I don't care so much for the reading.

Writing is fine, yes. The Arduino is in control of the flow in that situation, so speed is less critical.

As @Majenko pointed out:

It is impossible to reliably receive using SoftwareSerial at 115200
  baud. The UNO is just too slow for that.

I got results that where a lot better by first making a string when reading and then once we have a string send that. Instead of sending what we read all the time.
For example, when I tried AT+VERSION now it took me 16 attempts to get a wrong one, and only one character out of 42 was wrong that time.
#include <SoftwareSerial.h>

SoftwareSerial mySerial (2, 3); // RX, TX

// state | RXD | TXD | GND | VCC | EN

void setup () {
  mySerial.begin(115200);
  Serial.begin(115200);
  Serial.println("Enter AT commands:");
}

void loop() {

  String input_string = "";

  while (mySerial.available()) {
    input_string += (char)mySerial.read();
  }

  if (input_string != "") {
    Serial.write(input_string.c_str());
  }

  while (Serial.available()) {
    mySerial.write(Serial.read());
  }

}


text:
What am I missing? Send data from Matlab to Arduino to Micro SD
First off. This is not in any way a class assignment. This is my own personal work and research. I just want to get that out of the way.
I am learning how to use Matlab with various Arduino projects. I am a seasoned Matlab user but I am fairly new to the entire Arduino space.
I am trying to send some numerical data from Matlab (via a GUI) to my Arduino Uno and have the Arduino write it to my micro SC card. This is a temporary step to my larger project. However, there is no need to go into those specifics as they are outside of the scope of my issues.
I am fairly confident that the Matlab code works and the Arduino code is slightly modified from another project I did where I wrote and read random numbers from my micro SD card.
However, as I run the Matlab code, the Arduino blinks as if it is receiving the data but after I check the micro SD card it remains blank.
I am confident that my Arduino is wired correctly to my micro SD card adapter since this remains the same from my prior project.
Therefore, I am sure I am missing something trivial to get it to work.
I have researched several websites on the subject and their method and mine seem to align very well.
I am fairly certain the problem is in the conditional statement:
if (Serial.available() > 0) {

As you will see.
The Matlab code is below:
arduinoCom = serial('COM3', 'BaudRate', 115200);
sendData = 5;
fopen(arduinoCom);
fprintf(arduinoCom,'%i',sendData); %this will send 5 to the arduino
fclose(arduinoCom);
delete(arduinoCom);

The Arduino code is as follows:
#include <SD.h> // load SD library

int chipSelect = 4;  // Chip select pin for the MicroSD Card Adapter
int incomingByte = 0; // for incoming serial data.
File SDF; // Serial data received is saved here.

void setup() {
     Serial.begin(115200); // start serial connection to print out debug messages and data
     pinMode(chipSelect, OUTPUT); // chip select pin must be set to OUTPUT mode
     if (!SD.begin(chipSelect)) { // Initialize SD card
        Serial.println("Could not initialize SD card."); // if return value is false, something went wrong.
     }
     while (!Serial) {
     }
}

void loop() {
        // Open file, Write data, Close file only when you receive data
        if (Serial.available() > 0) {
           incomingByte = Serial.read();
           SDF = SD.open("SerialDataFile.txt", FILE_WRITE); // open "SerialDataFile.txt" to write data
           SDF.println(incomingByte, DEC); // write ASCII-encoded decimal number to file
           SDF.close(); // close file
           }
}

The expected result would be a file "SerialDataFile.txt" stored on my micro SD card with the value 5.
Thank you for your help!

Comments are not for extended discussion; this conversation has been moved to chat.

Look, this is not a forum. Please refrain from answering the question, or making suggestions, in comments. Comments under the question are for clarifying any confusing parts of the question, and requesting further information.

I am not seeing a way to check this answer as complete. - there is some sort of time delay. Check back tomorrow.

The board resets on new USB connection with fopen. Wait 2 secs between fopen and fprintf in Mathlab code.


text:
Arduino Driving Pump via MOSFET
I want to turn on a pump that is running 12V and draws a current of max 1.7A with my Arduino Uno.
To do this, I bought the RFP30N06LE MOSFET and followed these instructions to wire it all up.
I connected the red wire from the pump to VIN of the Arduino and plugged a 12V 2A power brick into the Arduino. However, when I put the output pin to HIGH, the pump only pumps weakly and the MOSFET gets very hot.
When I connect the pump straight to VIN and GND, it works as expected, so the Arduino is able to provide the required current. I'm thinking that there is something to the MOSFET that I am not understanding correctly. I measured VGS at 4.5V, so the MOSFET should be able to handle the current. Is there anything I am missing?
This is the wiring:

This is the (very simple) sketch I'm using to test it all:
#define PIN_PUMP_ON 7

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

void loop() {
  digitalWrite(PIN_PUMP_ON, HIGH);
  delay(1000);
}

Can you show a photo of the wiring? or a schematic. Can you show the sketch that you use. Be careful with 12v. Never power the motor via the VIN pin. Use the 12v to power the arduino board and the motor. Do you use a breadboard, that will go wrong. A breadboard can not handle the high current of the motor. The mosfet is a very nice mosfet, it should not get hot.

followed these instructions .... no you did not .... the instructions do not say to connect the motor to the Arduino Vin

I added the sketch and a wiring diagram. What is the issue with using VIN? According to the Arduino docs, it can be used to access the 12V I'm supplying with the power jack: You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

Between the barrel jack power plug and VIN is a diode. It depends on the arduino uno or clone how much current that diode can take, but 1.7 amps is too much. You also let the ground current of the motor go through the arduino board via the GND pin. I don't like that either.

I would expect the diode to release it's magic smoke within seconds of motor on.

A higher VGS voltage may reduce the RDS resistances. Try adding a pull-up to to the 12V on the Gate. The add a regular NPN transistor to allow the arduino to pull this gate voltage down to ground to turn the motor of. This transistor is needed because the arduino pins can't handle 12V. See this answer for a nice schematic

The code void loop() {
digitalWrite(PIN_PUMP_ON, HIGH);
delay(1000);
}  does not turn the pump off - the pin needs a LOW written to it after the delay to turn things off.

Vin is only rated to supply at most 1A due to the reverse polarity protection diode in series from the barrel jack to the Vin pin.  You try and draw 1.7A thru that and you may smoke it.
The Vin header is also only rated for 1A.
Connect the motor to the supply directly. The Arduino Gnd must also connect to the supply.
R2 limits Arduino IO pin current to a safe level. R1 keeps the MOSFET off while the Arduino boots up. Diode dissipates motor generated current when the MOSFET goes from On to Off. The RFP30N06LE looks to be rated for full turn on with Vgs of 5V, and Rds of 47milliohm, that part should be ok to use.
Powering the Arduino from the same source as the motor may cause issues. If you can power the Arduino from USB or a seperate battery pack and not the same 12V that powers the motor, that will probably yield better results, especially if the 12V droops at all under heavy loads from the motor. That could cause Arduino resets.

simulate this circuit – Schematic created using CircuitLab

Rewire the motor power so that it is not using any Arduino Power or GND pins.  Only connect the MOSFET gate to an Arduino pin using a suitable resistor.  The MOSFET drain needs to go directly to your power supply ground.  This way you're not cooking your Arduino.  A relay instead of the MOSFET would prevent the MOSFET resistance from reducing the power of your motor.
The 3 big pins under the Arduino's power connector (2 GND and 1 +V) can be used to power your motor, just solder directly to them for Motor +V and GND for MOSFET drain.  This bypasses the Arduino's diode.

Why do you say not to connect the ground of the arduino and the motor power supply?  I've seen other high amperage projects for Arduino that specifically suggest to do just that, e.g. powering a long string of WS2812b RGB LEDs.  Is there a criteria that is different here (like a motor) that I'm not understanding?

If you connect the ground directly to the barrel jack pins it will prevent the current from running through the Arduino PCB.

I found a reference to the situation that has me confused, see point #7 in this answer: https://arduino.stackexchange.com/a/34531/42061 about running a motor with a separate power supply but connecting the grounds of both supplies.  Maybe this should be a question of its own?

Under no circumstances should you connect the motor to VIN on the Arduino. A motor draws far too much current.
You want to have the ground on the arduino connected to the ground for the motor, but you want different positive supplies for the 2 different devices. You also need to make sure you have a properly sized protection diode wired in parallel with the motor, but pointing against the flow of current.


text:
Arduino and using a SSL secured mqtt broker
I'm looking for a library helping me to connect from an Arduino to a MQTT Broker. Of course I want to secure the connection via TLS/SSL.
The "physical" connection is established via a SIM800 module.
The Arduino itself should be as power efficient as possible (it's battery/solar powered).
In case the Arduino is too weak to perform such a task (SSL) is there any other suitable device? maybe a PyBoard?
Anyone can point me to the right direction?

I think an ESP8266 or an ARM based board running mbed-os would be the minimum requirement for such a product. Have you worked on one of these platforms already?

I used a esp8266 before, but i don't have wlan available at the location where this thing will be placed. thats why I need to use a sim800 module

You can switch off the WiFi radio of the ESP8266 and just use it as a cheap but fast 80MHz processor. But if you need real low power you should look in the STM32L1/4 series, e.g. a Nucleo L476RG board? That can drive the radio and a full TLS session with no problems.


text:
Print Byte Array in Serial monitor screen of Arduino IDE
I need to print mentioned below byte array on the serial monitor screen of Arduino IDE
char b[]= {'0x7E', '0x00', '0x1C','0x90', '0x00', '0x13', '0XA2', '0x00', '0x41', '0x58', '0x1C', '0xCB', '0xFF', '0xFE', '0xC1', '0x7C', '0x00','0x0F', '0x00', '0x01', '0x00', '0x00', '0x37', '0x46', '0x46', '0x46', '0x00', '0x00', '0x00', '0xE7' };
void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println(b[]);
delay(500);
}

But whenever I am trying a print, the error problem was there which was not resolved which is
C:\Users\Misha\Desktop\test\Test_2\Test_2.ino: In function 'void loop()':

Test_2:8:18: error: expected primary-expression before ']' token

 Serial.println(b[]);

                  ^

exit status 1
expected primary-expression before ']' token

Any suggestions on this will be great help.

what is b[]? array variable is simply b.

Hey, Thanks for the suggestion whenever I have used Serial.println(b) also but its printing only the LSB value, I am not able to print the MSB values.

of course. you can't print an array with print and invalid syntax will not help with it

What MSB values are you on about? You just have a list of 8 bit values. There is nothing "MSB" or "LSB" about them. I think you need to go back and rethink what it is you are doing and asking and get the two to match up.

You can’t print an array in that way.
If you want to print an array of hexadecimal value (with two digits), you have to use sprintf function and change declaration of b array.
uint8_t b[]= {0x7E, 0x00, 0x1C, 0x90, 0x00, 0x13, 0XA2, 0x00,
              0x41, 0x58, 0x1C, 0xCB, 0xFF, 0xFE, 0xC1, 0x7C,
              0x00, 0x0F, 0x00, 0x01, 0x00, 0x00, 0x37, 0x46,
              0x46, 0x46, 0x00, 0x00, 0x00, 0xE7};
int i;

void printHex(uint8_t num) {
  char hexCar[2];

  sprintf(hexCar, "%02X", num);
  Serial.print(hexCar);
}

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

void loop() {
  for(i=0; i<sizeof(b); i++){
    printHex(b[i]);
 }

 Serial.println();
 delay(500);
}

The output produced is:

7E001C900013A20041581CCBFFFEC17C000F0001000037464646000000E7
  7E001C900013A20041581CCBFFFEC17C000F0001000037464646000000E7
  7E001C900013A20041581CCBFFFEC17C000F0001000037464646000000E7

Similar in this case It only displays the LSB values but no MSB values were displayed in serial monitor screen

What do you want to print? ASCII character or the hex value? In serial monitor Do you want this: 7E 00 ... ?

@varuljain I updated the answer.

Btw the buffer is too small to contain two characters and '\0' character.

I am anxious to understand HOW to use the Serial Monitor

I am anxious to understand HOW to use the Serial Monitor input line to write/change the elements of the array (instead of declaring the array as is done in [1 Answer ] above. marty Jan 8 2020


text:
ESP8266 EEPROM seems not working, saved data are different when I try to read them
I'm working on project which require to save some data into the EEPROM.
As I read online the ESP8266 has no real EEPROM, it use a section of FLASH just after the SPIFFS. Due to this read/write is quite different from standard Arduino, you need to call EEPROM.commit(). You also have to call EEPROM.begin(size) (I used size = 512) before start to use it.
I follow different tutorials online and I made some tests but it seems not working at all. When I try to save a value and then read it, values are different. I tried with
EEPROM.write(..)
...
EEPROM.read(..)

and with
EEPROM.put(..)
...
EEPROM.get(..)

but nothing change.
Is there any configuration on the board I need to set into Arduino IDE/Board Configuration?
EDIT: here's the code
void setup()
{
    Serial.begin(9600);
    Serial.println();

    EEPROM.begin(512);
    EEPROM.write(0, 62);
    EEPROM.write(10, 103);
    //EEPROM.commit();
    EEPROM.end();
    Serial.print("Read at 0:"); Serial.println(EEPROM.read(0), DEC);
    Serial.print("Read at 10:"); Serial.println(EEPROM.read(10), DEC);
}

I always read 0 in the output.

why not just use SPIFFS? it's way simpler, far larger, and better organized.

@dandavis I only need to store a few bytes, use a file system seems too much 'expensive' to achieve this simple task.

It's not that expensive, and in fact, it has wear-leveling, which is (potentially) a huge long-term reliability benefit, especially when most of your blocks will be empty. It's not really a full file system, there's not even paths (just names), so it's more a fast key/value store of it's own right. I would try it and see if it bogs down your project; I can't image it would be much worse than EEPROM unless your doing something that will wear out either...

you can read only between begin and end. it works with memory image. begin allocates the in-memory image. commit writes it to flash. end commits and deletes the memory image

@Juraj thanks a lot! For me it's the best answer. It works and now I understande the reason. Btw it is not very well documented this procedure.

You can read the emulated EEPROM only between begin and end. It works with memory image.

begin allocates the in-memory image.
commit writes it to flash.
end commits and deletes the memory image.

Here is some ESP8266 example code to store and read strings from EEPROM data:
#include <EEPROM.h>

void writeString(char add,String data);
String read_String(char add);

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

  EEPROM.begin(512);  // Note::

  String data = "Hello World";

  Serial.print("Writing Data:");
  Serial.println(data);

  writeString(10, data);  //Address 10 and String type data
  delay(10);
}

void loop() {
  // put your main code here, to run repeatedly:
  String recivedData;
  recivedData = read_String(10);
  Serial.print("Read Data:");
  Serial.println(recivedData);
  delay(1000);
}

void writeString(char add,String data)
{
  int _size = data.length();
  int i;
  for(i=0;i<_size;i++)
  {
    EEPROM.write(add+i,data[i]);
  }
  EEPROM.write(add+_size,'\0');   //Add termination null character for String Data
}

String read_String(char add)
{
  int i;
  char data[100]; //Max 100 Bytes
  int len=0;
  unsigned char k;
  k=EEPROM.read(add);
  while(k != '\0' && len<500)   //Read until null character
  {
    k=EEPROM.read(add+len);
    data[len]=k;
    len++;
  }
  data[len]='\0';
  return String(data);
}


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

What I want it to do is:

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

   void setup() {

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

}

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

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

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

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

Finally the question: What do I need to add to this code to make it work in my application?
PS.  Issues regarding safety are addressed by another board that have fuse and over voltage protection.
PPS. I have 5V supply dedicated to driving the board and Arduino.
enter code here
void setup() {

}

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

  void loop() {

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

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

   wcisniety=digitalRead(4);

   }

 void zgrzewaj(){

   while (digitalRead(0)){

    }

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

delayMicroseconds(faza);

digitalWrite(1,HIGH);

delay(10-faza/1000);

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

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

Link to project page at electronoobs: http://www.electronoobs.com/eng_circuitos_tut20.php @Pioter, the arduino leonardo has an other microcontroller than the arduino uno and at electronoobs they use an arduino uno.

The higher level functions do the same, for example digitalWrite( 13, HIGH). Everything below that is different.


text:
LCD shows output without pressing the sensor
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
#define vibrate_sense 7

char str[70];
char *test="$GPGGA";
char logitude[10];
char latitude[10];

int i,j,k;
int temp;
//int Ctrl+z=26;    //for sending msg
int led=13;

void setup()
{
  lcd.begin(16,2);
  Serial.begin(4800);
  pinMode(vibrate_sense, INPUT);
  pinMode(led, OUTPUT);
  lcd.setCursor(0,0);
  lcd.print("..Initializing..");
  lcd.setCursor(0,1);
    lcd.print("....System...");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
  lcd.print("Searching for");
    lcd.setCursor(0,1);
      lcd.print("Gps Signals");
  delay(2300);
lcd.clear();
  lcd.setCursor(0,0);
    lcd.print("Setup Completed");
  delay(500);
  lcd.setCursor(0,0);
    lcd.print("Accident detect");
  lcd.setCursor(0,1);
    lcd.print("& Alert system");
  delay(1500);
  lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("No accident");
        lcd.setCursor(0,1);
        lcd.print("occured");

}

void loop()
{
  if (digitalRead(vibrate_sense)==0)
  {
    for(i=18;i<27;i++)          //extract latitude from string
    {
      latitude[j]=str[i];
      j++;
    }

    for(i=30;i<40;i++)          //extract longitude from string
    {
      logitude[k]=str[i];
      k++;
    }

lcd.clear();
    lcd.setCursor(0,0);        //display latitude and longitude on 16X2 lcd display
    lcd.print("Latitude(N)");
    lcd.print(latitude);
    lcd.setCursor(0,1);
    lcd.print("Longitude(E)");
    lcd.print(logitude);
    delay(500);
    lcd.clear();
        lcd.setCursor(0,0);
    lcd.print("Accident has");
            lcd.setCursor(0,1);
    lcd.print("been Detected");
delay(500);
lcd.clear();
    lcd.print("Sending SMS");
    delay(500);
    lcd.clear();
    Serial.begin(9600);

    Serial.println("AT+CMGF=1");    //select text mode
    delay(10);
    Serial.println("AT+CMGS=\"7066128969\"");  // enter receipent number
    Serial.println("Vehicle Accident occured:");
    Serial.print("Latitude(N): ");             //enter latitude in msg
    Serial.println(latitude);                  //enter latitude value in msg
    Serial.print("Longitude(E): ");            //enter Longitude in Msg
    Serial.println(logitude);                  //enter longitude value in msg
    Serial.print("http://maps.google.com/maps?&z=15&mrt=yp&t=k&q=");
    Serial.println(latitude);
    Serial.println("+");
    Serial.println(logitude);
    Serial.write(26);                      //send msg  Ctrl+z=26

      lcd.setCursor(0,0);
    lcd.print("SMS Sent");
delay(1000);
lcd.clear();
          lcd.setCursor(0,0);
    lcd.print("Help Please");

    temp=0;
    i=0;
    j=0;
    k=0;
    delay(20000);                        // next reading within 20 seconds
    Serial.begin(4800);
  }
}

void serialEvent()
{
  while (Serial.available())            //Serial incomming data from GPS
  {
    char inChar = (char)Serial.read();
     str[i]= inChar;                    //store incomming data from GPS to temparary string str[]
     i++;
     if (i < 7)
     {
      if(str[i-1] != test[i-1])         //check for right string
      {
        i=0;
      }
     }
    if(i >=60)
    {
     break;
    }
  }
}

This is my code for my project.
It is accident detection system and it has to work like, when I press the sensor or limit switch, it has to show a message on an LCD that an accident occurred. But it shows the message on the LCD WITHOUT pressing the sensor button.
What to do?
I think there is a mistake in my program. Can anybody please tell me where it is?

you have not learned the basics before attempting your program ...... start by writing a short program that turns on an LED when the button is pressed and turns off the LED when the button is released

Do you have a pullup resistor?

Please do not vandalize your or anyone else's posts. By posting on the Stack Exchange network, you've granted a non-revocable right for SE to distribute that content (under the CC BY-SA 3.0 license). By SE policy, any vandalism will be reverted.

First off I edited indentation in your code because incorrect indentation is little bit confusing.
#include <LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
#define vibrate_sense 7

char str[70];
char *test="$GPGGA";
char logitude[10];
char latitude[10];

int i,j,k;
int temp;
//int Ctrl+z=26;    //for sending msg
int led = 13;

void setup(){
  lcd.begin(16,2);
  Serial.begin(4800);

  pinMode(vibrate_sense, INPUT);
  pinMode(led, OUTPUT);

  lcd.setCursor(0,0);
  lcd.print("..Initializing..");
  lcd.setCursor(0,1);
  lcd.print("....System...");
  delay(1000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Searching for");
  lcd.setCursor(0,1);
  lcd.print("Gps Signals");
  delay(2300);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Setup Completed");
  delay(500);
  lcd.setCursor(0,0);
  lcd.print("Accident detect");
  lcd.setCursor(0,1);
  lcd.print("& Alert system");
  delay(1500);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("No accident");
  lcd.setCursor(0,1);
  lcd.print("occured");
}

void loop(){
  if (digitalRead(vibrate_sense) == 0){
    for(i = 18; i < 27; i ++){          //extract latitude from string
      latitude[j]=str[i];
      j++;
    }

    for(i=30;i<40;i++){          //extract longitude from string
      logitude[k] = str[i];
      k++;
    }

    lcd.clear();
    lcd.setCursor(0,0);        //display latitude and longitude on 16X2 lcd display
    lcd.print("Latitude(N)");
    lcd.print(latitude);
    lcd.setCursor(0,1);
    lcd.print("Longitude(E)");
    lcd.print(logitude);
    delay(500);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Accident has");
    lcd.setCursor(0,1);
    lcd.print("been Detected");
    delay(500);
    lcd.clear();
    lcd.print("Sending SMS");
    delay(500);
    lcd.clear();
    Serial.begin(9600);

    Serial.println("AT+CMGF=1");    //select text mode
    delay(10);
    Serial.println("AT+CMGS=\"7066128969\"");  // enter receipent number
    Serial.println("Vehicle Accident occured:");
    Serial.print("Latitude(N): ");             //enter latitude in msg
    Serial.println(latitude);                  //enter latitude value in msg
    Serial.print("Longitude(E): ");            //enter Longitude in Msg
    Serial.println(logitude);                  //enter longitude value in msg
    Serial.print("http://maps.google.com/maps?&z=15&mrt=yp&t=k&q=");
    Serial.println(latitude);
    Serial.println("+");
    Serial.println(logitude);
    Serial.write(26);                      //send msg  Ctrl+z=26

    lcd.setCursor(0,0);
    lcd.print("SMS Sent");
    delay(1000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Help Please");

    temp = 0;
    i = 0;
    j = 0;
    k = 0;
    delay(20000);                        // next reading within 20 seconds
    Serial.begin(4800);
  }
}

void serialEvent(){
  while (Serial.available()){            //Serial incomming data from GPS
    char inChar = (char)Serial.read();
    str[i] = inChar;                    //store incomming data from GPS to temparary string str[]
    i++;
    if (i < 7){
      if(str[i-1] != test[i-1]){         //check for right string
        i = 0;
      }
    }
    if(i >= 60){
      break;
    }
  }
}

Second thing is this line if (digitalRead(vibrate_sense) == 0){ you are checking there vibrate_sense for value 0. Are you sure, that triggered value is 0 and not 1? Try this code to test which value is equal to triggered state.
#define vibrate_sense 7

void setup() {
  Serial.begin(9600);
  Serial.println("Sensor testing");
  pinMode(vibrate_sense, INPUT);

}

void loop() {
  Serial.println(digitalRead(vibrate_sense));
  delay(300);
}

Last thing is connection of your sensor/button. For button you have to use also PULL_UP/PULL_DOWN resistor to have correct logic value on digital pin.


text:
How to send chars and values at the same time from processing to Arduino
i have been trying to set Builtin LED frequency from arduino and turn it on and off .
I have created an interface with knobs and buttons in processing . I want to set delay between ON and OFF with 1 knob and OFF and ON delay with another knob . And button blinks the led at given frequency
In arduino i have tried something like this :
if(Serial.available() >0){
char val=Serial.read();
switch(val)
{
  case 'c':
  theValue=Serial.read();
  break;
  case 'd':
  theValue1=Serial.read();
  break;

case 'r':
digitalWrite(13,HIGH);
delay(theValue);
digitalWrite(13,LOW);
delay(theValue1);

break;
}

}

In the processing :
  public void Blink(){
   myPort.write('r');
 }

 public void knobON(int theValue){
   myPort.write('c');
   myPort.write(theValue);
 }

 public void knobOFF(int theValue1){
   myPort.write('d');
   myPort.write(theValue1);
 }

Can you help me on what should i do ?

Do you really need to read char over serial?  Why not send an number, i.e. integer?

The Arduino code sample you've provided is incomplete, and does not compile. On the Processing side, I would combine the LED On time with the Off time, using a separator, then ending with a \n. Something like this: myPort.write("1000:2000\n");.
There are many ways to parse the serial data into unsigned long to be used in the delay() function. Here is a sketch illustrating one way to parse it. I am using the serial monitor to send the following test data 1000:2000 (LED on for 1 second, off for 2 seconds). The serial monitor is sending the \n character.
char buffer[16];
unsigned long onTime;
unsigned long offTime;

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

void loop(){

  if(Serial.available() > 0){

    Serial.readBytesUntil('\n', buffer, 13);

    char * pch;
    pch = strtok(buffer, ":");
    onTime = strtol(pch, &pch, 10);
    pch = strtok(NULL, ":");
    offTime = strtol(pch, NULL, 10);

    digitalWrite(13, HIGH);
    delay(onTime);
    digitalWrite(13, LOW);
    delay(offTime);
    memset(buffer, 0, sizeof(buffer));
  }
}


text:
Is not it possible to use more than 3 output pins in ESP8266 at the same time?
I'm trying to make a WiFi controlled Car from my old toy car which will be running on ESP8266. I'm using the L298N motor driver and have one motor for left-right control & other for forward-backward direction control.
Now the problem is I'm unable to use more than 3 pins at once. If I even try, likely my code stops working.
Below is my code :
static const uint8_t enFront   = D0;
static const uint8_t front_in1 = D1;
static const uint8_t front_in2 = D2;
static const uint8_t enBack    = D5;
static const uint8_t back_in1  = D3;
static const uint8_t back_in2  = D4;

#include <ESP8266WebServer.h>

const char* ssid = "espCar <^_^>";
const char* password = "hacksAllowed";

  ESP8266WebServer server(80);

void setup() {
  pinMode(enFront,OUTPUT);
  pinMode(front_in1,OUTPUT);
  pinMode(front_in2,OUTPUT);
 /* pinMode(enBack,OUTPUT);   <--Problem here
  pinMode(back_in1,OUTPUT);   <--Problem here
  pinMode(back_in2,OUTPUT);*/ <--Problem here

   Serial.begin(115200);
  WiFi.softAP(ssid, password);
  WiFi.mode(WIFI_AP);
  delay(500);
  server.on("/REQ",processRequest);
  server.begin();
  Serial.println("Server is UP!");
}

void loop() {
 // server.handleClient();
  analogWrite(enFront,1023);
  digitalWrite(front_in1,HIGH);
  digitalWrite(front_in2,LOW);
  delay(2000);
  digitalWrite(front_in2,HIGH);
  digitalWrite(front_in1,LOW);
  delay(2000);
}

void processRequest() {
 /* if (server.arg("move")!=""){
    if (server.arg("right")!=""){
      analogWrite(enFront,server.arg("right").toInt());
      digitalWrite(front_in1,HIGH);
      digitalWrite(front_in2,LOW);
      /*Debug*/
    /*  server.send(200, "200", server.arg("right"));
    }else if(server.arg("left")!=""){
      analogWrite(enFront,server.arg("left").toInt());
      digitalWrite(front_in1,LOW);
      digitalWrite(front_in2,HIGH);
      /*Debug*/
     /* server.send(200, "200", server.arg("left"));
    }
  }*/
}

All code working fine until I declare pinMode(pin,OUTPUT) for any 4th pin. (Everything is ok for every pin till 3rd one is declared)
I'm not so old with ESP or Arduino. So, please help by giving some clarification on this.

Schematic:

simulate this circuit – Schematic created using CircuitLab
Sorry for the mistake of making both motors tagged 2, → one is M1 & other is M2

scheme? (why did you add tags for other boards? I removed them)

ok. on the scheme you have a NodeMcu with Dx labels, in the code you use io pin numbers. you can use Dx constants in code.

pins io 0 and io 2 must be HIGH at boot. it is possible that wiring them to the driver board pulls them down.

Ok. Actually I used System.println to print out D1 to D5 then used them

Ok. Then I will test by keeping them HIGH at BOOT... I think that's happening here. Because adding those last 3 pinMode lines blocking me up.

on the scheme you have D2 (4), D3 (io 0), D4 (io 2) wired

I'm using other pins. It looks nearly to the sceme but not exact. To simplify wiring and push up everything in a small place I did that. :-(

Why can't you draw a schematic that is what you actually have?  You might as well show nothing as to show something that isn't true.

@Delta_G I didn't know about the scematic maker here. *I assume that you've already seen that the site has told me as new contributor

@jsotola I didn't know about the scematic maker here. I assume that you've already seen that the site has told me as new contributor . I knew the code would be enough to diagnose the problem. Next time I ask a question here I'll keep that in mind and I just updated a exact schema

In my project I have 4 relays, PWM output, tone() output, 2 output pins for LED bar, I2C ADC, temperature sensor on A0 and a button. that all on Wemos D1 R2 which has the same io to Dx mapping as NodeMcu

@Juraj Thanks for the support! I've found out what my mistake was

I almost asked if you did connect the groud, because you don't have it in the schema. I magnified the photo from first version of your question and there were black wires so I thought that was the ground connection. Or are those only shadows?

It was my first time on this site. So, there was mistake asking the question, I agree. I even didn't know about the schematic maker here. So, took one nearly same and placed it on the question.
If I've placed the question correctly it won't take much time to get answered. I'll remember these the next time I ask here. :-D

I found out the problem & it has nothing to deal with ESP8266. It was something like voltage conflict (I don't know the deeper science, I agree).
Actually, I was testing by plugging in the USB to ESP & at the same time I had a 11V lipo connected to L298N.
I tested by using one single voltage source & everything worked fine.
It looked something like this (It → the wrong one here):

simulate this circuit – Schematic created using CircuitLab

It is acceptable to connect two DC voltage sources like this, except that you should connect the GND connections together.

I did the same but didn't make the GND together & likely that was the problem


text:
Software reset on Micronucleus possible?
I'm wondering if anyone knows if it's possible to do a software reset using the watchdog timer on a microcontroller using the Micronucleus bootloader.  When I try it, it doesn't fully reset, as in when connected with USB to a computer, it doesn't appear as a libusb device for a short period of time.
I'm suspecting a watchdog timer reset isn't as early in the boot process as necessary for Micronucleus to wait for programming.
I'm using an ATTiny841 to make a small wrist watch for my son, and I wanted to keep it to a single button.  I've been resetting for programming with a pair of tweezers grounding the reset pin side of a pullup.  Not a huge deal if it's not possible, once I have the code set, there won't be much need to re-program.
Here's the watch so far:  https://www.youtube.com/watch?v=lkH16xzkSJM
Thanks in advance!

So you are trying to put the ATTiny into bootloader mode? I think you need to look at the ENTRYMODE setting of the micronucleus bootloader

Ahhh… that looks like it would do it exactly!  Thanks!   I had just been using the pre-compiled firmwares for the 841.  Looks like I'll have to take the plunge and learn how to compile my own.

I just flashed a bootloader compiled with the entry mode set to watchdog and it works perfectly!  Thanks so much, I wouldn't have thought to look for a solution there.

Great to hear. Your project already looks great. Looking forward to seeing the end result (I already subscribed to your youtube channel).

For anyone interested, the watch is pretty much complete.  You can read more about it here:
https://hackaday.io/project/163887-vlads-round-watch
or here:
https://www.hackster.io/chris3d/vlad-s-round-watch-ea1c8f

Thanks. I had already seen it come by on hackaday.io, and recognized it. Liked and Followed. It's looking amazing. Especially the metal housing. Most diy watched i've seen just add some straps, and call it a watch.

Thanks, yea, I enjoy the hardware design part as much as I do the electronics!


text:
HC-05 sending data to Android a value but it cracked out of its form
I am totally beginner but I am trying to finish my project as school work :-(
but from the beginning, I am really stuck.
Could anyone help me out?
#include <SoftwareSerial.h>
SoftwareSerial BTserial(10, 11); // RX | TX

void setup() {
  // initialize serial communication at 9600 bits per second:
  BTserial.begin(9600);
}

void loop() {
  // read the input on analog pin 0:
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  BTserial.print(sensorValue1);
  BTserial.print('|');
  BTserial.println(sensorValue2);
  delay(50);
}

The received value is here
D/BluetoothConnectionSrv: InputStream: 955|108
D/BluetoothConnectionSrv: InputStream: 9
D/BluetoothConnectionSrv: InputStream: 46|51
D/BluetoothConnectionSrv: InputStream: 9
D/BluetoothConnectionSrv: InputStream: 47|57

I need only values from 2 sensors, it seems to be as
    D/BluetoothConnectionSrv: InputStream: 955|108
    D/BluetoothConnectionSrv: InputStream: 946|51
    D/BluetoothConnectionSrv: InputStream: 947|57
I've tried to send "How are you?", then the result in the app was this
D/BF: o
D/BF: u ?Are yo
D/BF: u ?
D/BF: H
D/BF: ow Are you
D/BF:  ?

Source code in my app
        bluetoothSocket = socket;
        InputStream tempIn = null;
        OutputStream tempOut = null;

        try {
            tempIn = bluetoothSocket.getInputStream();
            tempOut = bluetoothSocket.getOutputStream();
        } catch (IOException e) {
            e.printStackTrace();
        }

        inputStream = tempIn;
        outputStream = tempOut;
    }

    public void run(){
        byte[] buffer = new byte[1024];
        int bytes;

        while(true){
            try {
                bytes = inputStream.read(buffer);
                handler.obtainMessage(STATE_MESSAGE_RECEIVED, bytes, -1, buffer).sendToTarget();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

            case STATE_MESSAGE_RECEIVED:
                byte[] readBuff = (byte[]) msg.obj;
                String tempMsg = new String(readBuff, 0, msg.arg1);
                tvMessage.setText(tempMsg);
                Log.d("BF",tempMsg);
                break;

it could be caused by the android app ....... one thing you could try with your program is to change the BTserial.println command to BTserial.print

That extra number is probably associated to println where it appends a new line character, although CR/LF should be 0x0D/0x0A...


text:
Serial.print prints but lcd.print does not
The following code reads a txt file from a SD card, finds the corresponding character and prints the next 12 characters:
...
      char temp;
      byte who = random(1, 13); // 1 to 12
      temp = findName(who);
      Serial.print(who);
      Serial.print("  ==> ");
      Serial.println(temp);
...

    char findName (byte number) {
      char text[12];
      byte i;
      txt = SD.open("test.txt");
      txt.seek(12 * (number - 1));
      for (i = 0; i < 11; i++) text[i] = txt.read();
      txt.close();
      return text;
    }

But the following, on a LCD, does not. (setCursor, etc. ommited for clarity)
...
char temp;
byte who = random(1, 13); // 1 to 12
temp = findName(who);
lcd.print(who);
lcd.print("  ==> ");
lcd.print(temp);
...

I'm certain the cause is a variable data type mismatch, but I don't know how to solve it. Any help is appreciated.
Thank you.

what is the variable lcd

how do you know that your LCD works? ... run the LCD example sketch in the Arduino IDE to make certain

the LCD does work. The variable is a char array, made by the findName() routine.

lcd type and library?

The variable is a char array ... so, why would a char array have a print method?

Juraj, regular character lcd on i2c bus, library is LiquidCrystal_I2C.h. Jaromanda X, should I convert it to a String? If so, how? Thank you.

In the findName() function, you declare a char array of name text. Internally, text is a pointer to a block of memory 12 bytes in size.
When you return text within the findName() function, you are passing back the pointer to the block of memory. The return type of char is inconsistent with the return command. But probably more problematic is that once findName() ends, the memory set aside for the text array is marked as unused. It is no longer reserved for holding anything and may be reallocated at any time by some other function or operation.
In C/C++, array variables do not refer to the entire array, but to the first element in the array. The fact that your program works with Serial.print() is probably just good luck. lcd.print() may declare some variable or buffer which overwrites what the findName() function had put in those 12 bytes.
There are many approaches to take to resolve this. One way is to declare char arrays in the "highest" scope in which it will be used, and to declare it with the largest size that you could ever see in the operation of your program.
In your case, you can:
...
      char temp[12];
      byte who = random(1, 13); // 1 to 12
      findName(temp, who);
      Serial.print(who);
      Serial.print("  ==> ");
      Serial.println(temp);
...

    void findName (char *text, byte number) {
      byte i;
      txt = SD.open("test.txt");
      txt.seek(12 * (number - 1));
      for (i = 0; i < 11; i++) text[i] = txt.read();
      txt.close();
    }

What this does:

temp is now the char array
findName() takes the pointer to the char array, and the number as arguments
findName() modifies text, which refers to the same block of already-allocated memory as temp, and that block of memory does not go away at the end of findName().
Because findName() is not returning a value, it's return type is void.

Thank you, sir! Learned a lot from your answer and your snippet finally solved the issue. Now I can finally proceed. Thanks again.


text:
Interconnected Arduinos via digital pins and magnets
Before i get too far into the design phase of a project i have in mind, is there a way to connect arduinos in a non-master/slave manner to pass a few different combinations of HIGH/LOW (say 5) or 'information' both ways using digital pins? Perhaps some library i don't know about?
Each of these modules should be identical and be able to connect on any face to any other module. I've included a crude image of what I would like to accomplish.

I've already determined that i can solder to these neodymium magnets without loss of magnetic properties by having the little magnets attached to a stronger magnet during the soldering process. Magnet to magnet connection shows only a very tiny resistance.
If it can't be accomplished, i will need to abandon the project and look for some other means to make my project. Thanks in advance!
~zen

would serial connections work for you?

As long as i was only communicating to one face of the module at a time, but my understanding of the Tx/Rx communications would push out the command to all modules. I only want to send/receive to one module, not all of them at the same time.

you have more than one serial interface - some arduinos have 4 hardware serial interfaces (if I recall) ... then there's SoftwareSerial - to make any pair of pins a "serial" interface

Hmmm... since the rest of the project is only LED lighting with not much programming, I was hoping to use a cheap, low-power (usually 1 serial interface) arduino like the lilypad or similar. I would be creating some 30-40 modules to interact and so the cost of each is thusly multiplied.

Does 'SoftwareSerial' allow multiple Tx/Rx pin sets? That does look promising!

so, your wiring shows each "arduino" using 3 pairs of wires to connect to an adjacent "arduino" - so, how did you envisage these wires would be used for "communication"

I would need them to transmit or receive a value such as 1 for green, 2 for red, 3 for blue or something similar. Decision-making by the arduino would determine if that value was passed to another face. (It's sounding weirder and weirder).

https://arduino.stackexchange.com/questions/43118/simple-multiple-rx-tx-softwareserial shows 4 software serial in use

by the way, I'd wire it differently ... if 1 is output and 2 is input, for example, then you'd need, for example 1 on top of 2 on the left of the board, and 2 on top of 1 on the right ... therefore, output connects to input and vice versa :p

Sweet! That looks like maybe the ticket. Thanks for the pointer!

don't use high speeds though ... but it looks like you won't need to - I believe 9600 would work

Well, dang. I would need each of the modules and their faces to be identical as far as wiring, meaning that any face to be magnetically attached to any face. You're right, i can't connect Tx to Tx if i expect to read anything...

Yes, 9600 would be quick enough...

Hmmm... so maybe i need to use 4 pins for each side to be able to communicate back and forth serially? My mind's boggling a little.

not sure why you'd need 4 - the key is rotational symmetry

Oh, wait. Yes. If i have the Tx pin on the left and the Rx on the right, the two match each other's Rx and Tx. Sorry, i got confused.
Thanks so much for your help and for having to suffer through my confusion!

upvote for a cool idea ..... i would give you another upvote, if i could, for including the information about soldering the magnets

@jsotola - I'll upvote for you :p

there is also an issue with magnet polarity ..... the Rx could me a magnet ... the Tx would be a plain metal contact .... the power pins would have to be pogo pins ... otherwise you would not get rotational symmetry

How would pogo pins help rotational symmetry @jsotola? There is a way to get rotational symmetry with the power though https://photos.google.com/share/AF1QipOuhzEuYNfLFVrEynOVZ015yysy5AGGHLprJbm-S2iH80RgSi98F5woS5yH6yDZmA?key=R01LaERCM3huNExpX1lWeEpmWV9MT3pkOURNRzVR

@JaromandaX, i was unclear in my statement .... i was referring to the vertical layout of the power pins with the data pins on either side

While idea looks cool, you need some kind of "locks" because not "any combination" can work.
Rotate second Arduino in bottom row on 180 degree and you will see that GND/5V reversed relatively to first arduino in second row.
You have to account magnet N-S polarities to allow good lock. Probably you can use magnet polarities to achieve proper orientation.

Non-master/Slave is absolutely the best for lots of applications.
Why bother with Arduinos? There are much better processors available at low cost.
Lots of the STM32 processors allow you to address the serial ports.
For instance, from the reference manual of the popular STM32F103 (Blue pill).Quote.
Address mark detection (WAKE=1)
In this mode, bytes are recognized as addresses if their MSB is a ‘1’ else they are
considered as data. In an address byte, the address of the targeted receiver is put on the 4
LSB. This 4-bit word is compared by the receiver with its own address which is programmed
in the ADD bits in the USART_CR2 register.
The USART enters mute mode when an address character is received which does not
match its programmed address. In this case, the RWU bit is set by hardware. The RXNE
flag is not set for this address byte and no interrupt nor DMA request is issued as the
USART would have entered mute mode. Unquote.
Then use the Embitz compiler, free, use C or C++ if you have to.
C++ cannot compete with C for embedded work, proven over and over comparing code size and operating speed. Why use a processor without decent debugger?
Embitz and STM32 will give you an unbeatable debugger.
The larger STM32 processors also have Canbus, which is the ultimate non-master/slave.
Canbus is not difficult to set up, and you will never look back.
Alternatively, use ESP32 and Canbus.
Regards
Johan Smit