text:
RobotLinking 18B20 pinout and circuit board weirdness
I have a Dallas Semiconductors 18B20 temperature sensor on a RobotLinking board. It's part of the RobotLinking 37 Sensors Kit. The board has a LED to indicate activity. It resembles this:

Here's what's weird. All the guides I can find for the 18B20 say that the pin order is GND, DQ, VDD. That should mean pin 1 goes to GND, pin 2 goes to a GPIO, and pin 3 goes to 3.3V or 5V (this one can take either). Yes, I am looking at the sensor's pins from its bottom.
If I do this, the board's LED is lit solidly. I get 0 degree readings, the same as if no device was connected. (Infinite resistance?)
To make this work, and get valid temperature readings, I have to hook it up this way: sensor GND to the GPIO, sensor DQ to GND, and sensor VDD to 5V or 3.3V. The LED only flashes when the temperature is actually read.
Here's a twist: if you look at the circuit traces on the RobotLinking board, it looks like the paths between the male breadboard connectors and the sensor's pins 2 and 3 are reversed. This means if you think you are connecting to pin 3 via the male connectors, you are in fact connecting to pin 2, and vice versa. The path from pin 1 on the sensor to the male pin 1 where it plugs into the breadboard is straight, so pin 1 probably means pin 1.
When I described the above connections I made, I accounted for this apparent circuit pathing weirdness.
Another twist is in the manual, the sensor is soldered to the middle leads. My sensor is instead on the furthest leads from the pins, like in the attached image.
The manual with this kit didn't explain any of this. I'm at a loss to understand my observations. For a generic sensor kit for n00bs, why would one want the pins on the bottom of the circuit board not correspond to the pinout of the sensor?

Please see http://bigfieldsblog.cloudapp.net/keyes-18b20-temperature-sensor-and-raspberry-pi-2/ for info on how to connect.

From the look of the board, it is designed to support multiple devices. I'd suspect that the three sets of holes give different mappings of the device pins to the board pins. Could it be that the sensor is soldered into the wrong set of holes?
If you have a meter or can see the traces you could look to see if the middle set of holes is wired the way you would expect. If that is a photo of your board, it looks like you have enough length in the leads on the sensor to move it to the middle holes.


text:
Crosspack instead of Arduino IDE, how to include Arduino.h
I quit using the Arduino IDE, instead I am now using Crosspack via the command line on my Mac.
It is working totally fine. I use "make" to compile it, "make flash" to upload it to the Arduino.
This is the Makefile I got right now:
# Name: Makefile
# Author: <insert your name here>
# Copyright: <insert your copyright message here>
# License: <insert your license reference here>

# This is a prototype Makefile. Modify it according to your needs.
# You should at least check the settings for
# DEVICE ....... The AVR device you compile for
# CLOCK ........ Target AVR clock rate in Hertz
# OBJECTS ...... The object files created from your source files. This list is
#                usually the same as the list of source files with suffix ".o".
# PROGRAMMER ... Options to avrdude which define the hardware you use for
#                uploading to the AVR and the interface where this hardware
#                is connected. We recommend that you leave it undefined and
#                add settings like this to your ~/.avrduderc file:
#                   default_programmer = "stk500v2"
#                   default_serial = "avrdoper"
# FUSES ........ Parameters for avrdude to flash the fuses appropriately.

DEVICE     = atmega328p
CLOCK      = 16000000    # 16 MHz for Arduino
PROGRAMMER = #-c stk500v2 -P avrdoper <-- leave this commented since we already specified the default programmer above
FUSES      = -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m # arduino defaults
OBJECTS    = main.o

# ATMega8 fuse bits used above (fuse bits for other devices are different!):
# Example for 8 MHz internal oscillator
# Fuse high byte:
# 0xd9 = 1 1 0 1   1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
#        ^ ^ ^ ^   ^ ^ ^------ BOOTSZ0
#        | | | |   | +-------- BOOTSZ1
#        | | | |   +---------- EESAVE (set to 0 to preserve EEPROM over chip erase)
#        | | | +-------------- CKOPT (clock option, depends on oscillator type)
#        | | +---------------- SPIEN (if set to 1, serial programming is disabled)
#        | +------------------ WDTON (if set to 0, watchdog is always on)
#        +-------------------- RSTDISBL (if set to 0, RESET pin is disabled)
# Fuse low byte:
# 0x24 = 0 0 1 0   0 1 0 0
#        ^ ^ \ /   \--+--/
#        | |  |       +------- CKSEL 3..0 (8M internal RC)
#        | |  +--------------- SUT 1..0 (slowly rising power)
#        | +------------------ BODEN (if 0, brown-out detector is enabled)
#        +-------------------- BODLEVEL (if 0: 4V, if 1: 2.7V)
#
# For computing fuse byte values for other devices and options see
# the fuse bit calculator at http://www.engbedded.com/fusecalc/

# Tune the lines below only if you know what you are doing:

AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)

# symbolic targets:
all:    main.hex

.c.o:
    $(COMPILE) -c $< -o $@

.S.o:
    $(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.

.c.s:
    $(COMPILE) -S $< -o $@

flash:  all
    $(AVRDUDE) -U flash:w:main.hex:i

fuse:
    $(AVRDUDE) $(FUSES)

# Xcode uses the Makefile targets "", "clean" and "install"
install: flash fuse

# if you use a bootloader, change the command below appropriately:
load: all
    bootloadHID main.hex

clean:
    rm -f main.hex main.elf $(OBJECTS)

# file targets:
main.elf: $(OBJECTS)
    $(COMPILE) -o main.elf $(OBJECTS)

main.hex: main.elf
    rm -f main.hex
    avr-objcopy -j .text -j .data -O ihex main.elf main.hex
    avr-size --format=avr --mcu=$(DEVICE) main.elf
# If you have an EEPROM section, you must also create a hex file for the
# EEPROM and add it to the "flash" target.

# Targets for code debugging and analysis:
disasm: main.elf
    avr-objdump -d main.elf

cpp:
    $(COMPILE) -E main.c

I cannot just include "Arduino.h", but I need (want) to use it anyway.
My question is how I would go about doing that? I know where Arduino.h is located, but I cannot just copy that file to the project folder because it needs other files too.
If more info is needed, please let me know.

You need to compile all the core .c, .cpp and .S files into .o files (optionally archiving them into a .a file) then link them with your main program. Your main program will then become a sketch where you use setup() and loop() instead of main() since the main.cpp file in the core has main() in it. Of course you need to include Arduino.h in your source files as well or nothing will work.
The same goes for libraries. You need to compile and link the source code with your code as well as including the header file(s) in your code (and providing the paths to them with -I... directives).

First of all; thank you for your answer. I don't know if you mean exactly the same as I do. Let me explain a little bit: I have a Crosspack project with a main.c(pp) file. In this file I want to build a project. What I want to achieve is that I can do #include "Arduino.h" at the top of the file. If this is the same as you wrote, could you maybe explain a little bit how to do this, or at least point me in the right direction? I don't know how to do this since I have no experience with linking / compilers. Thanks again.

Arduino.h doesn't need to be in you make file.  It needs to be the first line of your source files (your main.c or main.cpp files).
#include in a make file will be treated as a comment, because # means comment.

@JeroenJK Yes, that is what I mean. Using Makefiles can be a bit of a black art. You will need to create targets for .cpp.o and .S.o which call the correct compilation commands for those file types. Then you add all the .o files to your OBJECTS variable. Alternatively create a libcore.a target which uses the archiver avr-ar to create a libcore.a archive which you then link with your main.o with: -L. -lcore. Note that calling your file main.c (which compiles into main.o) is a bad idea since the core contains main.cpp which compiles into main.o as well. Conflict city...

@Matt Ah no, I mean #include at the top of the main.c file. ;) Sorry if that was not clear. @Majenko I will look into how to do what you wrote. I hope I will find out by Googling and trial and error. If not, I'll let you know. And if it succeeds I will of course accept your answer.

@JeroenJK - This is confusing.  Do you mean "How do I include Arduino.h in main.c?"  OR do you mean "My make file can't find Arduino.h, how do I tell it where to find it?"  The exact argument depends on the compiler but it is usually -I, or some compilers accept the content of the INCLUDE environment variaible.

@Matt What I want to achieve is that I can use the Arduino library (Arduino.h). It would be perfect if I could just add #include "Arduino.h" or #include "/Path/To/Arduino.h" to main.c(pp), but unfortunately that doesn't just work because Arduino.h has other imports and those imports got other imports. And if I add #include "/Path/To/Arduino.h", I get this error when running make: In file included from main.c:3:0: /Path/To/Arduino.h:249:26: fatal error: pins_arduino.h: No such file or directory  #include "pins_arduino.h"

@JeroenJK - Cool - Since its gcc use -I (upper case 9th letter of the alphabet not numeric) i.e. COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I "Path/To" -I "Path/To/Some/Other" -I "Some/Where/Else/Entirely"   Does that make sense?  You should also look at Majenko's stuff too, because it looks like even when you get the includes working you will still have issues. :(

You should look at either existing makefile solutions or the arduino-builder system.

I followed your instructions @Matt, but then I had problems with a not found Arduino_pins.h. While I was searching for a solution I found PlatformIO (http://platformio.org/) which I use instead now. Thanks for thinking with me and helping me, but said IDE is going to serve me just fine.

source: Stack Exchange

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

sort: votes


text:
AVR (Arduino Uno) Serial.print and Serial.println only printing 1 or 2 chars
I first used the Arduino IDE but now I'm using PlatformIO which is awesome. But I have some big trouble with Serial.print() and Serial.println(). To show this error I have the following example code:
#include <avr/io.h>
#include <util/delay.h>
#include "Arduino.h"
#include "main.h"

int main(int argc, char const *argv[]) {
  Serial.begin(9600);

  section5ex34();

  return 0;
}

void section5ex34() {
  // Initialization
  DDRC = 0b00000100; // Port C2 as output and the rest (including Port C3) as input. (Port C2 is used for a led that indicates when en bit is being read)

  uint8_t b = 0b00000000;

  // here the code reads bits from PORTC3
  for (int i = 0; i < 8; i++) {
    _delay_ms(1000);
    PORTC |= _BV(PORTC2); // Make Port C2 high (indicates a bit will be read)

    if ((PINC & (0b1 << 3)) != 0) {
      b |= (1 << i);
    }

    _delay_ms(100); // Wait for the user to prepare the next bit (because this is now done by hand)
    PORTC &= ~_BV(PORTC2); // Then make Port C2 low
  }

  Serial.println(b, HEX);
}

When I have the code like this, it prints the right Hexadecimal value corresponding with the 8 read bits.
When I add Serial.println("test"); after the print, it doesn't print that.
Or when I change Serial.println(b, HEX); to Serial.println(b, BIN); it prints 11.
When I replace those 2 prints with Serial.println("Hi test test."); it prints Hi, so it seems like it can only print 2 characters.
When I add Serial.println("Hello world . hello . hi"); four times after Serial.begin(9600);, it prints Hello world . h and nothing more. So here it seems like it can print more than 2 characters, but not all. If I wait a few seconds it adds ello to this, so it says Hello world . hello.
In the initial code, when I replace the if-statement with
if ((PINC & (0b1 << 3)) != 0) {
  b |= (1 << i);
  Serial.println("1");
} else {
  Serial.println("0");
}

and when the input is connected to 5v (so high) it prints a 1 once and nothing else, not even a hexadecimal value when the reading is finished.
This problem drives me crazy.
I have an Arduino Uno and use a baudrate of 9600 , 8,N,1.
I hope someone can help me out with this.

You have two issues here:
The first is that you are using the Arduino core library and failed to
initialize it. This is done automatically if you rely on the core's
supplied main(), i.e. you stick with the setup()/loop() style of
coding. If you write your own main(), you should start by calling
init() to initialize the core.
Edit: In this particular instance, you could get away by just enabling
interrupts with sei(). But I consider it good practice to initialize the
core if you are ever going to use it.
The second issue is the abrupt termination of main:
Serial.print() and println() do not really print to the serial port.
Instead, they put the characters to be printed in the output buffer, and
let an interrupt take care of actually sending them through the UART.
Your program ends with
return 0;

This will stop it. It will stop the whole program, including
interrupt-driven tasks. So you will see whatever characters did make it
to the UART, and nothing more.
If you instead end the program with and endless loop
for (;;) ;

it should work as expected.

Hmm. I was very hopeful when I saw this. It made some sense. But unfortunately it changes nothing ..

@JeroenJK: Indeed, I forgot to tell you about initializing the core. See amended answer.

Yes, sei(); works together with the endless loop. Thanks!

Arduino main() is not so simple as you think. If you use standard Arduino loop() and setup() functions it might be working much better.
But if you're not allowed to use Arduino libraries, you can use this:
src/main.cpp
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>

void section5ex34();
int uart_putchar(char c, FILE *stream);
void uart_init (unsigned long int baud);

int main(void) {
  uart_init(9600U);

  while(1) section5ex34();
  return 0;
}

void section5ex34() {
  // Initialization
  DDRC = 0b00000100; // Port C2 as output and the rest (including Port C3) as input. (Port C2 is used for a led that indicates when en bit is being read)
  PORTC = 0b11111011;

  uint8_t b = 0b00000000;

  // here the code reads bits from PORTC3
  for (int i = 0; i < 8; i++) {
    _delay_ms(100);
    PORTC |= _BV(PORTC2); // Make Port C2 high (indicates a bit will be read)

    if ((PINC & (0b1 << 3)) != 0) {
      b |= (1 << i);
    }

    _delay_ms(100); // Wait for the user to prepare the next bit (because this is now done by hand)
    PORTC &= ~_BV(PORTC2); // Then make Port C2 low
  }
  printf("0x%02X and something loooooooooooong\n",b);
}

int uart_putchar(char c, FILE *stream) {
  if (c == '\n') uart_putchar('\r', stream);
  loop_until_bit_is_set(UCSR0A, UDRE0);
  UDR0 = c;
  return 0;
}

// function to initialize UART
void uart_init (unsigned long int baud) {
    unsigned int baudrate = F_CPU/(baud*16UL)-1;
    UBRR0H = (baudrate>>8);             // shift the register right by 8 bits
    UBRR0L = baudrate;                  // set baud rate
    UCSR0B|= (1<<TXEN0)|(1<<RXEN0);     // enable receiver and transmitter
    UCSR0C|= (1<<UCSZ00)|(1<<UCSZ01);   // 8bit data format

    //// with static FILE variable:
    // static FILE uart0fd;
    // fdev_setup_stream((&uart0fd), uart_putchar, NULL,  _FDEV_SETUP_WRITE);
    // stdout = &uart0fd;

    //// or directly by using dynamically allocated FILE struct:
    stdout = fdevopen(uart_putchar,NULL); // uses malloc/calloc, it might be inconvenient
}

Well, the thing is, this is an exercise for school. I submitted it because the right HEX-value is displayed, so good enough for now, but we are not allowed anymore to use loop and setup. So if there is another way to make it work, it would be nice.

@JeroenJK: You are not allowed to write setup() and loop() and yet you can use Serial? This makes little sense to me: if any functionality of Arduino core is OK, then setup() and loop() are the most standard way to use it. Anything else, including my answer, is just a hack.

@JeroenJK Well, if I use initVariant() build fails on multiple definitions of main. So you have to skip whole arduino.h and use old school registers and so on. Or printf, but it's not so easy...

@EdgarBonet You are totally right here. I think that in a later class they will explain USART to us. But we may use other Arduino.h functionalities throughout the entire course, which is strange, yes. I first used crosspack which couldn't include Arduino.h easily, but that wasn't sufficient ..

@JeroenJK see updated code, it doesn't even need anything from arduino

You're amazing! I will definitely try to use this! Looks good and not even very complicated.

@JeroenJK Only complication was C++. I have to use .c file for FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); because it just can't be compiled in C++.

@KIIV: fdev_setup_stream() (lowercase) is less convenient, but it should compile in C++.

@EdgarBonet You are correct and It looks even better with fdevopen.

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


text:
LEDs interfering with analog sound detection
My project is a sound reactive LED display on an Arduino Nano. There are 112 WS2811s in series connected to 5v, Gnd and D5 via 220ohm resistor.
I have a Keyes style sound detection module that has an analog output. It is connected to 5v and Gnd as well, and to A0.
The code reads the analog signal and then maps it to the brightness of the LEDs, in theory causing the LEDs to pulse.
Unfortunately what's happening is the brighter the LEDs, the higher the readings on the analog pin from the sound module.
Power is 5v 3A connected directly to Gnd and 5V with a 1000mF cap across + & - on the barrel adapter. I did this to allow the LEDs to draw the full 3A from the AC/DC converter (and to avoid having to power this via USB)
My suspicion is that as the LEDs get brighter the voltage to the sound module fluctuates which is throwing off the readings. Is there some merit to this hypothesis or is there another possible explanation?
Short of running two separate power lines (one to the Arduino and the other exclusively to the LEDs) are there any other ways I can regulate the voltage to the sound module regardless of the draw by the LEDs?

Your suspicion sounds very likely.  Temporarily running the Arduino and sound module off another source, with only a common signal ground shared with the LED supply, could be a way to test if that is related to the problem.

adding a schematic and your code would probably help the people trying to help you to give you better help.

Is not the Arduino Uno's barrel adapter connected to the Arduino Uno's linear 5 volt regulator.  That regulator likely needs more than a 0 volt drop across it's input and output.  Does your sound card sit on top of the Arduino leaching power from the Arduino board.  Consider what the sound card would see if it is leaching power after the Arduino Uno's 5 volt regulator.  This is where a schematic of your setup is needed.  Because all we can do otherwise is guess as I have just done above.

It's a Nano, not an Uno, so I've wired up my own adaptor as I mention in the OP.


text:
What do I need to make fluffy toys move and talk?
My kids got many fluffy toys, and I would like to make them move and talk. Something like a small platform with wheels and a speaker and some sensors that I would be able to mount any of the toys on.
I'd like to build something like 2 platforms with motors and sensors that move around, and when encountering obstacles "bark" at them through the speakers, wait random number of seconds, and move in different directions. Then the kids would mount their favorite fluffy dogs/cats/bears/rabbits on top of these platforms and unleash them on each other.
I am very new to DIY; what do I need to buy for such a project?

How new? Have you created something before? (You can use @username-of-the-user in front of your comment to reply to a certain person)

You will need a processor board, motor driver, sensors, and audio amplifier.
Since you are asking on the Arduino forum, it would be natural to consider one of the Arduino boards or derivates - but beware they tend to be rather antiquated compared to alternatives now available.  The plus side of the classic ATmega boards is the wide variety of read-to-go example code available right within the IDE, and the wide supply voltage range (of the bare chips if not the boards) which is more compatible with AA-cell battery packs than competing device's narrower voltage range tends to be.  The one part of the functionality you describe that is a bit of an issue is the audio output - you can get it from an ATmega but it will be poor in quality and you will need to add storage for the "bark" data.  You might almost consider a separate module with an ATtiny and a small SD card for that (ironically the ATtiny while generally less capable has fast PWM better suited to audio).
For motor drivers, especially when using batteries steer clear of the older bipolar L293/L298 type of solutions, as these have very high internal loss which basically means that one cell in your battery pack exists just to generate heat in the driver IC.  A modern FET based driver (the TB6612FNG is quite popular) will be better.
For sensors you probably want one or more of microswitches extended with "whiskers", ultrasonic rangefinders, or short range IR reflectance.
Some dual wheel drive (or "tank steering") RC toys can be worth considering as platforms, but their gearing may be too fast for your purposes, particularly those designed to spin and tumble.  Continuous rotation servos are sometimes mentioned, but it can be hard to get them tuned to not rotate when commanded to stop, and mounting wheels can be tricky.  The small plastic gearboxes work well if you can get matching wheels but are hard themselves to mount.  Access to a 3d printer can be quite useful for creating missing physical components, though a block of wood and a router can make a nice chassis, too.  You can also buy ready made Arduino robot base kits with chassis, gearboxes, and wheels.
For audio output, you can accomplish something with an NPN transistor and base resistor driving a speaker, but best results would be with a small class D driver board as are now widely sold for a few dollars.  They tend to be stereo, but you can feed both sides with the same signal.  If you only wanted "robot beeps" you can drive a piezo disk directly from a processor pin with reasonable loudness at higher frequencies, but the low frequency response is quite poor.

beware they tend to be rather antiquated compared to alternatives now available - easy to use, however.

Don't do it.
When you say to us:

I am very new to DIY; what do I need to buy for such a project?

Then you really aren't ready yet.  Sometimes a virtuoso or savant exists, and they can make incredible DIY projects, but for most people, jumping into such an aggressive project as your first DIY is a recipe for disaster.
I'm not trying to be a smart-ass or negative, but you should get an Arduino and try some PROTOTYPING first.  Again, not trying to be a smart-ass, but if you even have to ask this question, then you really aren't ready yet.
When I work with people on their first project, you should see how excited they get when they can get a light to blink (I still get excited each time too)!
I think you should go for more of a "karate kid" approach: Wax the car, paint the fence, sand the floor.  Once you know the fundamentals, you'll be a ninja before you know it.
I could list a pile of "fundamentals" here, but any other guide would be more comprehensive than my Arduino karate kid list.

funny side-comment there:  I was getting parts to build a "robot", and someone close to me said:  "That's great!  Can you build me one to clean my floors, those brand name ones are expensive".  When I responded: "Well, they spend 80million dollars a year on R&D, so...  pay me 80million, and I'll get you a robot that's a few years behind their design." ...  http://www.bizjournals.com/boston/blog/techflash/2015/09/irobots-smartest-robotic-vacuum-debuts-after-well.html

This answer sucks, but someone needed to say it.


text:
Can I turn a headset with a cord into a bluetooth headset with multiple connections?
I'd like to connect Arduino with bluetooth shield to multiple bluetooth devices (TV & baby monitor), plug a corded headset into the contraption, sprinkle LEDs on top, and do the following:
If there is a signal above certain threshold coming from the baby monitor listen to a mix of TV and baby monitor audio with LEDs blinking; otherwise listen only to TV audio.
Thus the questions:
Can bluetooth connect with multiple devices simultaneously?
What do I need to implement that?

AFAIK bluetooth does not support multiple connections, but I'm not really into BT4. As for BT2.0, you will need two bluetooth audio-enabled masters; connect them to the two sources and then you will have your audio signals and you can mix them or not. Arduino is not really needed if you can configure the modules from e.g. a pc. Anyway I don't know any BT2.0 audio master board. BT4 has profiles, but I don't know if you can take a general purpose BT4 board and get an audio stream from it...


text:
Breadboard for kids
I am interested in teaching young kids how to build arduino projects. I was thinking that using a breadboard may be difficult for them, as the holes are all very close together. It is easy to put the pins in the wrong hole.
Are there any breadboards with larger hole spacings that could make it easier to use for kids?

Honestly, I think kids would be very likely to plug in things wrongly, even if you've got an awfull lot of spacing.
This might be due the fact that they don't really understand why/how to wire stuff.
I would suggest adding some dedicated irreversible connectors with GND&5V to your board. And add the same kind of connector to all the peripherals.
You should also add a current limiting resistor on every Arduino-output pin. From there, you can add some nice "banana-connectors" as signal lines to all the devices you want them to be able to control.

What should they be able to connect or learn?

I'd also suggest that you'd use Ruggeduino's http://www.rugged-circuits.com/ruggeduino/, they're meant to be tolerant to errors.

What age? How secure?

The problem (probably) isn't only because it's too small, wiring can be hard to understand.
I think this might be a solution:

It'll cost you some work. But it will get difficult for them to wire it wrongly.
Also, I believe coloring them, will make the kids understand it much better. This way they would also be less likely to short out pins etc. Saving you some rangers/arduinos.
Be sure that the power-connectors are not reversible. And you should use a separated supply (with overcurrent protection and what not) and tie the GND to the arduino GND. This way you could even use the supply power for heavier devices.
I'm not a 100% sure on the resistors though, they might interfere with some things you want to make/show.
Maybe even add blue color for inputs and yellow for outputs (or whatever the standard is). Or you might even make generic connectors, like on the Lego NXT robots, that's some really easy wiring! http://www.philohome.com/nxtldraw/NXTkitLDview.jpg
Or check out projects like: "LittleBits Arduino".
https://s3.amazonaws.com/lb-spree/spree/products/2003/large/ArduinoDetail4.png?1423167488
And, check http://www.rugged-circuits.com/ruggeduino/ on 10-ways to destroy your arduino. If you take these things into mind, you can make a pretty solid Arduino, so that wrong wiring won't lead to any damaged Arduino's etc.

Breadboards are made to work with components of a standard size - a breadboard with larger hole spacing would not be able to fit standard through-hole chips. I have never seen such an item.
Having said that, I have had a lot of success using alligator clips. You can clip them directly on to wires for LEDs, resistors, capacitors, so long as you make sure they legs/clips don't touch.
Then there are made-for-children systems, snap-together, like http://www.vk3bq.com/2013/08/17/snap-circuits-electronics-kits/ or http://mashable.com/2013/05/21/lightup-magnetic-building-blocks/#t5Kq_yIDpaqr

I have one of those snap-circuit systems right here. However it probably doesn't lend itself to Arduino projects.

or

or
Maybe use something like Littlebits, which uses magnets, but is kind of expensive.

Build your own breadboard!
Literally, a wooden board with a grid of small woodscrews screwed into it, each screw holding down a cup washer.
Connections are made by trapping component leads and wires under the edge of the cup washer before screwing it down.
You need components with reasonably long leads, and it might still be necessary to solder longer wires to the leads in some cases.
I am told that in the olde days, this is how hobbyists used to do it...
Here's a link to an example (I read a copy of this book as a kid):
http://www.mds975.co.uk/Content/george_dobbs_trf_radio.html

Alternatively you could use something like an "Electronics springboard" https://learn.sparkfun.com/tutorials/recreating-classic-electronics-kits.
By pushing the spring sideways, you get some space to push in the wires. When you release the spring, it will put tension on the wire, and trap it.

I just wanted to mention that your example is a very good read, it's an old source (which makes it even better) but is very informative.


text:
Accelerometer Interrupt Meaning - Wakeup Function
I am working with an LSM9DS1 IMU, and now specifically trying to program a wakeup feature into the system. My idea is to set the accelerometer at the lowest possible read rate, then when the accelerometer value exceeds a predefined level, to have the system wake up.
When programming the sensor, there is a register called INT_GEN_CFG_XL that has a "6-Direction detection for interrupt." I was wondering what this means. Does this perhaps calculate the magnitude of acceleration, and see if that goes above a predefined value? I can see the other interrupt generators are for 1-direction of each of the three axes, but I can't interrupt this one.
Here is a link to the device datasheet

The INT_GEN_CFG_XL 6-Direction detection interrupt apparently is aimed at detecting change of direction of travel, rather than an axis-combined acceleration level.
See the LSM303 discussion at Polulu.com.  That page includes a link to App Note CD00290365.pdf for the LIS3DH.  Here is what that app note says, on page 27:

There are two possible configurations for the 6D direction function:

• 6D movement recognition: In this configuration the interrupt is generated when the device moves from a direction (known or unknown) to a different known direction. ...
    •  6D position recognition: In this configuration the interrupt is generated when the device is stable in a known direction. ...

With the LSM9DS1 that you are using, you can leave OR enabled, set separate X,Y,Z threshholds in INT_GEN_THS_X_XL, INT_GEN_THS_Y_XL, INT_GEN_THS_Z_XL, and set the “Enable interrupt generation on accelerometer's X axis high event” (sim. for Y and Z) bits in the INT_GEN_CFG_XL register.


text:
Shift Register Not Working
I am trying to learn how to use a shift register to control 8 LEDs but for some reason my shift register is misbehaving and none of the LEDs are lighting up. I imagine that it's a problem with my wiring? I have replicated the circuit on 123D Circuits.

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  // count from 0 to 255 and display the number
  // on the LEDs
  for (int numberToDisplay = 0; numberToDisplay < 256; numberToDisplay++) {
    // take the latchPin low so
    // the LEDs don't change while you're sending in bits:
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay);

    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:
    delay(500);
  }
}

I don't see anything wrong with the image or the code. Try jiggeling all the connections. I've sometimes had wires not connecting properly in a breadboard.

Rejiggling the pins seemed to do it,

It's always the stupidest thing that takes the most time to debug (-:  Glad you got it working.

From the Arduino website:

shiftOut()
Description
Shifts out a byte of data one bit at a time. [...]
Note: if you're interfacing with a device that's clocked by rising
  edges, you'll need to make sure that the clock pin is low before the
  call to shiftOut(), e.g. with a call to digitalWrite(clockPin, LOW).

You need to pull clockPin low before each shiftOut() call, as the documentation says.
Also, you have misunderstood the behaviour of the latchPin. This can be high or low at any time; it's the change from low to high that latches the data into the output cells.

digitalWrite(latchPin, LOW); shiftOut(...); digitalWrite(latchPin, HIGH);. Isn't he doing that already?

No, clockPin should be low, according to the blurb.

Aha, clockPin; not latchPin. Missed that after you edited your answer.


text:
Gnd pins at the power pin strip VS Gnd pin at the IO pin strip
I noticed there are two Gnd pins at the lower pin strip, and another on the upper strip.
Is there a difference in their purpose?

In short, all the UNO ground pins are the same.
They are just there to make your life easier. At the end of the day, GND is GND. There is no technichal difference. Just note that is is sometimes better if you share the 3 GND ports. Overloading a port might damage it. Check the datasheet for current limitations of the pins.

EDIT
The pins (literal pins of the IC) themselves are also different on the ATmega IC.

Your last statement is confusing. The ATmega has several ground pins, but they are all connected together on the PCB, just like all the GND header pins are connected together. At the end, all grounds are a single electrical node. Also, I doubt you can overload a GND header pin : you will very likely burn the regulator or the USB fuse before.

@EdgarBonet, well I prefer to specify it!

You linked to the wrong datasheet. The question is about the GND pins of the headers on the board, not about the pins of the microcontroller. This makes your answer misleading, as a naive reader may assume that the current sinked by the GND header pins goes into the GND MCU pins.

So, @EdgarBonet, considering I was indeed referring to the headers on the board, what's the truth here?

@Dor: As already stated, all the GND pins are connected together, so they are equivalent. My previous comment is just pointing out that the linked datasheet is irrelevant to your question.


text:
SoftwareSerial library
How do I rectify this error?
Clearly it says there is some error in the library, so how do I correct it?
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:1: error: expected unqualified-id before 'if'

Sounds like you have some corruption in the file. Try reinstalling.

you mean retry installing the library ? @Majenko

Or the whole IDE since it comes with the IDE

The other possibility is a syntax error in your sketch? I'm not sure how the IDE builds, but if it doesn't compile each file separately the error may come from another place and the most likely place to look is in your code. Before you reinstall take a look at the file that is generating the error and see if you notice something wrong. Just for the practice.

Which version of the IDE are you using? Please post all the output from the compiler. Please edit your post to do this and format the output using the code formatting markdown (four leading spaces). For help see Markdown help. You should be able to do this by selecting the code and pressing Ctrl+K to have your browser do this for you.

I'm not sure how the IDE builds - see How the IDE organizes things.

Show us the first handful (10 or so) of lines of the file C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp

there is only this 1 error ---
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:1: error: expected unqualified-id before 'if'

if (_inverse_logic ? rx_pin_read() : !rx_pin_read())
{
// Disable further interrupts during reception, this prevents
// triggering another interrupt directly after we return, which can
// cause problems at higher baudrates.
setRxIntMsk(false);
// Wait approximately 1/2 of a bit width to "center" the sample
tunedDelay(_rx_delay_centering);
DebugPulse(_DEBUG_PIN2, 1);

for (uint8_t i=8; i > 0; --i)
{
  tunedDelay(_rx_delay_intrabit);
  d >>= 1;
  DebugPulse(_DEBUG_PIN2, 1);
  if (rx_pin_read())
    d |= 0x80;
}

First few lines of my library

Then there is a huge chunk of the file missing - 220 lines to be precise (that is line 221 you have there). A reinstall of the IDE should have fixed it. Did you do it?

Yeah it worked! Done compiling successfully... Can you please explain how downloading a new IDE solves the problem ? @Majenko

The file was corrupt. You replaced it with a new copy. How it got corrupted is anyone's guess.

As you haven't shown the code that produces the error when it's compiled, I can't say for sure what the problem is.  However, here are links to three instances of the same error:
• error: expected unqualified-id before 'if' on stackoverflow
• Arduino: error: expected unqualified-id before 'if' (using ping sensor), also on stackoverflow
• error: expected unqualified-id before 'if' on arduino.cc.
In each case, the problem was due to executable code (as opposed to declarations) appearing outside of a function.  You may have put some executable statements outside of loop() or setup(), etc.

Still problems related to my library...i reinstalled my IDE and in the new one SoftwareSerial.h doesnot exist..what should i do?

You may need to separately download and install SoftwareSerial.  You can get SoftwareSerial.cpp and .h from github and follow the directions at arduino.cc, Installing Additional Arduino Libraries.  Note, arduino library downloads from github normally are zip files; I didn't see a zip file in this case, so adapt the instructions accordingly.

Your copy of the SoftwareSerial library has become corrupted. Why is anyone's guess: maybe your hard drive is dying?
Replacing the file with a good copy will solve the problem. The simplest way to do that is to reinstall the IDE.


text:
Sensors to use in Pets
I want to track my pets using some sensors (their location in space) but I could only find radio sensors. These radio sensors are big and cumbersome for my dogs to carry around.
Is there some sensor that I can use in order to locate them in space? I want to use my arduino board to capture the data.

Something like https://www.adafruit.com/products/746?

Is it inside or outside? You could place sensors on the ground around the dog to track where he is. Or are you looking for something like indeed a GPS 'sensor'? Do you want the data to be stored on the arduino/sd or transmitted directly? Add these things to your question, tracking items/pets can be done in a lot of ways.

@fuaze want to track them inside an apartment. Got count on walls and obstacles.

@Gerben, YES. that seems to solve it.

@Gerben, actually I would need something less fancy, but in the same vein. I'm interested only in raw data (distance from a certain point in 2D)

What kind of range are you talking about? I doubt you'll be able to do it cheaper than with a GPS unit though.

@Gerben talking about 100m^2

A cool project would be to use a camera to track the pet. But you'll need to hook it up to the PC to process the data and then send it to arduino, you wouldn't even need a pet, and probably not even an arduino.
But GPS is probably the best, though I'm not sure how accurate they are, inside an appartment.
Maybe even an accelerometer to check his speed/heading is enough? You should be able to guess where he is/goign from the data?
Or put ping sensors around the room, that measure the distance from the wall to said pet.List the possibilities (pros and cons) and choose the best one I guess.

@FuaZe accelerometer is a great idea. do you have some reference? I would need something easily rechargeable, for the pets to carry around

You are aware that an accelerometer does not provide a location by itself? And well, I've actually never used an accelerometer, you should check some tutorials I think.


text:
What is the actual range of Xbee RP-SMA antenna?
I'm building a Model rocket, and i will use xbee series 1 pro, so i think RP-SMA antenna would be the best to use because i will put the xbee into the rocket. So does anyone know what is the range of the xbee with this antenna?
Can it reach 1000 feet?

At https://www.sparkfun.com/pages/xbee_guide there is a table containing the ranges of the different models. I think your model says 1 Mile. Though these rating are probably very optimistic.


text:
Blutooth shield LED control
I am trying to control a led ON/OFF using Arduino UNO and a Bluetooth shield
I have this

which is based on hc-05. The tutorials I found about hc-05 are not working for me. I have the hc-05 embedded in the shield and I did not  find any tutorials  for this shield.
Here is my code (it is working when I use the USB serial ctrl + shift + m).
void setup () {
pinMode( 13, OUTPUT );
digitalWrite(13,LOW);

Serial.begin( 9600 );
Serial.println( "Ready" );
}

void loop() {
if ( Serial.available() > 0) {
    int inByte = Serial.read();

    switch ( inByte ) {

        case '0':
            digitalWrite( 13, LOW );
        break;

        case '1':
            digitalWrite( 13, HIGH );
        break;

    }
 }
}

I connected my android phone to the shield successfully using blurterm2. When I send 1 or 0 nothing happens. What am I missing?

If I understand your board the LED is on output 4. You should try to control it with simple on/off "hello world" logic before adding the serial input. If you connect the green lead to Vin does tshe LED light? If not, it is reversed or dead.

i connected the led to pin 13, it is blinking when i control it from usb serail http://s10.postimg.org/izvhgzluh/20150710_173523.jpg

Have you tried the turning just running a simple program to check if the led still works, such as
void setup () {
pinMode( 13, OUTPUT );
}
void loop() {
 digitalWrite( 13, HIGH );
 delay(1000);
 digitalWrite(13,LOW);
 delay(1000);
}

Yes the code you gave me is blinking the led

From your code I cannot see anything that actually initializes the shield and tells it what pins to use and how to use them. This github (https://github.com/jdunmire/HC05) has a library for the HC-05 shield and it appears to have instructions for setting baud rate and all of that good stuff.
Also, their read-me mentions that, if properly configured, you should see traffic to and from the shield in your serial monitor. Are you seeing any traffic?
NOTE: This tutorial (http://www.instructables.com/id/Arduino-AND-Bluetooth-HC-05-Connecting-easily/?ALLSTEPS) seems to have step by step instructions to do exactly what you are asking.

Here is your problem:
if ( Serial.available() > 0) {
int inByte = Serial.read();

You are not listening to the bluetooth-hardware, but to the build-in serial port of the Arduino.
I had a look at the url you can see on the board, but i could not find any example code. If you are lucky your bluetooth should might be compatible with the freetronics bluetooth shield, which has some example code on the bottom of this page to get you started:
#include <SoftwareSerial.h>

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

int thisByte = 33;

void setup() {
  bt.begin(9600);
  bt.println("ASCII Table ~ Character Map");
}

void loop() {
  bt.write(thisByte);

  bt.print(", dec: ");
  bt.print(thisByte);
  bt.print(", hex: ");
  bt.print(thisByte, HEX);
  bt.print(", oct: ");
  bt.print(thisByte, OCT);
  bt.print(", bin: ");
  bt.println(thisByte, BIN);

  if(thisByte == 126) {
    thisByte = 32;
  }
  thisByte++;
}

This only sends, and "bt" is your bluetooth hardware here. It behaves like the Serial hardware for the most part.
Note: based on your picture, you might have to change the RX/TX pins on your board to 2,3 - currently they are set to 2,4.

You should use a different baud rate if your hc-05 does not work with the code. The default is 9600. Use this baud rate and if not, try to find out the baud rate using AT commands, you will get several tutorials on this.


text:
Wi-Fi Module communication?
I bought a Arduino Wi-Fi Module it does not have any manual or catalog
my project is to turn on/off a motor wireless

 it is working grate for the serial/usb cable but i couldn't make it work for wireless/wifi
after some walking around i found that my wifi module is making a wifi network called "HL-link_A49D"
with password from 1-8 and after network scanning i found that the module ip is 192.168.16.254/ username and pass are admin/admin
here is what i found

my question is how could i connect to the wifi module and send commands to it ?

Good detective work so far!
In the admin page you found one can see the name of the module: HLK-RM04. Googling on that I found the manufacturer/seller page.
A PDF with some information can be found here.
Also one link with somebody's experience with the module.
For other projects you might want to try as well the ESP8266 - very cheap and seems a lot of people have experience with it, so you might find more information on the net.


text:
Signal noise on R/C car channel output
Doing a little project for work and trying to get the Arduino hooked to an RC car to read the throttle channel output and send that via bluetooth to a nearby laptop which will output an animation based on that speed.
Initial test worked very well and signals from my airplane Tx were solid with very little variance. Once the proof of concept worked, we went ahead and purchased a Traxxas car. I have a wire going from pin 5 to the signal wire on the Rx. With the serial monitor up and arduino powered via my usb cable, the #s jump from the 1400 (where its supposed to be) to 6000 and sometimes 11000.  Even more interesting, is when I engaged the throttle via the transmitter, values went down to 30-50...?? I removed the Rx from the car and powered it via the 5v on arduino...#s are solid.
So, it appears the battery or esc is giving a lot of interference. Do I need to use a different kind of wire? If so, what kind of wire? Or ground it somehow?

are you grounded correctly? what sort of filtering (if any) are you doing?

Yes , battery can provide some interference...

New to Arduino, so not sure what you mean by grounded correctly. I currently only have the one wire going from the board the the signal wire on the Rx. Do I need to run another wire from GND on board to GND on Rx?

Old post, but here was my solution. Had to pickup some shielded cable. Pics below should clearly explain how everything was wired up.


text:
Connecting Arduino To mains
How would iconnect my Arduino Mega to house Mains, without buying a transformer, and having to make a whole setup for that.  Can i just use a regular phone adapter?  Or is 1 Amp too large (or 2 Amps).

Amps tell you how much current you can draw from the power supply, or "how much it can do".
You can hook up 3Amps power supply to a device that draws 1Amp and it will work ok, still having 2 amps of reserve.
You must pay attention to power supply voltage and keep it in specified range.
Arduino Mega has recommended input voltage of 7-12V, so you must deliver at least 7V. There are plenty of cheap wall power supplies with voltage regulation from 1.5V to 12V.
How much current it will draw depends on your application, but I doubt that you can suck more than 0,5-1A in a typical application.

Okay, so that is what I thought, because I have read this before that it depends what the device wants.  But then i also saw someone say that it will hurt the Arduino.  But thanks for the clarification!

Note that the ~7v minimum concerns the power connector.  An Arduino can also be powered with an already regulated 5v via the USB connector.  If a phone "charger" (really USB power supply) is doing what it is supposed to, and properly isolated, that would work.  But some things sold as phone charges reportedly do not do what they are supposed to or lack sufficient isolation to be safe.


text:
How to connect MCP4141 digipot and a data logger shield to the same Arduino board
The main problem here is that they both need to communicate via the Arduino's SPI bus, and I know that each of the two devices will need its own CS pin (The data logger is hard wired to 10, so the digital potentiometer will need a different one)
This would be fine, except that the digital potentiometer has one pin for both SPI and SDO.
I read that to connect this to the Arduino, the shared pin on the digipot needs to be connected to the MISI pin on the Arduino (pin 12) and then to bridge the MISO pin to the MOSI pin with a resistor.
Would anyone be able to tell if this will work. I do not want to try connecting the two devices like this just in case it breaks something in the board.
Thanks

I have done the same thing in the past for a DS1302 RTC that uses the same communication system.  Yes, it works.  Will it interfere with the other communication though? Quite possibly.  It works fine for half duplex communication, but could cause interference with something else on the bus that is full duplex.
If in doubt, and you're not worried about high speed or high efficiency (you're not changing the potentiometer's value often) then use three other pins and bit-bang your own half duplex serial interface - it's not hard.

Thanks, I'll give it a go, and if it doesn't work, i'll try bit banging with three other pins. speed isn't a problem. I'll let you know how things go


text:
Arduino IDE, Underlying Code and Libraries
I'm trying to better understand what is going on behind the Arduino IDE. First off I am no expert in C or writing firmware to boards but do have experience in real development.
I see currently the Arduino IDE is one big vast library we first select our board.
What I don't understand is where are our header files? The source files for the board you select?
Not only that we use a number of functions already detected within the IDE where are these located also is any of this code editable?
I had a look through the Arduino directory and most of this stuff looks like its Java I was hoping for C files. Thanks for any links, help or info anyone can give.

In IDE, click File, Preference.  In 4th line ("Show verbose output during:"), check the "Compilation" box.  On the next compile you'll see a lot of the paths.   Then turn it back off.

Just check the source code. Specifically look at Arduino.h, main.cpp and wiring*.
These files should also be present in the Arduino application folder somewhere, but you'll have to go through quite a few subfolders to find them.
The different boards have different .h file that will specify the pin-numbers and other chip specific data.
The "auto detect" functionality is done by keywords.txt files. At least for libraries. That way if you install a new library with keywords.txt file, the library functions-names are recognized.
The processes of taking all these files, and the users code, and compile it all whole story on it's own.


text:
is it possible to convert a 328 design to use a 32U4?
I have several projects that use simple 328 based arduinos that I built myself, similar to the familiar "arduino on a breadboard" projects that I'm sure everybody has seen. They have just the bare minimum, no ftdi, etc.
Is it possible to drop in the 32U4 without modifying the circuits, or would I have to do a bunch of work to the circuits to get them to work with the 32U4 chips, and if so what are the general steps?

Just had a quick look at the datasheets, and the main difference I see physically is the 32u4 is 44 pin package and the 328 is either 32 or 28 pin.
Also the 32U4 seems to have a lot more peripherals.
So based on that yes you will have to modify your circuit. Atmel are fairly consistant with ports and what their alternate functions are though.
eg SPI on portB, uart on portD
But you are just going to have to compare the pinouts on the datasheets see how they differ. And adjust pin connections accordingly.
Datasheets are easy to find. Good Luck!


text:
Share data between the two processors of the Arduino Yun
The linux processor runs a Python script from which I would like to send an array of integers to the Yun microprocessor. How can I do that?
And then, how can I retrieve and then use this array in my Arduino Sketch?

Given that my Python script printed the following
[10, 20, 30, 40]

This is the sketch I used to retrieve the array
#include <Bridge.h>
#include <Process.h>

void setup()
{
   Bridge.begin();
   Serial.begin(19200);
}

void loop()
{
   Process proc;
   int i=0;
   size_t dim = 1;
   int* array = (int*)malloc(dim);

   Serial.print("Running process...");
   Serial.println("done!");
   proc.runShellCommand("python /script.py");

   while (proc.available()){
     if((char)proc.read() != ']'){
        array[i] = proc.parseInt();
        dim++;
        array = (int*)realloc(array,dim);
        Serial.println(array[i]);
        i++;
      }
      else
        break;
   }

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

The Yun makes communication between the microprocessor and the Linux side easy.  On the Arduino side, use the Bridge library in your "processing script" to read (or write) Bridge values set by the python program running on the Linux side.  From the linux side, the bridge looks like a web address and you set values by addressing a URL with a get or put url http request. You can also manipulate these values from another computer on the network as well if you like.
I have some Arduino Yun dataloggers that use the Linux side to communicate via wifi with an ftp server that serves several Yun dataloggers. The arduino script reads the sensors, creates the records, etc. You can also have the microprocessor side write files that are used by the linux side of the Yun.
I find the Yun's combination of Linux and the regular arduino in one package makes the overall system easier to program and to interface with the rest of the web.

Serial1 on the Arduino side is connected to a serial console on the Linux side.
So, you could use calls on the Arduino to run your Python script on the Linux side and then listen to the output of the script to come back though the serial port and part it.
Here is an example of a project where I used a Yun like this. The Arduino side interfaces to some temperature sensors, and then types commands into the Linux side over the serial connection to run CURL and report data to internet URLs.
http://wp.josh.com/2014/06/05/tempurature-logging-to-a-google-spreadsheet-with-an-arduino-yun/#more-1797
I am going to warn you that this is very ugly. Then Yun itself is quite ugly too. There were so many problems that I ended up giving up on this platform completely.


text:
Read int from Serial
with the following sketch I should be able to read and store what is entered in the Serial monitor
void setup() {
  Serial.begin(115200);
  while(!Serial);
}

void loop() {

  Serial.println("Enter Zone Number: ");
  while(!Serial.available()){
  }
   int zone = Serial.parseInt();
   Serial.println(zone);

}

if I enter "1" I would except this:
Enter Zone Number:
1

but unfortunately I have this:
Enter Zone Number:
1
Enter Zone Number:
0

What am I missing?

.parseInt() reads incoming text up until either it times out or until it reads something that isn't a number.
You are sending a number, and most likely a line-ending. If that line-ending is a simple \n then that will trigger the "end of number" and will be discarded and the number returned.  However, if you are sending \r\n (i.e., CRLF) then you effectively have two line endings there:
1\r\n

Parsed as:
1\r => return 1
\n => return 0

Relying on the (poorly written) Arduino stream parsing routines is not good. Not only are they blocking, but often they just don't work right.
Instead you should be reading the serial properly, taking account of line endings, and then converting the string you have read into a number using the likes of atoi().
Tutorial on reading serial:

https://hackingmajenkoblog.wordpress.com/2016/02/01/reading-serial-on-the-arduino/

Here is a really nice and simple solution (More robust also concerning line breaks): https://stackoverflow.com/a/20962137/2714285
int x;
String str;

void loop() {
    if (Serial.available() > 0) {
        x = Serial.parseInt();
        str = Serial.readStringUntil('\n');
    }
}

it is a too heavy solution to get rid of one \n

If your goal is speed I understand your point but I first tried the solution of the article of  Majenko and it just didn't work on linux (the \n char was just not recognized). And it's, btw, much more heavy in terms of readability / code / docs to maintain if your work in a team

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


text:
DS3231 DTCXO and GPS
I am experimenting with this idea: keep a DTCXO in sync with some frequency standard. I have all the parts I can afford, but I cannot figure out a way to do it.
Parts I have: Arduino Leonardo, a u-blox 6010 based GPS module with PPS output, and a proto shield with DS3231 DTCXO chip mounted.
My big idea is that DS3231 have aging registers that would affect the clock frequency. By keep counting the 8192Hz square wave output of DS3231 and keep it in sync with the 1Hz signal from the GPS module, I can keep the DTCXO in sync with a reference clock. This, in turn, would give me a relatively good 32768Hz clock reference that I can build a frequency counter on.
Both 8192Hz and PPS are interrupt driven.
Anyone have an idea on how to do it? Does this spell Artificial Intelligence on AVR, as my instructor suggests?

Perhaps use the 8192Hz signal as a timer clock signal?

@IgnacioVazquez-Abrams Not gonna work so well I think. The Leonardo is counting this 8192Hz and checking it against the 1Hz PPS from the GPS module, decrease the clock frequency if there is too many counts and increase it if there is too few.

And why can't you use the 1Hz signal as an interrupt to count the timer pulses?

@IgnacioVazquez-Abrams I am doing this, clocking the microcontroller at 16MHz, one interrupt counting the 8192Hz and another interrupt sensing the 1PPS.

Eh. Probably easier to use a timer.

Ehh... I am essentially calibrating the DTCXO so timer isn't really a good idea...

Why? All it's doing is counting the pulses for you.

By counting the pulses I change the "aging register" of the DTCXO and try to discipline it with the GPS.

Yes, and instead of having to create a separate interrupt for the 8192Hz signal, you let the timer count it for you.

So your suggestion is to feed the 8192Hz to a counter input, interrupt on the PPS, let the counter handle the 8192Hz and react based on the counter value (and reset it) when the PPS interrupt fires?

Yes. There may be a small amount of jitter to start of course, but a clever algorithm can handle that.

Well I would not start using the counter before GPS gets a fix, and GPS fixing can take minutes. So not that much a problem actually. Please post this as an answer so I cna accept it.

This is an interesting project. The Arduino Leonardo has enough I/O pins and interrupt capabilities to handle this task. By monitoring and adjusting frequencies in real-time, it can be considered a simple adaptive control system, but it does not involve complex artificial intelligence algorithms.

I know this question is old, but adding to it in case others are interested in the same question: I've been testing the DS3231 sync’d the leading edge of a GPS time-pulse and the aging register in the DS3231 is tuned to reduce drift. I’ve brought together three different utility sketches so that the process can be validated without the typical bench-top tools:
https://thecavepearlproject.org/2024/10/22/setting-accurate-rtc-time-with-a-gps-the-ds3231-aging-offset-to-reduce-drift/
Bottom line: Most -SN RTC's have 1ppm drift unless you tune the age register so that's definitely worth doing. Don't use one of the -M mems chip variants for projects that need short term precision as they have 2ppm jitter.

Hope you get this.  Trimming the aging compensation in the DS3231 is not worth the trouble.  You won't significantly improve the temperature accuracy or aging drift due to the crystal used, etc.
On the other hand, 10MHz Double Oven Reference Oscillators are available for under $50 on EBAY.  These are good to 2x10-12 short-term, or about 1x10-6 yearly drift.  For timekeeping purposes, you can ignore the short-term drift, could not measure it anyway :).  On the other hand, the aging drift will be large because you do not know how long these have been in service.  The good news is that aging drift is very stable if temperature is kept constant, the reason for the double ovens. So once you determine how far off frequency the OCXO is, you just periodically add a count to your divider during one period to keep it synched to the GPS signal.  For more info write mhuss103athotmaildotcom

Those are EXPENSIVE and all I have is cheap components: $10 Arduino clone, $8 GPS module, $0.5 NOS DS3231 chip,


text:
how to calculate correct resistor value to use with LEDs Potentiometer and other devices?
I have been following http://arduino.cc/en/Tutorial/Fade to fade and LED. But I don't know why they are using a 220 Ohm resistor.
According to Ohms law if LED is of 2.2 V and it runs on 0.025Amps and is connected to 5V pin of Arduino then the resistor should be of 120 Ohms but why we are using 120 Ohm resistor ?
One more thing. How can I collect value of resistor to be used with different output and input devices ?
Thanks in advance

Related: "Does the square-wave nature of PWM dictate how much resistance you need?" answer

If the LED has a forward voltage of 2.2V and is rated for 25 mA, then you're correct that a 120 Ohm resistor should be OK. It's theoretically calculated as the voltage across the resistor divided by the desired current in the LED. (In practice, it's often more complicated than that, but that's a good starting point.)
It's important to note that not all LEDs are rated the same though. I imagine the 220 Ohm resistor was selected for the tutorial to provide a bit of a safety margin, as that should be OK for most LEDs a hobbyist is likely to use. If you don't have access to the full specifications then it's probably better to under-drive it. The LED might be a little dim, but at least it's unlikely to be destroyed.
Here's a useful online tool for calculating theoretical resistor values for one or more LEDs:

http://led.linear1.org/led.wiz

For other devices, the resistor values required can depend on a huge number of factors. The best thing to do is to check the datasheets. For some components (such as ICs), you'll often find an "Applications" section towards the back which shows various ways you might want to connect the item to an external circuit. If things like capacitors and resistors are required, it will often explain how to select the correct ones for a given situation.

Thanks a lot man, I am starting arduino programming as hobbyist but that's not my ultimate aim. I guess i need to revise my physics lessons once again. and should start learning how to use data sheet.


text:
Send AT commands programatically to ESP8266 without Arduino
Let me explain my question in more details. I want to use ESP8266-01 as standalone micro-controller for my project. I don't want to use Arduino or any other board with that.
Using Arduino i can use two of the pins as software serial and can send different AT commands to ESP module to ESP's Tx and Rx pins, but now what I want is to eliminate the need to Arduino.
What I want to do is to to program ESP itself to toggle mode from AP mode to Host mode on press of a push button. for that I has to send AT commands to ESP from the code while i will write to the ESP itself. Is there any way to achieve the same.
I tried searching a lot but what I found everywhere is how to send AT commands from Arduino.
Thanks in advance.

You don't use AT commands. You install the esp8266 boards package and program the esp8266 as if it were an Arduino. That means learning the esp8266 WiFi API which has plenty of examples included.

https://github.com/esp8266/Arduino/

This is what I am trying to do, I connected ESP using FTDI, and now I am programming it using Arduino IDE. Is there any provision such as software serial or anything like that ?

For doing what?


text:
RSSI stop sketch on a gboard (atmega)
I have this function in my code and works fine (it returns a valid value, I put this value into a int variable outside function), but when end the function (or continue the code), my sketch stop/die...
///FUNCION PARA RSSI XBEE///
byte rss() {  ///PARA RSSI
union {byte B; char C;} atCmd[3];
AtCommandRequest atCmdReq;
AtCommandResponse atResp;
byte respLen, *resp, dBm;
strcpy(&atCmd[0].C, "DB");
atCmdReq = AtCommandRequest(&atCmd[0].B);
atResp = AtCommandResponse();
xbee.send(atCmdReq);
if (xbee.readPacket(5000)) {
   if (xbee.getResponse().getApiId() == AT_COMMAND_RESPONSE) {
       xbee.getResponse().getAtCommandResponse(atResp);
       if (atResp.isOk()) {
           respLen = atResp.getValueLength();
           if (respLen == 1) {
               resp = atResp.getValue();
               dBm = resp[0];
                  return dBm;
           }
           else {
             //  Serial.println("Unexpected response");
           }
       }
       else {
         //  Serial.println("ERROR");
       }
   }
   else {
     //  Serial.println("Unknown response");
   }
}
else {
 //  Serial.println("No response");
}
}///fin rss()

¿Any tips?

Your function is only returning a value when everything works OK. If an error occurs, the problem is reported to serial but it doesn't return anything. It seems likely that this could cause stack corruption which could make the program stop.
A simple solution would be to put return 0; (or some other number) just before the end of the function.

Thank you Peter, I try to end the function with "return 0", but doesn't work...

I need to erase the first "return" ?

@xavi No, you still need that return statement where it is. The additional return statement is to handle situations where the first one doesn't get executed. In C++, functions must execute a return statement unless their return type is void.

Wow! Nice explication! I try to make the function void, but still not working... thanks for four time! ...I can´t vote up (I have insuficient range), but +10 for you!

Yeah! Now I can vote up for you! Thanks, you rule!


text:
Individually control ~200 LEDs
I am planning to build a LED polar clock, so it will need about 181 LEDs (12 Month, 31 Day, 7 Day-of-week, 12 Hour, 60 Minute, 59 Second) and I need to control each one individually. I will be buying everything from scratch so I ask for help on:

Which arduino to use
How to make it keep time
How to control the LEDs

The LEDs need to stay on once they're lit, e.g. at 5 o'clock, the 1-5 LEDs would be on.
This is why I don't know that multiplexing or charlieplexing will work, as I read that it is better if the LEDs wont be remaining on/only a few are on. The most that could be on is 179 (Friday, December 31, 11:59:59 [Won't happen until 2021]).
Thanks in advance.

http://arduino.stackexchange.com/a/5042/3866

Instead of a multiplexer you can use a "shift register"; the difference is that it keep the last state of the pin, while the multiplexer goes unconnected (and this is because you need at least 30fps, and even so you'll get low light as you are PWMing the leds).
This is why shift register are also called "led driver".
Official tutorial can be found here http://arduino.cc/en/Tutorial/LEDDriver

If the cost is allowed to be moderately higher, your simplest solution could be to use WS2012b individually-addressable LEDs. Since longer chains sometimes have timing problems with the serial communication, I’d probably split them into three groups, attached to three digital pins.
Multiplexing probably requires some flip-flops or other buffers; else, the LEDs may not be bright enough.

Came here to say that. For a clock, the color-selecting ability of a chain of RGB LEDs connected with WS2801s or something would be perfect. It only requires one wire, and the programming is very simple.

Check out the TLC5916. It has two advantages over the HC595:

it can sink a lot of current
it only needs one resistor

I use it with seven-segment displays. Basically, you tell it "I'm about to send a command." Then you send it, say, "01010101" to turn on every other light. Then you say "okay, make that live." You can chain them together.
Many use the MAX7219 but for me the cost is a drawback.
I might come back and edit this post later to add a Github link to demonstrate...

I use the TLC59116 lots - I2C version with PWM.

Multiplexing will work fine in this case (Charlieplexing isn't practical here).
You create an array of leds, and light up only one row at a time. If you rotate through all the rows at more than 50 times a second your eyes won't notice it.
In the case of 181 leds, you'd need and array of e.g. 13x14. This will mean you need a minimum of 27 IO-pins. More than the regular Arduinos provide.
So you probably need some additional ICs. You could use simple shift registers, or dedicated led-matrix drivers like the max7219 or some other IC. The Max7219 is probably the easiest, as you don't have to do the multiplexing yourself. The can light upto 64 leds (8x8), so you'd need 3 of them.
PS I get a different number though; 12 (month) + 31 (day) + 7 (weekday) + 23 (hours) + 59 (min) + 59 (sec)= 191


text:
Testing network of SIM900A
Do I have to connect RX and TX of SIM900A with any pins (say TX, RX of Arduino) for network purpose? Shouldn't the network status LED blink slower after connecting the power sources with SIM900A?

Your question is somewhat unclear. You will need to connect the SIM900A to the Arduino, yes,  if you wish the Arduino to communicate with it. Are you referring to the network status LED of the SIM900A?  Assuming that the SIM900A was previously unpowered, then, upon applying power, how can the LED blink slower? Surely, if the SIM900A is unpowered then the LED won't blink at all? I must be missing something.  See TUTORIAL TO INTERFACE GSM SIM900A WITH ARDUINO

I mean I have powered the device by using 12V 2A adapter. After connecting the power the Network LED will blink fast for a few moment. Then after establishing network connection it will blink slowly. Am I right?

Yeah, that is correct. See my answer below. You might want to edit and reword your question using the explanation in your comment :-)

Do I need to connect the TX and RX of GSM anywhere only for slowly blinking the Network LED i.e to confirm that the network has established?

To answer your questions in turn:

It is not necessary to connect to the Arduino solely for the purpose of making a GSM network connection.
When the SIM900A is powered on, the Status LED will blink once every second.
When the GSM connection has been established the Status LED of the SIM900A will blink every 3 seconds.

Follow this guide, from Tutorial to interface GSM SIM900A with Arduino:

Initial startup of SIM900

Insert your SIM card to GSM module and lock it.
Power up the SIM900A by connecting it to Arduino's 5V and GND pins
Connect the Antenna
Now wait for some time (say 1 minute) and make note of the blinking rate of ‘status LED’ or ‘network LED’ (D6).
  The GSM module will take some time to establish connection with mobile network
Once the connection is established successfully, the status/network LED will blink continuously every 3 seconds. You may try making a call to the mobile number of the sim card inside GSM
  module. If you hear a ring back, the GSM module has successfully
  established network connection.

Connection to Arduino
The SIM900A has the following pins:

3VR;
3VT;
5VR;
5VT;
VCC, and;
GND.

For serial communication between the Arduino and SIM900A module. you
  have to connect:

SIM900A 5VT to Arduino D9 and;
SIM900A 5VR to Arduino D10

Basic Communication

To change SMS sending mode: AT+CMGF=1
mySerial.println("AT+CMGF=1");

To read SMS in text mode: AT+CNMI=2,2,0,0,0
mySerial.println("AT+CNMI=2,2,0,0,0");

To make a call: ATD+60XXXXXXXXX (replace X with number you want to call, change +60 to your country code)
mySerial.println("ATD+60XXXXXXXXX;");

To disconnect/hangup call: ATH
mySerial.println("ATH");

To redial: ATDL
mySerial.println("ATDL");

To receive a phone call: ATA
mySerial.println("ATA");

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


text:
ESP32 AP max connections: 4 or 10?
I am using the SoftAP feature of the ESP to create a central node, and connecting five or six clients in the final application. However, I don't know if i can connect that many clients.
One of the core files on GitHub, esp_wifi_types.h shows two conflicting lines:
#line 215, as a member of the 'wifi_ap_config_t' struct
uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */

#line 254
#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32 soft-AP */

So is it four or ten? Or something else? Any advice by somebody who's tried this would be appreciated.
esp_wifi_types.h on GitHub

I have no idea but have you tried connecting 5 clients to a simple service?  I think it was 4 on a 3866 so I would lean towards 10 on a ESP32.

I don't have enough wireless devices at my disposal right now, hard though it is to believe.

Please see my findings (march 2020) here : https://arduino.stackexchange.com/questions/72845/increasing-esp32-ap-max-connections/73143#73143

The answer is as clear as any other EspressIf configuration data, it is 4 or maybe 5, or 8, or 12, 16 or even 20 (the same as a ESP8266!)
To clarify, it seems that around 2015 the maximum was 4 connections, but it is possible to recompile the SDK to support up to 16 connections.  There doesn't seem to be a #define of flag that will let a programmer control this.
These links may guide you to a proper solution:
https://github.com/esp8266/Arduino/issues/570
 or https://myesp8266.blogspot.com/2016/11/esp32-increase-maximum-number-of-sockets.html


text:
How do I scroll through the LCD vertically with joystick?
I have a device I'm working on and the only issue I'm running into is I can't manage to figure out how to get my LCD display to move around vertically with the joystick I have attached to it. I have a feeling with a tip this could be a very simple fix, but I'm just stuck. So the brief of this is that I need someone to fill in the ???'s for me provided in my example code.
//Include the LCD Library.
#include <LiquidCrystal.h>
#include <Wire.h>
//Declare the LCD object and define pins.
#include <MFRC522.h>
#include <SPI.h>

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

#define SAD 10
#define RST 5

//Ignore The below line it is for the master code
#define I2C_ADDR    0x27 // <<----- Add your address here.  Find it from I2C Scanner
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup() {

//Booting the LCD
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home (); // go home
  lcd.cursor();

//Starting settings
  lcd.begin(1,0);
  lcd.clear();

}

//Sometimes you have to hit reset on the device

//Joystick Defaults X=484 Y=513

void loop() {
  lcd.setCursor(0,0);
  lcd.print("Example");
  delay(100);

for (int positionCounter = 0; positionCounter = 1; positionCounter++) {
if(analogRead(1) > 584) {
  lcd.scrollDisplayLeft();
  delay(30);
  } else if(analogRead(1) < 384) {
    lcd.scrollDisplayRight();
    delay(30);
  } else if(analogRead(0) < 413) {
     lcd.???????????????????();
     delay(30);
  } else if(analogRead(0) > 613) {
     lcd.??????????????????();
     delay(30);
    }
  }
}

The LCD library provides easy functions that activate commands in the LCD itself.  The LCD doesn't have functions that do what you want, so there is no simple vertical scrolling like you're suggesting.
If you need to have it, you'll need to re-write the screen with the content you want to display when the user scrolls around. I can't make any specific suggestions as I don't know the reason you need to scroll around the display this way, but one comprehensive method would be to create a buffer of data the LCD should be displaying, then scroll it using software (move the bytes around the way you want) and then send that buffer to the LCD when it changes.
There may be other more applicable or easier tricks, but that would largely depend on your specific use case and user interface design.

Thanks a bunch, I'm  pretty new to ardiuno, but I guess that makes sense I'll definetly keep it in mind, My LCD was dumping a large amount of data to the screen and it was dumping it line after line so I just wanted to be able to scroll through all the data.. I'm good for now tho I put a "band-aid" on the problem


text:
Sending serial data to Processing
I have a question about using the Arduino and Processing. I want to build a touch sensor using aluminum foil and connect it to an interface built in Processing. However i've come across a problem. I don't know how to send the serial data from the Arduino to Processing. This is the code I'm using to get the sensor value from the aluminum foil:
#include <CapacitiveSensor.h>

CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);

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

void loop(){
  long start = millis();
  long total1 =  cs_4_2.capacitiveSensor(30);

  Serial.print(millis() - start);
  Serial.print("\t");

  Serial.print(total1);
  Serial.print("\t");
  Serial.print('\n');

  delay(100);
}

The foil is connected to dig pin 4 with a resistor of 1M in between and to dig pin 2 with a resistor of 1K. Pin 4 is the send pin, pin 2 is the receive pin. It all works just fine, in the serial monitor in the Arduino software I get the value of the time between refreshes and the sensor value. But how do I use this sensor value in a Processing sketch? I thought of maybe using Firmata on the Arduino, but then I wouldn't know how to use the CapacitiveSensor library and get the sensor values. Does anyone know how to get this to work? Help would be greatly appreciated!

Try to use this code:
// Graphing sketch

import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph

void setup () {
// set the window size:
size(400, 300);

// List all the available serial ports
println(Serial.list());
// I know that the first port in the serial list on my mac
// is always my  Arduino, so I open Serial.list()[0].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[0], 9600);
// don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n');
// set inital background:
background(0);
}
void draw () {
// everything happens in the serialEvent()
}

void serialEvent (Serial myPort) {
// get the ASCII string:
String inString = myPort.readStringUntil('\n');

if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// convert to an int and map to the screen height:
float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, height);

// draw the line:
stroke(127,34,255);
line(xPos, height, xPos, height - inByte);

// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
}
else {
// increment the horizontal position:
xPos++;
}
}
}

Also look at: http://www.arduino.cc/en/Tutorial/Graph

You're already half way there - you're sending the data from the Arduino.  All you need to do now is read up on how to use Serial in Processing (hint: Arduino is based on Processing, so you should already know most of it) in order to read what you're sending.

SparkFun has a tutorial where they explain in great detail how to create a project where your Arduino communicates with Processing on your PC.


text:
Multiple I2C Devices connected parallel
I have two Lidar Lites, connected to one APM. I have no issue with getting data from one of them, i use the code below
#include <I2C.h>
#define    LIDARLite_ADDRESS   0x62          // Default I2C Address of LIDAR-Lite.
#define    RegisterMeasure     0x00          // Register to write to initiate ranging.
#define    MeasureValue        0x04          // Value to initiate ranging.
#define    RegisterHighLowB    0x8f          // Register to get both High and Low bytes in 1 call.

void setup(){
  Serial.begin(9600); //Opens serial connection at 9600bps.
  I2c.begin(); // Opens & joins the irc bus as master
  delay(100); // Waits to make sure everything is powered up before    sending or receiving data
  I2c.timeOut(50); // Sets a timeout to ensure no locking up of sketch if I2C communication fails
}

void loop(){
 // Write 0x04 to register 0x00
  uint8_t nackack = 100; // Setup variable to hold ACK/NACK resopnses
  while (nackack != 0){ // While NACK keep going (i.e. continue     polling until sucess message (ACK) is received )
    nackack = I2c.write(LIDARLite_ADDRESS,RegisterMeasure, MeasureValue); // Write 0x04 to 0x00
    delay(1); // Wait 1 ms to prevent overpolling
  }

  byte distanceArray[2]; // array to store distance bytes from read function

  // Read 2byte distance from register 0x8f
  nackack = 100; // Setup variable to hold ACK/NACK resopnses
  while (nackack != 0){ // While NACK keep going (i.e. continue polling until sucess message (ACK) is received )
    nackack = I2c.read(LIDARLite_ADDRESS,RegisterHighLowB, 2, distanceArray); // Read 2 Bytes from LIDAR-Lite Address and store in    array
   delay(1); // Wait 1 ms to prevent overpolling
  }
  int distance = (distanceArray[0] << 8) + distanceArray[1];  // Shift high byte [0] 8 to the left and add low byte [1] to create 16-bit int

  // Print Distance
  Serial.println(distance);
}

i can get the distance fine, now have two connected, as follows

So my noob question is how to i get data from the 2, my guess is the wiring is ok.
I am using the code from https://github.com/PulsedLight3D/LIDARLite_v2_Arduino_Library
any help would be appreciated. thanks.

Did you give them distinct addresses?

if i run a I2C scanner it only shows one address and one device 0x62 , i can change the address, but it doesn't help as i still don't know whats the address of the 2nd one or if i have access to it.

Then the answer is "no".

The change address example sketch looks like giving each LIDAR an individual address is easy...

Diagram Multi-sensor PWR_EN Wiring shows each sensor's PWR_EN connected to independent digital outputs, so you should be able to call the changeAddressMultisensor function in your setup(). See Change I2C Address for Single Sensor You may have to use CTRL+F (find on page) "Change I2C Address for Single Sensor" as the href doesn't seem to work right on chrome or firefox.

There is some excellent instructions in the source code; https://github.com/PulsedLight3D/LIDARLite_v2_Arduino_Library/blob/master/LIDARLite/LIDARLite.cpp#L585

Connect one at a time and run the change address sketch mentioned by Yeti.
Naturally change each one (one at a time) to different addresses (ex. 0x62, 0x64, 0x66).

i still don't know whats the address of the 2nd one

The address is what you change it to.
Then connect them all back up again and run the I2C scanner. You should see all 3 addresses.

documents state that address changes will be gone when i power it off

If that is true, save the address for each module in EEPROM. Then use that code to change the module address in setup.

See the address in the code you posted?
#define    LIDARLite_ADDRESS   0x62          // Default I2C Address of LIDAR-Lite.

If you don't want to save the address in EEPROM just upload three versions of the sketch with a different address in each one. Note that the address must be even (eg. 0x62, 0x64, 0x66).
But it would be very simple just to read from EEPROM in setup and keep the address in a variable rather than a #define.

documents state that address changes will be gone when i power it off.

Then turn off two lidars with transistors, program the first one, turn on the second one, program it, then turn the last one on. That way there are no address conflicts while programming it as all the addresses are different while programming any of them.


text:
Start to build a robot
I would like to start with a very simple robot, which should be based on an arduino uno.
I already have an uno and made the decision fpr my robot chassie:
https://www.roboter-bausatz.de/en/diy-electronics/kits/robotic-kits/97/2wd-motor-smart-car-chassis-fuer-roboter-mit-getriebemotor-und-batteriebox
Additionally I want to by an ultrasonic distance sensor and a infrared sensor.
What else do I need to start ? Only a DC motor driver or anything else?
Thanks in advance
LStrike

You'll need:

Emergency switch (it should be easy to cut the power off, even for small robots)
A chassis (you've found one already)
Motors (Obviously)
Motor control (Probably a dual H-bridge, think if you need reverse or not.)
Power (powering on (single use) batteries may not be your best option)
Controller (Arduino Uno, or something smaller or faster)
Sensors (Can be anything, depending on the requirements)

A way to communicate with the robot is also nice, often wireless (bluetooth/wifi/443mhz).
And also, it will be nice if the robot fits some kind of purpose, but this could be added later.
You could think of the robot having to pick up and carry something, extinguish a flame etc.
I advise to check out one of the many tutorials on building a robot, they often have a detailed parts list (sometimes even shopping links).

Thats a nice list, thx. Never thought about an Emergency switch. I think I will start small with just driving an avoid crashing into objects ;-)

@LStrike, to avoid crashing into objects, it's often better to use at least 2 sensors that rely on different principles. If you have a "sonar" sensor, and you aim it at a plushy object, at may not work as well. So an extra IR sensor is a nice safety feature. You can check if you need to know the distance to the object, or just registering the object from a set distance is enough.
But yeah, sensors can be added later.


text:
Can't Interface SIM900a With Arduino Uno
I've got the following module of SIM900a.

My connections are:
VCC -> External 5 Volt 1.5 Amp Supply
GND -> Common GND
TX -> Arduino RX (Pin 0)
RX -> Arduino TX (Pin 1)

I hear a ring when I call on the sim card that has inserted there. So it can register to a network successfully. I've uploaded a blank code in Arduino Uno to test AT Commands. But I'm not getting any response when I type AT on Serial Monitor. What am I doing wrong here?

Share some code with us!

I've uploaded the blank code for testing AT commands.

maybe the baud rate is incorrect

I've tried all different baud rates. No luck :/

I was facing the same issue and solved this issue when I have used softwareSerial.h library and used to connect TXD of sim900A with pin 13 and RXD of sim900A withpin 12 of ardunio MEGA.
You can also use 10 and 11 pins of mega instade of 12 and 13 i.e.
#include <SoftwareSerial.h>      // Configure software serial por
SoftwareSerial SIM900A(10, 11);  // (sim 900 connections RXD=>10 & TXD=>11)

At first, make sure that the sim has connected to the network. For this, you can call to the sim number from another phone. If not ringing that means the sim wasn't able to connect with the network. For this check power supply, antenna etc. If ringing then there something wrong in connection or code. So cross check the connection and send AT to the module and wait for returned data. If no data returned, then there check connection again. If the returned data is OK, then it is ready to use. and if returned data is ERROR then Arduino have connected to sim module but sim network, power supply etc problem happening.

I've already mentioned in the question that I can hear a ring back.

I think you use hardware serial for communicating with pc for serial monitor and gsm. For this, it may conflict with each other. Try to use SoftwareSerial.h for gsm communication.


text:
Taking String Input from NodeMCU Webpage and Printing it on Serial Monitor
I've started working with NodeMCU recently. I've very little knowledge about this device and how a website works. I'm trying to take a long string input from a website hosted by NodeMCU, store it on a variable and then print in on NodeMCU Serial Monitor.
I've got the following program. Here I only have created a text box for typing. But I don't know how to take that input inside a variable and use it later for serial printing.
#include <ESP8266WiFi.h>

const char* ssid = "****";
const char* password = "*************";

WiFiServer server(80);

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

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    }
    server.begin();
}

void loop() {
    WiFiClient client = server.available();
    if (!client) {
    return;
    }

    Serial.println("new client");
    while(!client.available()){
    delay(1);
    }

    String request = client.readStringUntil('\r');
    Serial.println(request);
    client.flush();

    client.println("HTTP/1.1 200 OK");
    client.println("Content-Type: text/html");
    client.println("");

    client.println("<!DOCTYPE HTML>");
    client.println("");

    client.println("Serial Printer (Put Text here: ): ");
    client.println("

");
    client.println("<input type='text' id='name' name='name' required minlength='0' maxlength='800' size='100'>");
    client.println("");

    delay(1);
    Serial.println("Client disonnected");
    Serial.println("");

}

You first need to learn about HTML forms. You need more than just an input tag.

use ESP8266WebServer and see the SimpleAuthentification example

Try this. It uses the webserver library. I thought it was cleaner code. I also have a nicer way to include the pure html code.
For your original form go to yourIPaddress/single
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

const char* ssid = "MTS61752";
const char* password = "6900979039";

ESP8266WebServer webserver(80);

//------------------------------------------------
static const char PROGMEM singleLine[] = R"rawliteral(
<!DOCTYPE html>

<title>Single Line Input</title>

<form method="post" action="/save" >
Serial Printer (Put Text here: ):

<input type='text' id='name' name='name' required minlength='0' maxlength='800' size='100'>
<input type="submit" name="clk_action" value="accept">
</form>

)rawliteral";

//------------------------------------------------
static const char PROGMEM INDEX_HTML[] = R"rawliteral(
<!DOCTYPE html>

<title>Clock Settings</title>

<form method="post" action="/save" >
Turn on time:
<input name="onTime" type="text" size="16" value="" >

Turn off time:
<input name="offTime" type="text" size="16" value="" >

<input type="submit" name="clk_action" value="accept">
</form>

)rawliteral";

//------------------------------------------------
void handleRoot() {
  webserver.send(200, "text/html", INDEX_HTML);
}

//------------------------------------------------
void handleNotFound() {
  webserver.send(404, "text/plain", "Page not found ...");
}

//------------------------------------------------
void handleSave() {
  String str = "Settings Saved ...\r\n";

  Serial.print("number of arguments ");
  Serial.println(webserver.args());                    // number of arguments

  if (webserver.args() > 0 ) {
    for ( uint8_t i = 0; i < webserver.args(); i++ ) {
      str += webserver.argName(i) + " = " + webserver.arg(i) + "\r\n";

      Serial.println("Arg "+ String(i)+"="+ webserver.argName(i));
      Serial.println("Arg "+ String(i)+"="+ webserver.arg(i));
    }
  }
  webserver.send(200, "text/plain", str.c_str());
}

//------------------------------------------------
void handleSingleLine() {
  webserver.send(200, "text/html", singleLine);
}

//------------------------------------------------
void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  webserver.on("/", handleRoot);
  webserver.on("/save", handleSave);
  webserver.onNotFound(handleNotFound);
  webserver.on("/single", handleSingleLine);

  webserver.begin();
  Serial.println("Web server has started");
}

//------------------------------------------------
void loop() {
  webserver.handleClient();

}

[pedant]You need to close your tags properly.[/pedant]

Can you be more specific. I can't see anything missing closing tags.

Inputs and BR tags.

<input .... /> and

  https://stackoverflow.com/a/13232170/6544572 --- These are void elements. This means they aren't designed to contain text or other elements, and as such do not need — and in fact, cannot have — a closing tag in HTML. -----  I did some searching and it seems that XHTML uses  but I have found any documentation that specifies its use in HTML. (note, my HTML knowledge is limited) On   http://w3c.github.io/html-reference/br.html#br

I always work in XHTML. HTML is so nineties. I take the view that XHTML is a flavour of XML, so must be treated as such. Makes it simpler to switch from one to another: the same set of rules apply to both, since they are both just XML.