text:
Communication over I2C protocol with more than one A/D device
According to datasheet of MCP3021 A/D converter (Microchip, page 16) the MCP3021 can be accessed by proper address bits in control byte. In case of MCP3021 5AT the address is 101, in case of MCP3021 4AT the address is 100. Does than mean that to interface two MCP3021 diveces in one circuit one have to purchase two devices with different serial number, e.g. MCP3021 5AT and 4AT?

Yes, you need different devices for different addresses. Up to 8 addresses are possible:

The first part
  of the control byte consists of a 4-bit device code, which
  is set to 1001 for the MCP3021. The device code is fol-
  lowed by three address bits: A2, A1 and A0. The default
  address bits are 101 (contact the Microchip factory for
  additional address bit options).The address bits allow
  up to eight MCP3021 devices on the same bus and are
  used to determine which device is accessed

The number after the A in the part number indicates the address:

Off the shelf you get address 5. If you want other addresses you have to order them specially from Microchip.
The device sacrifices flexibility in favour of size. If you want multiple devices on the same bus and not have to order different parts specially then you generally end up with a bigger chip with more pins to allow you to manually configure the sub-address.

Thank you very much for a quick answer and helpfull information! That prevent me from buying unnecessary components.

source: Stack Exchange

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

sort: votes


text:
Would Arduino Nano be good for Bluetooth + Sound
So I've been browsing around for a whole looking for a good microcontroller that's super small. So far the smallest one I found was an Arduino Nano. But before I go buying it, there are some questions I have about it.

Is Bluetooth compatible with it and if so where would I get the Bluetooth code?
Is there anything smaller than it that's Bluetooth compatible?
Would an Arduino Nano (Or the device in the question above) be able to play sounds?

There are Bluetooth boards and chips that you can connect to a Nano.
You can play sounds with a Nano. Crudely with PWM and a direct connection, for finely with an external digital-to-analog converter.
But if super-smallness is what you are after, there may be better options.
The Blue Bean is a complete  BLE microcontroller on a single board that is smaller than a Nano+board.
If you want even smaller, you could get something like the new Cypress EZ-BLE module...

http://www.cypress.com/products/ez-ble-module-bluetooth-smart
It is a complete programmable BLE system on a tiny module. It is hard to imagine anything smaller than that!

Can a blue bean connect to a Windows usb port @bigjosh

In theory, could this Cypress BLE module be grafted into an existing piece of consumer electronics (I'm thinking portable video games system) and wired up to deliver Bluetooth audio for wireless headphones? Assuming skills, space inside the device, access to appropriate connections for power and audio in...

@RowanHarley You'd typically use Bluetooth to connect to the blue bean, so you don't need a USB connection.

@MickWaites If you want to deliver audio over the connection, then you probably want Bluetooth rather than only BLE. Probably the easiest way to stream audio to some bluetooth headphones is to get one of these and take it apart to fit into your game system.

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


text:
Esp8266 Arduino smart connect
Below i have an example of a temperature sensor.What i need to be able to set the username an password dynamically before connecting to my home router.It would ask me for the ssid and password for example.example. Ive seen a couple of posts about this with no definitive code to show how it would work.If anyone has experience with this could they comment here please.
#include
#include
#include
#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

#define SSID "[YOUR_SSID]"
#define PASS "[YOUR_PASSWORD]"
#define IP "184.106.153.149" // thingspeak.com
String GET = "GET /update?key=[THINGSPEAK_KEY]&field1=";

void setup()
{
  Serial.begin(9600);
  sensors.begin();
  Serial.println("AT");
  delay(5000);
  if(Serial.find("OK")){
    connectWiFi();
  }
}

void loop(){
  sensors.requestTemperatures();
  float tempC = sensors.getTempCByIndex(0);
  tempC = DallasTemperature::toFahrenheit(tempC);
  char buffer[10];
  String tempF = dtostrf(tempC, 4, 1, buffer);
  updateTemp(tempF);
  delay(60000);
}

void updateTemp(String tenmpF){
  String cmd = "AT+CIPSTART=\"TCP\",\"";
  cmd += IP;
  cmd += "\",80";
  Serial.println(cmd);
  delay(2000);
  if(Serial.find("Error")){
    return;
  }
  cmd = GET;
  cmd += tenmpF;
  cmd += "\r\n";
  Serial.print("AT+CIPSEND=");
  Serial.println(cmd.length());
  if(Serial.find(">")){
    Serial.print(cmd);
  }else{
    Serial.println("AT+CIPCLOSE");
  }
}

boolean connectWiFi(){
  Serial.println("AT+CWMODE=1");
  delay(2000);
  String cmd="AT+CWJAP=\"";
  cmd+=SSID;
  cmd+="\",\"";
  cmd+=PASS;
  cmd+="\"";
  Serial.println(cmd);
  delay(5000);
  if(Serial.find("OK")){
    return true;
  }else{
    return false;
  }
}

Well you need some sort of way to input the username and password so you'll need to use a SoftwareSerial to connect to your computer through an FTDI in order to communicate the information over a COM port.

Yea, assuming the temp access point has the same user and pass all the time.  Just connect to that, enter the permissions through the web-portal and have the webapp send the new information to your device then connect to that.  You'll have considerably more back-end work to do though since you need to set up a little web-app/server

I have cobbled together, from the library examples, a program to log temperature and humidity to an MQTT server. The SSID/password, MQTT server and port, and the MQTT publish path can all be set at run time. Once they are set, the device will remember and re-use the settings next time it boots.
I am using the Arduino IDE to program an ESP8266-01. It, in turn, talks to a DHT11 sensor for temperature and humidity data.
The program is found at https://github.com/PabluskiNC/TempHumidityLogger
    #include <FS.h>                   //this needs to be first, or it all crashes and burns...

    #include "DHT.h"
    #define DHTPIN 2
    #define DHTTYPE DHT11
    DHT dht(DHTPIN, DHTTYPE);

    #include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino

    //needed for library
    #include <DNSServer.h>
    #include <ESP8266WebServer.h>
    #include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager

    #include <ArduinoJson.h>          //https://github.com/bblanchon/ArduinoJson

    #include <PubSubClient.h>
    WiFiClient espClient;
    PubSubClient client(espClient);
    long mqtt_lastMsg = 0;
    char mqtt_msg[50];
    int  mqtt_value = 0;

    //define your default values here, if there are different values in config.json, they are overwritten.
    char mqtt_server[40];
    char mqtt_port[6] = "1883";
    char mqtt_topic[34] = "OutTopic";

    //flag for saving data
    bool shouldSaveConfig = false;

    //callback notifying us of the need to save config
    void saveConfigCallback () {
      Serial.println("Should save config");
      shouldSaveConfig = true;
    }

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

      //clean FS, for testing
      //SPIFFS.format();

      //read configuration from FS json
      Serial.println("mounting FS...");

      if (SPIFFS.begin()) {
        Serial.println("mounted file system");
        if (SPIFFS.exists("/config.json")) {
          //file exists, reading and loading
          Serial.println("reading config file");
          File configFile = SPIFFS.open("/config.json", "r");
          if (configFile) {
            Serial.println("opened config file");
            size_t size = configFile.size();
            // Allocate a buffer to store contents of the file.
            std::unique_ptr<char[]> buf(new char[size]);

            configFile.readBytes(buf.get(), size);
            DynamicJsonBuffer jsonBuffer;
            JsonObject& json = jsonBuffer.parseObject(buf.get());
            json.printTo(Serial);
            if (json.success()) {
              Serial.println("\nparsed json");

              strcpy(mqtt_server, json["mqtt_server"]);
              strcpy(mqtt_port, json["mqtt_port"]);
              strcpy(mqtt_topic, json["mqtt_topic"]);

            } else {
              Serial.println("failed to load json config");
            }
          }
        }
      } else {
        Serial.println("failed to mount FS");
      }
      //end read

      // The extra parameters to be configured (can be either global or just in the setup)
      // After connecting, parameter.getValue() will get you the configured value
      // id/name placeholder/prompt default length
      WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 40);
      WiFiManagerParameter custom_mqtt_port("port", "mqtt port", mqtt_port, 5);
      WiFiManagerParameter custom_mqtt_topic("topic", "mqtt topic", mqtt_topic, 32);

      //WiFiManager
      //Local intialization. Once its business is done, there is no need to keep it around
      WiFiManager wifiManager;

      //set config save notify callback
      wifiManager.setSaveConfigCallback(saveConfigCallback);

      //set static ip
      //wifiManager.setSTAStaticIPConfig(IPAddress(10, 0, 1, 99), IPAddress(10, 0, 1, 1), IPAddress(255, 255, 255, 0));

      //add all your parameters here
      wifiManager.addParameter(&custom_mqtt_server);
      wifiManager.addParameter(&custom_mqtt_port);
      wifiManager.addParameter(&custom_mqtt_topic);

      //reset settings - for testing
      //wifiManager.resetSettings();

      //set minimu quality of signal so it ignores AP's under that quality
      //defaults to 8%
      //wifiManager.setMinimumSignalQuality();

      //sets timeout until configuration portal gets turned off
      //useful to make it all retry or go to sleep
      //in seconds
      //wifiManager.setTimeout(120);

      //fetches ssid and pass and tries to connect
      //if it does not connect it starts an access point with the specified name
      //here  "AutoConnectAP"
      //and goes into a blocking loop awaiting configuration
      if (!wifiManager.autoConnect("AutoConnectAP", "password")) {
        Serial.println("failed to connect and hit timeout");
        delay(3000);
        //reset and try again, or maybe put it to deep sleep
        ESP.reset();
        delay(5000);
      }

      //if you get here you have connected to the WiFi
      Serial.println("connected...yeey :)");

      //read updated parameters
      strcpy(mqtt_server, custom_mqtt_server.getValue());
      strcpy(mqtt_port, custom_mqtt_port.getValue());
      strcpy(mqtt_topic, custom_mqtt_topic.getValue());

      //save the custom parameters to FS
      if (shouldSaveConfig) {
        Serial.println("saving config");
        DynamicJsonBuffer jsonBuffer;
        JsonObject& json = jsonBuffer.createObject();
        json["mqtt_server"] = mqtt_server;
        json["mqtt_port"] = mqtt_port;
        json["mqtt_topic"] = mqtt_topic;

        File configFile = SPIFFS.open("/config.json", "w");
        if (!configFile) {
          Serial.println("failed to open config file for writing");
        }

        json.printTo(Serial);
        json.printTo(configFile);
        configFile.close();
        //end save
      }

      client.setServer(mqtt_server, stringToNumber(mqtt_port));
      client.setCallback(callback);
      Serial.println("local ip");
      Serial.println(WiFi.localIP());
      dht.begin();
    }

    int stringToNumber(String thisString) {
      int i, value, length;
      length = thisString.length();
      char blah[(length + 1)];
      for (i = 0; i < length; i++) {
        blah[i] = thisString.charAt(i);
      }
      blah[i] = 0;
      value = atoi(blah);
      return value;
    }

    void callback(char* topic, byte* payload, unsigned int length) {
      Serial.print("Message arrived [");
      Serial.print(topic);
      Serial.print("] ");
      for (int i = 0; i < length; i++) {
        Serial.print((char)payload[i]);
      }
      Serial.println();

      // Switch on the LED if an 1 was received as first character
      if ((char)payload[0] == '1') {
        digitalWrite(BUILTIN_LED, LOW);   // Turn the LED on (Note that LOW is the voltage level
        // but actually the LED is on; this is because
        // it is acive low on the ESP-01)
      } else {
        digitalWrite(BUILTIN_LED, HIGH);  // Turn the LED off by making the voltage HIGH
      }

    }

    void reconnect() {
      // Loop until we're reconnected
      while (!client.connected()) {
        Serial.print("Attempting MQTT connection...");
        Serial.print(mqtt_server);
        Serial.print(":");
        Serial.print(mqtt_port);
        Serial.print("...");
        // Attempt to connect
        if (client.connect("ESP8266Client")) {
          Serial.println("connected");
          // Once connected, publish an announcement...
          client.publish(mqtt_topic, "Reconnected");
          // ... and resubscribe
          //client.subscribe("inTopic");
        } else {
          Serial.print("failed, rc=");
          Serial.print(client.state());
          Serial.println(" try again in 5 seconds");
          // Wait 5 seconds before retrying
          delay(5000);
        }
      }
    }

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

      float h = dht.readHumidity();
      float t = dht.readTemperature();
      if (isnan(t) || isnan(h)) {
        Serial.println("Failed to read from DHT");
      } else {
        Serial.print("Temp:");
        Serial.print(t);
        Serial.print( "*C  Humidity:");
        Serial.print(h);
        Serial.println("%");
        if (!client.connected()) {
          reconnect();
        }
        client.loop();

        //long now = millis();
        //if (now - mqtt_lastMsg > 2000) {
        //  lastMsg = now;
        //  ++mqtt_value;
        char temp[7];
        dtostrf(t,4,2,temp); //convert float to char
        snprintf (mqtt_msg, 50, "%s C", temp);
        //  Serial.print("Publish message: ");
        //  Serial.println(msg);
        //  client.publish(mqtt_topic, msg);
        //}
        char pub_topic[34];
        strcpy(pub_topic,mqtt_topic);
        strcat(pub_topic,"/temperature");
        client.publish( pub_topic , mqtt_msg);
        Serial.print("Publish: ");
        Serial.print(pub_topic);
        Serial.print(" , ");
        Serial.println(mqtt_msg);

        dtostrf(h,4,2,temp); //convert float to char
        snprintf (mqtt_msg, 50, "%s %", temp);

        strcpy(pub_topic,mqtt_topic);
        strcat(pub_topic,"/humidity");
        client.publish(pub_topic,mqtt_msg);
        Serial.print("Publish: ");
        Serial.print(pub_topic);
        Serial.print(" , ");
        Serial.println(mqtt_msg);
      }
      delay(5000);
    }

This is a nice piece of code.Great Job

The following code can do what you want (source), all that is needed is to combine it with the sensor code. The default behaviour is to create an access point when it can't connect to the eeprom stored WiFi station but you can modify it to trigger with a button/jumper or any other way you prefer.
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>

ESP8266WebServer server(80);

const char* ssid = "test";
const char* passphrase = "test";
String st;
String content;
int statusCode;

void setup() {
  Serial.begin(115200);
  EEPROM.begin(512);
  delay(10);
  Serial.println();
  Serial.println();
  Serial.println("Startup");
  // read eeprom for ssid and pass
  Serial.println("Reading EEPROM ssid");
  String esid;
  for (int i = 0; i < 32; ++i)
    {
      esid += char(EEPROM.read(i));
    }
  Serial.print("SSID: ");
  Serial.println(esid);
  Serial.println("Reading EEPROM pass");
  String epass = "";
  for (int i = 32; i < 96; ++i)
    {
      epass += char(EEPROM.read(i));
    }
  Serial.print("PASS: ");
  Serial.println(epass);
  if ( esid.length() > 1 ) {
      WiFi.begin(esid.c_str(), epass.c_str());
      if (testWifi()) {
        launchWeb(0);
        return;
      }
  }
  setupAP();
}

bool testWifi(void) {
  int c = 0;
  Serial.println("Waiting for Wifi to connect");
  while ( c < 20 ) {
    if (WiFi.status() == WL_CONNECTED) { return true; }
    delay(500);
    Serial.print(WiFi.status());
    c++;
  }
  Serial.println("");
  Serial.println("Connect timed out, opening AP");
  return false;
}

void launchWeb(int webtype) {
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("Local IP: ");
  Serial.println(WiFi.localIP());
  Serial.print("SoftAP IP: ");
  Serial.println(WiFi.softAPIP());
  createWebServer(webtype);
  // Start the server
  server.begin();
  Serial.println("Server started");
}

void setupAP(void) {
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);
  int n = WiFi.scanNetworks();
  Serial.println("scan done");
  if (n == 0)
    Serial.println("no networks found");
  else
  {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i)
     {
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(WiFi.SSID(i));
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i));
      Serial.print(")");
      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
      delay(10);
     }
  }
  Serial.println("");
  st = "
";
  for (int i = 0; i < n; ++i)
    {
      // Print SSID and RSSI for each network found
      st += "
";
      st += WiFi.SSID(i);
      st += " (";
      st += WiFi.RSSI(i);
      st += ")";
      st += (WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*";
      st += "
";
    }
  st += "
";
  delay(100);
  WiFi.softAP(ssid, passphrase, 6);
  Serial.println("softap");
  launchWeb(1);
  Serial.println("over");
}

void createWebServer(int webtype)
{
  if ( webtype == 1 ) {
    server.on("/", []() {
        IPAddress ip = WiFi.softAPIP();
        String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
        content = "<!DOCTYPE HTML>\r\nHello from ESP8266 at ";
        content += ipStr;
        content += "
";
        content += st;
        content += "
<form method='get' action='setting'>SSID: <input name='ssid' length=32><input name='pass' length=64><input type='submit'></form>";
        content += "";
        server.send(200, "text/html", content);
    });
    server.on("/setting", []() {
        String qsid = server.arg("ssid");
        String qpass = server.arg("pass");
        if (qsid.length() > 0 && qpass.length() > 0) {
          Serial.println("clearing eeprom");
          for (int i = 0; i < 96; ++i) { EEPROM.write(i, 0); }
          Serial.println(qsid);
          Serial.println("");
          Serial.println(qpass);
          Serial.println("");

          Serial.println("writing eeprom ssid:");
          for (int i = 0; i < qsid.length(); ++i)
            {
              EEPROM.write(i, qsid[i]);
              Serial.print("Wrote: ");
              Serial.println(qsid[i]);
            }
          Serial.println("writing eeprom pass:");
          for (int i = 0; i < qpass.length(); ++i)
            {
              EEPROM.write(32+i, qpass[i]);
              Serial.print("Wrote: ");
              Serial.println(qpass[i]);
            }
          EEPROM.commit();
          content = "{\"Success\":\"saved to eeprom... reset to boot into new wifi\"}";
          statusCode = 200;
        } else {
          content = "{\"Error\":\"404 not found\"}";
          statusCode = 404;
          Serial.println("Sending 404");
        }
        server.send(statusCode, "application/json", content);
    });
  } else if (webtype == 0) {
    server.on("/", []() {
      IPAddress ip = WiFi.localIP();
      String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
      server.send(200, "application/json", "{\"IP\":\"" + ipStr + "\"}");
    });
    server.on("/cleareeprom", []() {
      content = "<!DOCTYPE HTML>\r\n";
      content += "
Clearing the EEPROM
";
      server.send(200, "text/html", content);
      Serial.println("clearing eeprom");
      for (int i = 0; i < 96; ++i) { EEPROM.write(i, 0); }
      EEPROM.commit();
      WiFi.disconnect();
    });
  }
}

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

The configuration access point ssid and password are set in
const char* ssid = "test";
const char* passphrase = "test";

The default IP is 192.168.4.1. When you open it from a browser you see a screen which lists the available WiFi stations (ESP8266 scan result), the signal strength and an asterisk on locked stations. There are also two text boxes where you enter the ssid and password of the station you want to connect to and submit:

Note that there is a link to a similar library in the comments of the source link, that didn't work for me but you can try it.

The WifiManager is pretty good, but my own testing reveals it needs to mature a bit.  It has trouble authenticating to my WiFi; but keep your eyes on it


text:
Esp8266 V12 Wiring
I have tried a Google search and cannot find any place that tells me exactly how to wire the version 12 esp8266 ,
How should it be wired for normal operation and for flashing ?
I am designing a diy pcb and need to know the specifics,to wire a switch for flashing purposes etc.I am using just a esp8266 version 12 standalone without a typical arduino micro-controller attached and will be flashing it to take the arduino ide ,any help with this would be great as I'm sure someone has already come across this problem.

You could find the solution, on the first hit for googling "ESP8266 ESP-12".

You need to connect a few GPIO pins on the ESP-12 to 3.3V or Ground,
  to set it in the right mode for communicating with it. Here are the
  connections you need to make :
VCC ----> 3.3V Power supply (Vout of LM1117)
GND ----> Ground of power supply
CH_PD ----> HIGH (3.3V)
GPIO2 ----> HIGH (3.3V)
GPIO15 ----> LOW (GND)
GPIO0 ----> HIGH or Floating for AT Mode (3.3V) [ * if you want to
  flash completely different firmware then you must connect it to ground
  ]

You need to connect GPIO0 to GND for flashing and to VCC for normal operation.

Thank you ,i wasn't sure where to believe as their seemed to be conflicting information but this could be due to different configurations,thank you for answering my question at least i can be sure now.Thank you


text:
OTA Update Esp8266 without IDE
I was wondering if its possible to program the esp8266 to receive firmware updates without the use of an IDE to program.
Use Case:
This device should be setup to the WiFi network scan an IP for a firmware update and update itself if needed.
Any help is greatly appreciated. Thank you

This: https://github.com/arendst/Sonoff-MQTT-OTA-Arduino is a Arduino based firmware with support for OTA. It's written for Sonoff, but that is just a ESP8266 with a relay attached, you can easily adapt it to any ESP8266.
It uses a 'hard coded' address of a web server where it downloads the firmware, and updates are triggered by MQTT messages, but all of that should not be too hard to change to something else.

The firmware host will need a loader application that can talk to the bootloader in the ESP. You'll probably need to build a bit of hardware on the client to sequence grounding of the appropriate GPIO & Reset pins.
The application on the ESP would probably need to do something like:

Discover the availability of an update;
Tell the host to start its loader application;
Begin the local I/O-pin sequencer to start the local bootloader.

The final step should cause the chip to reset and the bootloader to take control. Both the loader on the host and the bootloader will nned to be somewhat tolerant of the potential network delays.


text:
What good designs are available for Geiger counters using an Arduino?
Are there any good circuit designs for Geiger-counter projects using an Arduino?
If so, what Geiger-Muller tubes should I choose to detect different types of radiation?

There are a few good, open-source, designs for Geiger counters using cheap G-M tubes and Arduino boards out there. Which one is best for you depends on what you want to achieve, so let's start by taking a look at what you might want to detect.

What are these "types" of radiation?

(source: Wikipedia)
Alpha radiation: basically consists of helium-4 nuclei (i.e. two protons and two neutrons). These interact with matter strongly because they are relatively heavy and carry a positive charge. However, because of their mass they will normally only penetrate a few centimetres of air. Alpha particles can be stopped in their tracks by a single sheet of paper.
You may not realise it, but the sensor in most smoke detectors uses a very small amount (~0.2μg) of Americium -  241Am.

Beta radiation: consists of highly energetic electrons. Because these particles are relatively light, they can penetrate somewhat further than Alpha particles. Even so, beta radiation can be stopped by a thin sheet of aluminium.
The big risk to human health from alpha- and beta-emitters is when they are ingested or inhaled. In these cases, the particles are brought into close contact with sensitive live tissue where the ionising radiation has the potential to cause various types of cancers.
Gamma radiation: is electromagnetic radiation having a higher frequency and shorter wavelength than X-rays.

One way to think of gamma-radiation is like a kind of "super X-ray". Gamma rays can pass through virtually anything. To build an effective shield, you need to have either very thick walls or a shield made from something with a high atomic weight, such as lead.
Gamma rays are produced naturally by the sun and stars - this is the source of what we call "cosmic radiation".

So which tubes should you choose?
Once you have decided what types of radiation you want your Geiger counter to detect the next step is choosing the tube. In general, they are all high-voltage tubes, typically operating at ~ 400V.
At the moment, the cheapest available tubes are probably the Russian SI-3BG Geiger Muller tubes, which can be picked up on eBay for about £5 GB. These are not very sensitive, but I've found they do work OK for beta and gamma radiation. However, it doesn't detect alpha radiation (which, as mentioned earlier, is what is emitted by the source in the sensor in many smoke detectors!)
One thing to watch out for is that these tubes are all different sizes, ranging from about 20mm long to more than 200mm. This matters. If you are going to design or buy a PCB for your project, just check that it has been designed to fit the sensor that you intend to use.
The following table lists the most popular G-M tubes, together with their main characteristics:

Follow the links below for further data on each tube:

SBM-20
SBM-21
SI-1G
SBT-9
SI-3BG
LND-712
LND-7124
LND-7224
J408γ
J305β
J306β

Your choice of tube is going to be determined by your budget, the types of radiation you want to detect and the sensitivity you want to achieve with your G-M counter.

Circuit designs
OK, so now we understand the radiation types, and we've chosen our tube, what Geiger counter designs are out there that use the Arduino.
(disclaimer: I have no connection with any of the companies mentioned in this answer)
Well, it turns out there are a few good designs out there (Google is your friend here), but one that does stand out from the pack (IMHO) is the Geiger Counter - Radiation Sensor Board for Arduino and Raspberry Pi from Cooking Hacks.
This is an open hardware design, and the code can be downloaded on a GPL licence.
It's a relatively simple design, and has a kit available pretty much off-the-shelf. Software can be downloaded for the Arduino and/or the Raspberry Pi. If you decide to buy the kit, they assure us that the shield/hat has been tested with the Arduino Uno and all models of the R-Pi.
Alternatively, you can just download the circuit diagram on the link above and design your own PCB (I don't think they offer the Gerber or Eagle files to download).
It is worth mentioning that the tutorial page also includes all the lovely useful background theory you'll need to understand how Geiger counters work, and how to get the most out of it.

Final thoughts. If you were thinking of building a Geiger counter without using an Arduino (Yes, yes, I know. But there may be some strange people out there who want to go this route!), there are still some nice designs out there you can play with.
The Geiger counter from MightyOhm is also open-source and uses the SBM-20 Geiger-Muller tube. Again, it is available as a kit, but if you prefer the DIY route, the design files are available to download.
Having looked at it, adapting this design to interface with an Arduino would probably also be relatively straightforward ...
If you are on a really tight budget there is a $15 Geiger counter on Hackaday. This uses the Russian SI-3BG G-M tube (discussed above) and a modified power-supply from a disposable camera.
I built one of these with a friend who was just starting out studying electronics and wanted to have a go at this project. I can confirm that it works, but that $15 price-tag is very optimistic.
(Having built this one, my friend decided that her next project would be to design a better one with greater sensitivity and which could detect alpha-, beta- and gamma-radiation and which incorporated an Arduino Uno. In hindsight, I should probably have mentioned the design from Cooking Hacks ..!).

Nice answer! A lot of good detail there. :)


text:
How can I automatically start a LAN connection?
I have a Samsung Galaxy Note 10.1 with JuiceSSH installed. I also have Debian Linux installed via chroot. I'll be ordering an Intel Galileo to use as a portable compilation server. I have an attachment for the Note 10.1 that serves as a USB and an ethernet adapter. I figure I could power the Note 10.1 with the USB port and connect to it via SSH through the ethernet port.
Unfortunately, this post notes that in order to connect the Galileo via ssh, the LAN connection must be started manually through Arduino Sketch.
I'd like to install Debian Linux on the Galileo, get rid of my chroot Debian on my tablet, and have that LAN connection started automatically when the Galileo boots so that I can just connect to it through JuiceSSH on my tablet. This is so I can do everything without depending on WiFi and compile "offline". How do I automatically start the LAN connection and avoid having to use Arduino Sketch?
Also, does anyone know if ArduinoDroid works on the Galileo?


text:
Is there a way to test whether the UART Tx buffer is empty without waiting?
Is there a way to test whether the UART Tx buffer is empty without waiting?
serial.flush() waits, so it won't help me.
I tried looking into serial.SerialEvent(), but the link was broken on the Arduino reference page.
Can anyone point me to a description of it?

If you need such fine control over the UART then you may need to drop to low-level manipulation of the registers.

No, there is no method to do this in the source of the serial driver in the main Arduino repository, but it shouldn't be too hard to add one, which checks either the software-maintained buffer or the hardware register of the UART itself, or both, according to your need.

If you use SoftwareSerial then definitely not. With HardwareSerial that could be possible but you'd have to change the source code yourself.

It doesn't look like that function is implemented. The source for HardwareSerial.{cpp,h} are in /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino under OS-X. (Someone better versed in Window than I may have to chime in here to point you to that source location.)
Taking HardwareSerial::available() as a model, create a new function, say, HardwareSerial::txremaining(), that does the same thing, but for the transmit buffer.
Left as an exercise for the student:Make a common function that returns the contents of an arbitrary ring-buffer and use it in both ::available() and ::txremaining().


text:
Formatting and code errors?
Hello I have managed to get both the Adafruit Datalogging shield walk-through and this individual code working http://www.learn.parallax.com/reed-switch-arduino-demo separately, but trying to combine the two together I get these errors. I think I have it all arranged correctly but any help would be greatly appreciated. Board Arduino Uno and Adafruit Datalogger shield.
Errors:
Temp_and_Reed_Switch_data_logging_shield.ino:55:1: error: 'Serial' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:58:8: error: expected constructor, destructor, or type conversion before '(' token
Temp_and_Reed_Switch_data_logging_shield.ino:61:1: error: expected unqualified-id before 'if'
Temp_and_Reed_Switch_data_logging_shield.ino:66:1: error: 'Serial' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:70:1: error: expected unqualified-id before 'for'
Temp_and_Reed_Switch_data_logging_shield.ino:70:21: error: 'i' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:70:30: error: 'i' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:80:1: error: expected unqualified-id before 'if'
Temp_and_Reed_Switch_data_logging_shield.ino:84:1: error: 'Serial' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:85:1: error: 'Serial' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:87:1: error: 'Wire' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:88:1: error: expected unqualified-id before 'if'
Temp_and_Reed_Switch_data_logging_shield.ino:95:1: error: 'logfile' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:97:1: error: 'serial' does not name a type
Temp_and_Reed_Switch_data_logging_shield.ino:98:1: error: expected unqualified-id before 'if'
Temp_and_Reed_Switch_data_logging_shield.ino:104:8: error: expected constructor, destructor, or type conversion before '(' token
Temp_and_Reed_Switch_data_logging_shield.ino:105:8: error: expected constructor, destructor, or type conversion before '(' token
Temp_and_Reed_Switch_data_logging_shield.ino:107:8: error: expected constructor, destructor, or type conversion before '(' token
Temp_and_Reed_Switch_data_logging_shield.ino:108:13: error: expected constructor, destructor, or type conversion before '(' token
Temp_and_Reed_Switch_data_logging_shield.ino:114:1: error: expected declaration before '}' token
Multiple libraries were found for "SD.h"

 Used: C:\Users\Andrew\Documents\Arduino\libraries\SD

 Not used: C:\Program Files (x86)\Arduino\libraries\SD

'Serial' does not name a type

Program:
//  SD card datalogger
// SD card attached to SPI bus as follows:
// MOSI - pin 11
// MISO - pin 12
// CLK - pin 13
// CS - pin 10

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

#define LOG_INTERVAL  1000 // mills between entries
#define ECHO_TO_SERIAL   1 // echo data to serial port
#define WAIT_TO_START    0 // Wait for serial input in setup()

// the digital pins that connect to the LEDs
#define redLEDpin 4
#define greenLEDpin 5

// The analog pins that connect to the sensors

#define tempPin 1                // analog 1

RTC_DS1307 RTC; // define the Real Time Clock object
const int chipSelect = 10;
const int switchPin = 2;     //     // Reed switch to digital pin 2

// the logging file
File logfile;

void error(char *str)
{
  Serial.print("error: ");
  Serial.println(str);

  // red LED indicates error
  digitalWrite(redLEDpin, HIGH);

  while (1);
}
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  Serial.println();
  //If we set WAIT_TO_START to anything but 0, the Arduino will wait until the user types something in.
#if WAIT_TO_START
  Serial.println("Type any character to start");
  while (!Serial.available());
#endif //WAIT_TO_START
}

// initialize the SD card
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);

// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
  Serial.println("Card failed, or not present");
  // don't do anything more:
  return;
}
Serial.println("card initialized.");

// create a new file on SD Card called Logger number
char filename[] = "LOGGER00.CSV";
for (uint8_t i = 0; i < 100; i++) {
  filename[6] = i / 10 + '0';
  filename[7] = i % 10 + '0';
  if (! SD.exists(filename)) {
    // only open a new file if it doesn't exist
    logfile = SD.open(filename, FILE_WRITE);
    break;  // leave the loop!
  }
}

if (! logfile) {
  error("couldnt create file");
}

Serial.print("Logging to: ");
Serial.println(filename);

Wire.begin();
if (!RTC.begin()) {
  logfile.println("RTC failed");
#if ECHO_TO_SERIAL
  Serial.println("RTC failed");
#endif  //ECHO_TO_SERIAL
}

logfile.println("millis,time,temp,reedswitch");
#if ECHO_TO_SERIAL // attempt to write out the header to the file
serial.println("millis,time,temp,reedswitch");
if (logfile.writeError || !logfile.sync()) {
  error("write header");
#endif   //ECHO_TO_SERIAL
}

pinMode(redLEDpin, OUTPUT);
pinMode(greenLEDpin, OUTPUT);

pinMode(switchPin, INPUT);        // switchPin is an input
digitalWrite(switchPin, HIGH);    // Activate internal pullup resistor
long lastDebounce1 = 0;
long debounceDelay = 500;    // Ignore bounces under 1/2 second

// If you want to set the aref to something other than 5v
//analogReference(EXTERNAL);
}

void loop(void)
{
  DateTime now;

  // delay for the amount of time we want between readings
  delay((LOG_INTERVAL - 1) - (millis() % LOG_INTERVAL));

  digitalWrite(greenLEDpin, HIGH);

  // log milliseconds since starting
  uint32_t m = millis();
  logfile.print(m);           // milliseconds since start
  logfile.print(", ");
#if ECHO_TO_SERIAL
  Serial.print(m);         // milliseconds since start
  Serial.print(", ");
#endif

  // fetch the time
  now = RTC.now();
  // log time
  logfile.print(now.get()); // seconds since 2000
  logfile.print(", ");
  logfile.print(now.year(), DEC);
  logfile.print("/");
  logfile.print(now.month(), DEC);
  logfile.print("/");
  logfile.print(now.day(), DEC);
  logfile.print(" ");
  logfile.print(now.hour(), DEC);
  logfile.print(":");
  logfile.print(now.minute(), DEC);
  logfile.print(":");
  logfile.print(now.second(), DEC);
#if ECHO_TO_SERIAL
  Serial.print(now.get()); // seconds since 2000
  Serial.print(", ");
  Serial.print(now.year(), DEC);
  Serial.print("/");
  Serial.print(now.month(), DEC);
  Serial.print("/");
  Serial.print(now.day(), DEC);
  Serial.print(" ");
  Serial.print(now.hour(), DEC);
  Serial.print(":");
  Serial.print(now.minute(), DEC);
  Serial.print(":");
  Serial.print(now.second(), DEC);
#endif //ECHO_TO_SERIAL

  delay(10);
  int tempReading = analogRead(tempPin);

  // converting that reading to voltage, for 3.3v arduino use 3.3
  float voltage = tempReading * 5.0 / 1024;
  float temperatureC = (voltage - 0.5) * 100 ;

  logfile.print(", ");
  logfile.println(temperatureC);
  logfile.print(", ");
  logfile.print(reedswitch);
#if ECHO_TO_SERIAL

  Serial.print(", ");
  Serial.println(temperatureC);
  Serial.print(", ");
  Serial.print(reedswitch);
#endif //ECHO_TO_SERIAL

  digitalWrite(greenLEDpin, LOW);
}

Everything you have written between the end of setup() (line 55) to the start of loop() (line 117) is not in a function.
If you are struggling to combine two or more programs, start small and work your way to the full code.

Building furhter onto @CharlieHanson's answer, what you should do in order to fix this is probably following changes (please note that I wrote this in order to try to get rid of the errors, the flow of the program may still not be correct, that depends entirely on how you put together the code from the files):
1. Remove the bracket at line 52, just a few lines down in the setup()-method, below this code:
#endif //WAIT_TO_START

2. (Maybe not nessecary, but for manageability) Move this code:
long lastDebounce1 = 0;
long debounceDelay = 500;

-from where it currently is (just a few lines above the beginning of the loop()-method) to the other variable declarations (above the error()-method).


text:
How to apply a programme to all values in a list simultaneously
I'm attempting to turn on a set of LED's one at a time and then switch them all off at the same time, I am stuck however on turning them off at the same time.
That is my code:
int ledpins[] = {2,3,4,5,6,7,8,9}; //creates a list of the pins in use

void setup() {
  for (int i = 0; i < 8; i++){
    pinMode(ledpins[i], OUTPUT);  // iterates over the list led pins from the 0 pin to the pins before the eigth
  }
}

void loop() {
  for (int i = 0; i < 8; i++){
    digitalWrite(ledpins[i], HIGH); // turns all the pins of one at a time
  }

  delay(100); //when all on will wait 100 ms
  digitalWrite(ledpins[0,7], LOW); //turns off all the leds at once
  delay(100);
}

The annotations are for my own understanding.
I just need help turning all the LED's off at once which I dont know the command for.

You have already done it twice, why are you struggling the third time?
for (int i = 0; i < 8; i++){
  digitalWrite(ledpins[i], HIGH); // turns all the pins of one at a time
}

// turns all the pins of one at a time

Except that it is happening so fast you can't see then doing it individually. So just do the same but set them to LOW:
for (int i = 0; i < 8; i++){
  digitalWrite(ledpins[i], LOW); // turns all the pins off one at a time
}

Now you might want to add a delay into the loop that turns them on so you can see them turn on individually instead of all at once:
for (int i = 0; i < 8; i++){
  digitalWrite(ledpins[i], HIGH); // turns all the pins of one at a time
  delay(50);
}

There is another approach that is to use direct port manipulation. It is a lot faster than using digitalWrite in the sense that it requires less clock cycles to execute and allows you to change one port at a time (the UNO has 3 ports called D, B and C). You can find an introduction to port manipulation on this page: https://www.arduino.cc/en/Reference/PortManipulation
Here is an example that toggles the LED you chose:
void setup()
{
    DDRD |= B11111100; // Pin 2 to 7 as outputs
    DDRB |= B00000011; // Pin 8 to 9 as outputs
}

void loop()
{
    // Pin 2 to 7 HIGH
    PORTD |= ( 1<<2 ) | ( 1<<3 ) | ( 1<<4 ) | ( 1<<5 ) | ( 1<<6 ) | ( 1<<7 );
    // Pin 8 to 9 HIGH
    PORTB |= ( 1<<0 ) | ( 1<<1 );

    _delay_ms( 500 );

    // Pin 2 to 7 LOW
    PORTD &= ~( 1<<2 ) & ~( 1<<3 ) & ~( 1<<4 ) & ~( 1<<5 ) & ~( 1<<6 ) & ~( 1<<7 );
    // Pin 8 to 9 LOW
    PORTB &= ~( 1<<0 ) & ~( 1<<1 );

    _delay_ms( 500 );
}


text:
7 Key Educational Piano with Capacitive Sensor
I am working on a project for grade 10 computer science.  I am supposed to make a piano that has 7 keys using a capacitive sensor, and the piano is supposed to teach you songs like Twinkle Twinkle Little Star by illuminating the LED corresponding with that key and then playing that tone on the speaker.  There is also a "random scales" part where you are timed and have to press the keys as fast as you can as they light up.  Unfortunately, I have come into a few problems.

I ran out of outputs and have to use a shift register. I have no idea on how to control each of the outputs.
When the game starts I want there to be 2 options a song and a random scales using randomSeed however I have NOT found a way for them to pick which option. I think I can do user input by typing or by them just pressing a key but I am not sure.
I am pretty new on Arduino so anything helps.

Finally I am using the Arduino Uno and that is why I am short pins because I have 1 gnd 1 speaker and the rest key inputs.

Are you sure you've run out of pins? Did you know you can use the analog pins as digital IO as well?

Thanks I didn't know about the analog, but there are only 6 analog pins and I need 7. Could I use one digital with 6 analog

Unfortunately you can't use digital pins as analog. If you need more analog inputs you'll probably need an external ADC (a shift register won't work for that).

I count 7 sense pins, 7 led pins, and one speaker pin. That is 15 digital pins. The uno has 18 pins available (don't use 0 and 1, as they are used for serial). Analog pins can be used as a regular digital pin. Your setup doesn't need the analogRead capability of the analog pins.

Thanks I did end up using a shiftregister I had got theL LED's corresponding w/ the keys fo

Thanks I did end up using the shift register and the have the LED's corresponding w/ the keys to show the user where to press. I need to find a way to see if the participant actually pressed the right keys and to hopefully give them a score at the end.


text:
Arduino circuit diagram help
I'm new to the arduino and to EE in general. I've built the basic examples and a, now trying to get a deeper understanding of what the physics is doing. As such, I'd like some help in understanding the diagram here:
https://www.arduino.cc/en/Tutorial/Blink
Question 1:
Specifically,it seems that the flow is going from Pin 13 to Ground. Is the diagram using the conventional flow or the electron flow approach.
Specifically, is it the electrons flowing from Pin 13 to ground or does the diagram show protons flowing? It seems that its showing the electron flow as the diagram has the anode attached to the resistor so the electrons flow from the pin to the resistor to the positive end (anode) of the LED.
Question 2:
This is about bread boards, like one shown here:
https://www.google.com/search?q=arduino+breadboard&biw=1696&bih=988&tbm=isch&tbo=u&source=univ&sa=X&ved=0CFEQsARqFQoTCIjsw5WhkMgCFdWYiAodttcKIw#tbm=isch&q=breadboard&imgrc=KwnTrtjnYJdB1M%3A
1) Would I connect Pin 13 (or say the 5V pin) to the + (the red line). Then I would connect the blue line (the -) to the ground on the arduino? Do I need to connect the blue line?
2) Also, is it again the electron flow notation so that from Pin 13, the electrons flow to the + (red), then to one of the lettered columns and then to whatever component I have?
Thank you for your help! I realize these are basic questions but I want to go a little beyond building the examples and start trying things out myself. As such I want to make sure I'm getting the theory behind it right!

This is not really about Arduino, it is about electronics theory. You might get a more extensive explanation of things like which way electrons flow from  the Electronics Engineering Stack Exchange.

The thing to remember about electrons is they are a negative charge.  That means that the direction of current flow (positive charge) is opposite to the direction of flow of the actual electrons (negative charge). Picture it like those "compression jams" you get on the motorway (freeway) where cars that are travelling too close together have to slam their breaks on to avoid running into each other.  The one at the front slams its breaks on briefly then carries on. The one behind has to do the same, and so on and so forth.  You then get a wave effect travelling in the opposite direction to the direction of travel of cars as they slam their breaks on in turn.  The cars are moving forwards, but the compression jam is moving backwards.  Similar in a circuit - the electrons are moving forward, but the charge is moving backwards.
Another way to visualize it is as a bubble in a pipe of stationary water.  The bubble moves in one direction, but in order for it to do that the water has to flow past the bubble in the opposite direction.*
So the current flows out of pin 13 through the LED and to ground, but the electrons themselves are actually flowing from ground through the LED and in to pin 13 (where they eventually return back to ground through the power supply).
For how the IO pin works it's best to picture it as a pair of switches - one connected to Vcc and one connected to GND.  For instance, this is the LED wired up with the IO pin set to HIGH:

You can see that S1, being on, forms a circuit between the battery and the LED to allow the current to flow.
When the IO pin is set to LOW the circuit looks a bit like this:

You see that S1 is now turned off, and S2 is turned on.  the connection from that battery is now broken, and current can't flow.
But, you ask, what is the point of S2 here? It doesn't actually do anything.  No, not in that circuit it doesn't. But consider if you re-arrange the circuit to be like this:

Now it's S2 that is controlling the connection to the battery.  S1 is now the redundant switch.
This leads to some terminology.
When S1 is closed the IO pin is said to source current since it is pretty much connected directly to the positive power source.
When S2 is closed instead the IO pin is said to sink current since it is connected to ground, so current can "sink" down to ground through it.
As far as breadboards are concerned - they are just collections of metal strips that are used to join wires and component leads together in whatever way you need to.  There is no one part of it that is any different to any other, and there is nothing that says you must use this bit in a certain way, or that bit in another way.
Your typical breadboard has sprung metal clips that are arranged in this pattern:

You can use any collection of holes for any purpose you choose.
That said, normally the blue (or black) marked line of holes down each side is used for ground, and the red line of holes is used for power.  As both sides of the board are separate it is possible to use different voltages on each side, or the same voltage on both sides, etc.  That can be especially useful when you're working on a circuit that has, say, +3.3V and +5V in it.  Another common split usage is for a positive voltage on one side and a negative voltage on the other - common when working with op-amps.  Just remember which is which.

* This is a complete lie, but it's as close as you need to know at this point in your education. https://en.wikipedia.org/wiki/Lie-to-children

So if the electrons leave ground, then from the first diagram, the thing they hit is the LED before it hits the resistor. Is that not a problem in that too much voltage is going through the LED? I understand it's a series circuit, but to be safe, wouldn't it make more sense to have it before the LED?

@user1357015 No, because the LED and resistor are in series. At all points in the circuit the current is equal. It's only the voltage that changes at different points in the circuit.

@user1357015 Theory to learn: https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws#Kirchhoff.27s_current_law_.28KCL.29

But what would actually burn out the LED? The voltage or the Current? I'm a little confused why it can't be either. If there's too much force (voltage) it breaks (similar to how a water wheel would break if spun to fast)? If there are too many coulombs/sec (current) it breaks as well? Or are you saying that since I = V/R, that since the resistor is there, regardless of how the voltage drops, the current through the circuit is always the same?

The LED will blow if too much current flows through it. That is the only reason it will blow. It is what is called a non-linear device in that it doesn't (directly) obey Ohm's Law.  it has a fixed voltage drop (Vf) which is used in conjunction with the resistor and Ohm's law (applied to the resistor) to limit the amount of current that is able to flow.  Think of the current as the chain on a bicycle. You can't have more chain in one place than in another. Apply the brakes to the bike wheel (resistor) and the whole chain movement is slowed.

@user1357015 In its crudest form an LED has a fixed voltage drop (say 2V) and zero resistance.  Connect that to a voltage source with no limit on current and Ohm's law says I=V/R.  Since R = 0, no matter what V is (except 0), the answer is infinity. That's infinity amps.  So you put the resistor in to make Ohm's law work. But the resistor only sees a part of the overall voltage because the LED has stolen some. So you have I=(V-Vf)/R.

Ah, I get it. The LED uses some of the potential energy in the voltage to light itself. Then there's (V-Vf) left. However, the energy is 'carried' by the current (by the energetic Coulombs/Second). Too much current means to much energy delivered to the LED & it blows. Enough current, means there's enough energy delivered that it can safely convert the potential energy of the current to the light energy that we see. Is that about right?

Regarding current flow -- I've read about about the notation set by Franklin. So in your analogy, I can think of as the negative current flows from the ground to the LED 13. However, as that happens, the ground becomes more positive "albeit imperceptibly from an observer on the ground*. Thus, that's the same thing as thinking as the positive flow (current) goes from the pin to the ground. Although this doesn't actually happen (as it's the electrons) that are moving, logically, either one can be considered the same?

@user1357015 That's about it, yep! The resistor is the device that throttles the coulombs/second for you, which stops the LED from getting too much.  In actual fact the LED blowing is all about heat. Too much current = too much heat produced = bits inside melt.

@user1357015 Unless you're working with quantum physics there's no real benefit to knowing what the electrons are doing. All you need concern yourself with is the current flow. Leave the electrons to the likes of Hawking.

@user1357015 Also the slight change in charge of the ground is instantly nullified by electrons flowing from the negative terminal of the battery (or whatever your power source is). Like I said - bike chain. The whole lot moves together, and the battery is the pedals.

would you mind adding in your circuit diagram where the vcc and ground are?

They are implicit in the orientation of the battery.

In the Arduino world we work with positive voltages so therefore the + side of the battery is Vcc and the - side is ground. There are devices that work the other way around (negative voltage regulators spring to mind) but in general you can expect that Vcc is more positive than ground when working with digital electronics.

And ground itself is just any arbitrary point of the circuit you choose to measure voltages relative to. For convenience it's most often the most negative point of the circuit.

It doesn't matter whether you use conventional current or electron current to describe a circuit; in the end they give the same results.
Protons are not a charge carrier in 99.99999% of circuits; positive charge carriers are the quasiparticles known as holes, but they only flow in semiconductors.
The power rails on a breadboard should be used for power only, never signals. It is possible to use them for other things, and it is possible to not use them at all, but when they are used they should only be used for supply in order to cause the least confusion.

Protons don't flow. They are part of the atom nucleus. If they flowed the copper wire would be flowing. Electrons are what flow, particularly if there are some free ones hanging around, like teenagers hanging around a mall.
You don't need to worry about that however. Most people think of current as flowing from positive to negative (ie. pin 13 to ground) even if in fact the electrons are flowing from ground to pin 13.
See Conventional Versus Electron Flow. I quote:

When Benjamin Franklin made his conjecture regarding the direction of charge flow (from the smooth wax to the rough wool), he set a precedent for electrical notation that exists to this day, despite the fact that we know electrons are the constituent units of charge, and that they are displaced from the wool to the wax—not from the wax to the wool—when those two substances are rubbed together. This is why electrons are said to have a negative charge: because Franklin assumed electric charge moved in the opposite direction that it actually does, and so objects he called “negative” (representing a deficiency of charge) actually have a surplus of electrons.
By the time the true direction of electron flow was discovered, the nomenclature of “positive” and “negative” had already been so well established in the scientific community that no effort was made to change it, although calling electrons “positive” would make more sense in referring to “excess” charge. You see, the terms “positive” and “negative” are human inventions, and as such have no absolute meaning beyond our own conventions of language and scientific description. Franklin could have just as easily referred to a surplus of charge as “black” and a deficiency as “white,” in which case scientists would speak of electrons having a “white” charge (assuming the same incorrect conjecture of charge position between wax and wool).

Quote courtesy of Design Science under this license.

Would I connect Pin 13 (or say the 5V pin) to the + (the red line). Then I would connect the blue line (the -) to the ground on the arduino? Do I need to connect the blue line?

When using a breadboard I connect the 5V pin to the red line, the Gnd pin to the blue line, and other things (signals) to the internal (numbered) holes. The internal ones are connected cross-ways, so that is useful, for example, to put a series resistor for the LED there.
I trust you are using a resistor for the LED, if not you might damage both the LED and the Arduino. See The care and feeding of LEDs.

I am using a resistor yes. Right, so if I have the 13 signal connected to a lettered whole, does that not mean that the arduino is feeding electrons from the 13 pin TO the resistor, the resistor then feeds the electrons TO the LED and the LED then feeds the electrons to the Ground? Specifically, it is the Electrons leaving pin 13 yes? That is why the anode is connected next to pin 13 -- electrons flow to the positive end of the diode?

No, the electrons leave ground and head towards the positive side (pin 13). You don't really need to worry about which way the electrons move. In what way will that change what you are doing? I personally think of current leaving pin 13, going through the resistor, then the LED and then to ground. Strictly speaking though, the electrons are going the opposite way.


text:
What I should be aware before I touch my Arduino?
Before you start to mess with a computer there are basic guidelines to be aware of, such as turn the power off and watch out for static electricity. What guidelines should I be aware of when I work with an Arduino board if I don't want to harm neither myself nor the board. The three kind of activity that requires touching the Arduino and what I'm asking about:

Setting up wire, component layout or breadboard.
Debugging a running setup.
Moving, mounting up the board somewhere.

Before you do anything to your board, as with most electronics, turn them off before you start tinkering with them. Do this as well when you are setting up wire and adding components, you don't want to accidentally short anything. With Arduinos it is like any other electronics device, keep away from water, protect it from falling/hard collisions, make sure you have been grounded before touching components or wires, etc.
Try not to let the magic smoke out

One quick tip that I saw someone mention before: don't turn on your Arduino when it's resting on a conductive surface: the soldered pieces on the back of the circuit board could short out. ;)

@anorton Actually one of the first things I do with an Arduino is attaching some stick-on feet or couple screw feet under them to protect my desk from being scratched and prevent the Arduino from touching anything metal on my desk. Apart from being safe, it also looks good.

First step is read the manual!

If the board is mounted on a metal frame, perhaps on a robot, and you're drilling new holes into the frame, then make sure the board and all electronics are covered with a cloth, to prevent getting metal chips in places they should never go.

Turning the power off and taking proper static precautions also applies to Arduinos.  Anorton's tip about not resting it on a conductive surface is also useful.  Some other things to keep in mind:

Double check the polarities of any connections you make.
Keep a consistent wiring color code.  Use red for power and black for ground.
Calculate the expected current through all components before you apply power.  Check the datasheet to make sure it's within safe limits.
Calculate the heat dissipation for higher power components like power supplies and motor drivers.
Connect and test one small part at a time, instead of in one big bang.
Make sure the parts you buy expect the same voltage, or perform the appropriate conversion.

For keeping people safe:

Know where the fire extinguisher is.
Don't put cords where people can trip on them.
Use a proper stand to hold your soldering iron, and keep pets and small children away.
If your project has a propeller or something physically dangerous, build failsafes and kill switches into the system.
Be careful to charge any batteries properly, and not let them overheat.
Be careful what you touch while troubleshooting.  Arduinos usually don't deal with very high voltages, but inductors and capacitors can build up higher charges than you expect, and hold it after power is removed.

Know where the fire extinguisher is. Wow... I don't know that I would go that far.

Depends what you're doing @AnnonomusPerson.  If you're just writing code to blink an LED, and you're powering off of USB, a fire is unlikely.  Working with soldering irons, rechargeable batteries, or high-current bench supplies makes fire a real danger.

@AnonymousPenguin "Knowing where the fire extinguisher is" is pretty recommended even if you don't work with Arduinos.

One of the most common bad things I have seen is connecting LEDs directly to addition pins without a current limiting resistor.
Basically, in electronics there are a few main sources of problems. Too much current, too much voltage, overheating, and physical damage.
Too much current usually comes from shorting things, too much voltage(or reversed polarity) usually comes from not paying attention to what is being connected, overheating comes from too much current or not using a heatsink when you should be.
Basically, just think before you connect things and you'll be fine. Learn some basic circuit theory if you haven't already, get in the habit of knowing the ratings of the parts you want to use, and double check stuff before turning it on.
I like this list here of things not to do: http://ruggedcircuits.com/html/ancp01.html


text:
Grove sensors without a Grove shield
There exists a large variety of sensors in the Grove System. Usually these are accessed via a special shield (Grove base shield).
Can I access these sensor directly without a shield. In particular I am interested in using them with an Arduino Pro Mini. My guess is that one definitely needs the 5V version of the Mini, but other than this? How fiddly is it to use these sensors directly?
I am interested in using the Grove dust sensor, but I am also would like to operate a Grove 4 digit display.

From the wiki.
Above is a schematic of a Groove shield. You can see that each of the connectors has two digital pins connected to it and then V (5V) and G (GND). The last two you can connect normally to an Arduino. The first two you connect to the pins that are used in your sketch.
Say it says to connect the connector to the top left DIGITAL pin on the board (D6/D7). You'll 7want to connect the pins as followed: Black → GND, Red → 5V, White → D7, and Yellow → D6.

Notes:

The shield overlaps the pins (i.e. 3-4, 4-5), so that might make things confusing. I think that is a design flaw. If it needs two pins, it should have two connectors. In the current state, you can connect two things together. I don't really know how to figure out if it uses all of the ports attached or not. If you don't have to, I would try not to overlap any two grooves. You would do this by using two digital ports for every groove "module."
You'll also need to have a adapter cable (Link from TheDoctor's Answer.)
For analog connections, it applies the same way as digital. G is ground, V is 5v, and A# is an analog pin.

Inferencing it:
There's no real cookie cutter way to connect to them. However, the wiki seems to be a decent resource once you figure out how to navigate it. The dust sensor you mentioned seems to ONLY use digital pin 8. It was connected to the D7/D8 connector on the Groove shield, so the yellow wire could be ignored since it was never used in the sketch.
It's hard to do much with this system: it's poorly documented and not uniform at all. Plus, some boards could cause problems that could even lead to damaging components. I would say look at something else.

This dust sensor seems pretty good, minus the documentation. On this blog, they say to do this:

Sharp pin 1 (V-LED)   => 5V (connected to 150ohm resister) Sharp pin 2
(LED-GND) => Arduino GND pin Sharp pin 3 (LED)     => Arduino pin 2
Sharp pin 4 (S-GND)   => Arduino GND pin Sharp pin 5 (Vo)      =>
Arduino A0 pin Sharp pin 6 (Vcc)     => 5V

I can't seem to find the cord for it, but I'm sure there are many others like this online. (It lists the cable needed: a 6-pin, 1.5mm pitch connector. That doesn't seem too hard to find).

Here is a 4x7 segment display for much cheaper. It does use a lot of pins and need resistors, but multiplexing and resistors aren't that hard to figure out. That's outside of the scope of this question. There might be some other board with a built in IC for controlling a display like that, but I can't seem to find one now.

Grove sensors use a special socket, a 4 pin JST with two power lines and two data. you would have to make your own board/terminal to get them to connect to a mini.
What you could do is use a Grove proto board, which converts the JST terminals onto .1" pins suitable for connecting to the Mini. There is also a litle proto area if you want it.
You could also use an adapter cable, which would not have a bulky protoboard along with it. The terminals could be soldered directly to the Mini.

I was thinking of using an adapter cable - hooking up the grove sensor does not seem such a big problem. However how can I access/communicate with them?

@A.Schulz: Exactly the same way as if the Grove connector wasn't there. The hardware is still the same, only the pins have been changed.

Not every Grove sensor uses all 4 wires. Most of the basic analog ones use SIG,NC,VCC,GND - where NC means Not Connected. On the Seeed Studio wiki, they publish Eagle files for most of the sensors. If you check them, you'll confirm NC is not connected to anything.

The reason some are 3 and 4 wires is so they can use a common connector. If you use a 4 wire sensor, such as an I2C sensor, you cant use the adjacent socket on your Grove base shield, as adjacent sockets share 1 pin. Socket labelled D4 contains pins D4,D5. Socket labelled D5 contains D5,D6. D5 is common between the two sockets.

I'm pretty sure you could just take the signal cable from the dust sensor and plug it directly into your mcu digital pin of choice and then wire the Vcc and Gnd as well.  I'm working with a CO2 sensor and don't really want the shield overhead.


text:
Why do sketches take up so much space and memory?
When I compile this sketch for the Yún:
int led = 7;

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

void loop() {
  digitalWrite(led, HIGH);
}

I get:

Sketch uses 5,098 bytes (17%) of program storage space.
Maximum is
  28,672 bytes. Global variables use 153 bytes (5%) of dynamic memory,
  leaving 2,407 bytes for local variables. Maximum is 2,560 bytes.

Even when I compile the BareMinimum sketch:
void setup() {
  // setup
}

void loop() {
  // loop
}

I get:

Sketch uses 4,548 bytes (15%) of program storage space.
Maximum is
  28,672 bytes. Global variables use 151 bytes (5%) of dynamic memory,
  leaving 2,409 bytes for local variables. Maximum is 2,560 bytes.

Why does a bare minimum sketch take up 15% of the program storage space allocated? And why does a very simple sketch take up 17% of the program storage space? According to the Arduino website:

It's easy to use it all up by having lots of strings in your program.
  For example, a declaration like: char message[] = "I support the Cape
  Wind project."; puts 33 bytes into SRAM (each character takes a byte,
  plus the '\0' terminator).

However, there aren't any strings declared in either of these sketches.
It seems as if they might import or use other libraries/classes that I don't specify. Maybe it imports a system default library? Or is it something else?

The YUN is a combo. Part Arduino and Part OpenWRT(Linux). Your question is in reference to the Arduino. Where this is actually a ATmega32u4 similar to a Leonardo and not an UNO(ATmega328p). The 32u4(Leo) communicates via Virtual Serial Ports over the USB (short answer: this needs to be supported) , where the UNO has a real Serial Port (aka UART). Below are builds statistics of the different boards types for the AVR processors.
Note on the UNO there is an external chip that converts USB to the Serial port's DTR pin which toggles the ATmega328's reset pin when connected causing a reboot to the bootloader. In contrast the Leo/Yun's USB to Serial is in implemented in the firmware of the 32u4. Hence in order to remotely reboot the Leo or YUN's 32u4 chip the firmware loaded must always support the USB client side driver. Which consumes approximately 4K.
If the USB was NOT needed and no other library resources were called as in the case of BareMinimum.ino on an UNO, only approximately 466 bytes are needed for the core Arduino Library.
compile stats of BareMinimum.ino on a UNO(ATmega328p)
Sketch uses 466 bytes (1%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.

compile stats of BareMinimum.ino on a Leonardo(ATmega32u4)
Sketch uses 4,554 bytes (15%) of program storage space. Maximum is 28,672 bytes.
Global variables use 151 bytes (5%) of dynamic memory, leaving 2,409 bytes for local variables. Maximum is 2,560 bytes.

compile stats of BareMinimum.ino on a Yun(ATmega32u4)
Sketch uses 4,548 bytes (15%) of program storage space. Maximum is 28,672 bytes.
Global variables use 151 bytes (5%) of dynamic memory, leaving 2,409 bytes for local variables. Maximum is 2,560 bytes.

Arduino compiles in a lot of standard libraries, interrupts, ... etc. For example the pinMode and digitalWrite functions use a lookup table to figure out at run time which GPIO registers to write data to. Another example is that Arduino keeps track of time, it defines some interrupts by default and all this functionality requires some space. You'll notice that if you extend the program, the foot print will only change slightly.
I personally like to program controllers with bare minimum, without "bloat", but you'll quickly enter the world of EE.SE and SO because several easy to use functions will no longer work out of the box. There are some alternative libraries for pinMode and digitalWrite that compile into a smaller footprint, but come with other disadvantages like for example static compiled pins (where led cannot be a variable, but is a constant).

So basically it compiles in all sorts of standard libraries without you asking? Neat.

Yes, I usually call it "bloat", but it is really a usability thing. Arduino is a low entry level environment that just works without too much thought. If you need more, Arduino allows you to use alternative libraries or you can compile against bare metal. The last is probably out of scope for Arduino.SE

See my @mpflaga answer. There is not as much bloat. Or at least in the core library for bare minimum functionality. There is not really much of any standard libraries included, unless called the sketch. Rather the 15% is due to the USB support of the 32u4.

You already have some perfectly good answers. I am posting this only to
share some stats I did one day I asked myself the same sort of
questions: What is taking so much space on a minimal sketch? What is the
minimum needed to achieve the same functionality?
Below are three versions of a minimal blinky program that toggles the
LED on pin 13 every second. All three versions have been compiled for an
Uno (no USB involved) using avr-gcc 4.8.2, avr-libc 1.8.0 and
arduino-core 1.0.5 (I do not use the Arduino IDE).
First, the standard Arduino way:
const uint8_t ledPin = 13;

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

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

This compiles to 1018 bytes. Using both avr-nm and
disassembly,
I broke down that size into individual functions. From
largest to smallest:
 148 A ISR(TIMER0_OVF_vect)
 118 A init
 114 A pinMode
 108 A digitalWrite
 104 C vector table
  82 A turnOffPWM
  76 A delay
  70 A micros
  40 U loop
  26 A main
  20 A digital_pin_to_timer_PGM
  20 A digital_pin_to_port_PGM
  20 A digital_pin_to_bit_mask_PGM
  16 C __do_clear_bss
  12 C __init
  10 A port_to_output_PGM
  10 A port_to_mode_PGM
   8 U setup
   8 C .init9 (call main, jmp exit)
   4 C __bad_interrupt
   4 C _exit
-----------------------------------
1018   TOTAL

In the list above, the first column is the size in bytes, and the second
column tells whether the code comes from the Arduino core library (A,
822 bytes total), the C runtime (C, 148 bytes) or the user (U, 48
bytes).
As can be seen in this list, the largest function is the routine
servicing the timer 0 overflow interrupt. This routine is responsible of
tracking time, and is needed by millis(), micros() and delay().
The second largest function is init(), which sets the hardware timers
for PWM, enables TIMER0_OVF interrupt and disconnects the USART (that
was used by the bootloader). Both this and the previous function are
defined in
<Arduino directory>/hardware/arduino/cores/arduino/wiring.c.
Next is the C + avr-libc version:
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRB |= _BV(PB5);     /* set pin PB5 as output */
    for (;;) {
        PINB = _BV(PB5);  /* toggle PB5 */
        _delay_ms(1000);
    }
}

The break-down of the individual sizes:
104 C vector table
 26 U main
 12 C __init
  8 C .init9 (call main, jmp exit)
  4 C __bad_interrupt
  4 C _exit
----------------------------------
158   TOTAL

This is 132 bytes for the C runtime and 26 bytes of user code, including
the inlined function _delay_ms().
It could be noted that, since this program does not use interrupts,
the interrupt vector table is not needed, and regular user code
could be put in its place. The following assembly version does exactly
that:
#include <avr/io.h>
#define io(reg) _SFR_IO_ADDR(reg)

    sbi io(DDRB), 5  ; set PB5 as output
loop:
    sbi io(PINB), 5  ; toggle PB5
    ldi r26, 49      ; delay for 49 * 2^16 * 5 cycles
delay:
    sbiw r24, 1
    sbci r26, 0
    brne delay
    rjmp loop

This is assembled (with avr-gcc -nostdlib) into only 14 bytes,
most of which are used to delay the toggles so that the blink is
visible. If you remove that delay loop, you end up with a 6-byte
program that blinks too fast to be seen (at 2 MHz):
    sbi io(DDRB), 5  ; set PB5 as output
loop:
    sbi io(PINB), 5  ; toggle PB5
    rjmp loop

I wrote a post about Why does it take 1000 bytes to blink one LED?.
The brief answer is: "It doesn't take 2000 bytes to blink two LEDs!"
The longer answer is that the standard Arduino libraries (which you don't have to use if you don't want to) have some nice functionality to simplify your life. For example, you can address pins by number at runtime, where the library converts (say) pin 8 to the correct port and correct bit number. If you hard-code port access you can save that overhead.
Even if you don't use them, the standard libraries include code to count "ticks" so you can find out the current "time" (by calling millis()). To do this it has to add the overhead of some interrupt service routines.
If you simplify down (on the Arduino Uno) to this sketch you get the program memory usage down to 178 bytes (on IDE 1.0.6):
int main ()
  {
  DDRB = bit (5);
  while (true)
    PINB = bit (5);
  }

OK, 178 bytes isn't that much, and of that the first 104 bytes are the hardware interrupt vectors (4 bytes each, for 26 vectors).
So arguably, there are only 74 bytes required to blink an LED. And of that 74 bytes most are really the code generated by the compiler to initialize global memory. If you add enough code to blink two LEDs:
int main ()
  {
  DDRB = bit (5);  // pin 13
  DDRB |= bit (4);  // pin 12

  while (true)
    {
    PINB = bit (5); // pin 13
    PINB = bit (4); // pin 12
    }
  }

Then the code size increases to 186 bytes. So therefore you could argue that it only takes 186 - 178 = 8 bytes to blink an LED.
So, 8 bytes to blink an LED. Sounds pretty efficient to me.

In case you are tempted to try this at home, I should point out that whilst the posted code above blinks two LEDs, it does so very rapidly indeed. In fact, they blink at 2 MHz - see screenshot. Channel 1 (yellow) is pin 12, channel 2 (cyan) is pin 13.

As you can see, the output pins have a square wave with a frequency of 2 MHz. Pin 13 changes state 62.5 ns (one clock cycle) before pin 12, due to the order of the toggling of the pins in the code.
So unless you have much better eyes than mine, you won't actually see any blinking effect.

As an amusing extra, you can actually toggle two pins in the same amount of program space as toggling one pin.
int main ()
  {
  DDRB = bit (4) | bit (5);  // set pins 12 and 13 to output

  while (true)
    PINB =  bit (4) | bit (5); // toggle pins 12 and 13
  } // end of main

That compiles into 178 bytes.
This gives you a higher frequency:

Now we are up to 2.66 MHz.

This makes a ton of sense. So are the standard libraries just headers included automatically at build time? And how were you able to not include them?

The linker aggressively strips out code that isn't used. By not calling init() (as the normal main() does) then the file wiring.c (which has init in it) was not linked in. As a result, the processing for the interrupt handlers (for millis(), micros() etc.) was omitted. It's probably not particularly practical to omit it, unless you never need to time things, but the fact is that the sketch grows in size depending on what you put in it. For example, if you use Serial, both program memory and RAM take a hit.


text:
Receive SMS example gives me a garbage values
When I run my Receive SMS example code, By default every time I get the same thing.I am trying to send sms to my sim card present in the Arduino GSM shield. I don't want this message. How to solve this problem ?

I

Where is it getting the "trend alert" message from? It's not in the example code.. so is that not the text that it's receiving??

That is what I am too confused. Every time I run this code, I get this message again and again ...

This looks like an ad sent to your SIM phone number by your phone operator. Try to use the SIM on a real phone and check if you can get rid of this ad from there.

@jfpoilpret  No, I am not receiving such sms in my mobile..

Could you perhaps just copy and paste the text (~200 bytes) instead of pasting an unreadable 100kB image (which also is more effort having to upload it)? And while you are at it, obfuscate the spamvertized domain.

This is obviously an ad as this links (with complaints about unsolicited SMS ads from this company) shows: http://www.complaintboard.in/complaints-reviews/lenskart-l298415.html

I have activated DND to my phone, now Its working ...

Dungeons & Dragons?

Do not Disturb (DND).

Can you post this as an answer so that this question is resolved?

Most Telecom operators agree for sending advertisements and promotions to their customers for certain business and some money. You can stop these promotion for your mobile by making (Do Not Disturb)DND active. In India, just do the following for DND Activation
 ( Fully Blocked Category )

 Send SMS at START 0 to 1909 or Call at 1909

 Partial Blocked Category

Send SMS at START 1 to 1909 to block Banking – Insurance – Financial Products – Credit Cards
Send SMS at START 2 to 1909 to block Real Estate
Send SMS at START 3 to 1909 to block Education
Send SMS at START 4 to 1909 to block Health
Send SMS at START 5 to 1909 to block Consumer Goods & Automobiles
Send SMS at START 6 to 1909 to block Communication – Broadcasting – Entertainment – IT
Send SMS at START 7 to 1909 to block Tourism

See more at: http://www.techsiren.com/how-to-activate-do-not-disturb-india-registration/#sthash.F87Pfj5V.dpuf


text:
Problems stacking Arduino Shields
I'm trying to stack the Adafruit Data Logger Shield https://learn.adafruit.com/adafruit-data-logger-shield/overview onto a CuteDigi Sim900 GPRS Shield so that I can upload data (collected eventually by a GPS breakout) to a server at certain intervals.
The problem is that I can't seem to get the two shields to play nicely together. I'm a beginner with the Arduino and electronics in general, so hopefully this is just a noob issue.
When I power on the GPRS Shield, the data logger stops outputting the Date/Time to the serial monitor. And when I turn the GPRS Shield off, the serial monitor continues again and shows the Date/Time from the data logger.
They don't share any pins that I'm aware of, and I've tried connecting a 7.4V li-po for external power with no success.
Any help is greatly appreciated!

Make sure you are using a software serial port for the GPRS shield.
If you aren't using the software serial port, then you are probably running into an issue with trying to read data over the only UART (serial) port while two devices are tryiing to use it.
It looks like there are two jumpers next to D0/D1 on the GPRS shield, I can't tell but I think if you remove those, the shield will use software serial over D7/D8.  If you do this, you'll have to code your program to use a software serial.  This wiki page on the GPRS shield if you need help with that.


text:
4 bit to Decimal Converter IC
im using arduino and im out of pins.
I need something like a decoder but the problem is that the decoders only change one output pin I.E. for 0011 the output will be 0001000000000000 what i need is to have the first outputs on I.E for 1000 the output will be 111111111000000000 i basically need to light up to 16leds and im out of pins so i was wondering is there is any IC that does this for me if i have 1111 it will output 16 ones.

You can use one (or more, daisy-chained) shift register for that.
It will normally take you 3 pins and provide 8 outputs, or 8n where n is the number of chained shift registers still using only 3 Arduino pins.
One example of a shift register that fits your situation is the 74HC595.
On Arduino, you can use shiftOut function to help handle those ICs.

You could use the MCP23017 an i2c 16 input/output port expander. (datasheet)
It allows you to control 16 I/O pins via a simple I2C interface (only 2 pins needed).  And an Arduino library exists for it.


text:
Unable to connect to Intel Edison Arduino kit
I just received my new Intel Edison with Arduino Breakout Kit and after hours trying to connec to it, I just can't.
I connected two USB cables to my computer, the switch between the power suply and the nearest usb cable is set to be near the usb cable as explained here : https://software.intel.com/en-us/articles/startup-guide-for-linux-intel-edison-users
And when I connect the two cables, here's dmesg:
[  +1,675635] usb 2-1.2: new high-speed USB device number 24 using ehci-pci
[  +0,098861] usb 2-1.2: New USB device found, idVendor=8086, idProduct=e005
[  +0,000008] usb 2-1.2: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[  +0,000005] usb 2-1.2: Product: MERRIFIELD
[  +0,000003] usb 2-1.2: Manufacturer: INTEL
[  +0,000004] usb 2-1.2: SerialNumber: 10692CA2BC827B2B148DBA29FF184150
[  +9,018609] usb 2-1.2: USB disconnect, device number 24
[  +0,769033] usb 2-1.2: new high-speed USB device number 25 using ehci-pci
[  +0,100256] usb 2-1.2: New USB device found, idVendor=8086, idProduct=e005
[  +0,000010] usb 2-1.2: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[  +0,000005] usb 2-1.2: Product: MERRIFIELD
[  +0,000005] usb 2-1.2: Manufacturer: INTEL
[  +0,000004] usb 2-1.2: SerialNumber: 10692CA2BC827B2B148DBA29FF184150
[  +0,082352] usb 2-1.2: USB disconnect, device number 25
[  +2,538308] usb 2-1.2: new high-speed USB device number 26 using ehci-pci
[  +0,086453] usb 2-1.2: New USB device found, idVendor=8087, idProduct=0a99
[  +0,000012] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000006] usb 2-1.2: Product: USB download gadget
[  +0,000005] usb 2-1.2: Manufacturer: Intel
[  +2,657426] usb 2-1.2: USB disconnect, device number 26
[déc.16 21:14] usb 2-1.2: new high-speed USB device number 27 using ehci-pci
[  +0,087183] usb 2-1.2: New USB device found, idVendor=8087, idProduct=0a9e
[  +0,000010] usb 2-1.2: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[  +0,000005] usb 2-1.2: Product: Multifunction Composite Gadget
[  +0,000005] usb 2-1.2: Manufacturer: Linux 3.10.17-poky-edison+ with dwc3-gadget
[  +0,000004] usb 2-1.2: SerialNumber: 6c1877a6e8f1f5671214d752ae622b8a
[  +0,004451] rndis_host 2-1.2:1.0 usb0: register 'rndis_host' at usb-0000:00:1d.0-1.2, RNDIS device, 96:16:2c:fe:eb:a3
[  +0,001898] cdc_acm 2-1.2:1.2: This device cannot do calls on its own. It is not a modem.
[  +0,000085] cdc_acm 2-1.2:1.2: ttyACM0: USB ACM device
[  +0,002327] usb-storage 2-1.2:1.4: USB Mass Storage device detected
[  +0,000287] scsi host13: usb-storage 2-1.2:1.4
[  +0,057754] rndis_host 2-1.2:1.0 enp0s29u1u2: renamed from usb0
[  +0,008595] systemd-udevd[11838]: renamed network interface usb0 to enp0s29u1u2
[  +0,937753] scsi 13:0:0:0: Direct-Access     Linux    File-CD Gadget   0310 PQ: 0 ANSI: 2
[  +0,001719] sd 13:0:0:0: Attached scsi generic sg1 type 0
[  +0,013953] sd 13:0:0:0: [sdb] 1572864 512-byte logical blocks: (805 MB/768 MiB)
[  +0,001413] sd 13:0:0:0: [sdb] Write Protect is off
[  +0,000009] sd 13:0:0:0: [sdb] Mode Sense: 0f 00 00 00
[  +0,001013] sd 13:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  +0,005279]  sdb: sdb1
[  +0,008088] sd 13:0:0:0: [sdb] Attached SCSI disk
[  +0,391987] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  +0,000018] SELinux: initialized (dev sdb1, type vfat), uses genfs_contexts
[  +3,143835] rndis_host 2-1.2:1.0 enp0s29u1u2: unregister 'rndis_host' usb-0000:00:1d.0-1.2, RNDIS device
[  +0,031230] sd 13:0:0:0: [sdb] Synchronizing SCSI cache
[  +0,025797] usb 2-1.2: USB disconnect, device number 27

Here, there is first something that bothers me :

Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

Is this "normal" ? When running fcsk it talks about the dirty bit, I assumed it was a specific reason for Intel.
Reading the dmesg, I can see that the module will be available at ttyACM0, so I try to conenct using:
screen /dev/ttyACM0 115200

But nothing, a blank screen. I can try to hit enter one, two or millions times, nothing changes.
I'm stuck here for the moment, I don't know what to do more.
For information I'm using Fedora 20 64bits.
Thank you for your help.

Uninstall brltty if it's installed and see if that helps.  Also, I find minicom is better than screen.

Thank you for your comment. I finally found my issue ... and it's dumb as f**k. One of the USB cables is only a power supply cable, it doesn't contain the data cables inside which is needed. I switched the cables and I was able to connect easily...

D'oh. TBH I fell foul of that once.  I chopped that cable up and used it for something else so I'd never do it again.

Yeah, I don't understand the interest of removing a few cables, the cost difference is so low!


text:
Are there any KL03 "arduinos"?
I have been trying to find any Arduino or similar prototyping board that uses this MCU

http://www.pcmag.com/article2/0,2817,2453987,00.asp
But the smallest and more robust ones I have been able to find are Microduino and Espruino pico, none of which use this.
Are there any prototyping boards that use these?

This development board uses a chip from the KL03 family:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL03Z
However, as you can see, it uses the arduino uno form factor (like all their other freedom boards), so it's probably not what you were expecting with respect of size.
If you are looking for a dev board that you can prototype with (easy access to pins and all that) I doubt you can get anything significantly smaller than a teensy (https://www.pjrc.com/teensy/), which also uses a more powerful ARM M4 core. There has been quite a few kickstarters with tiny arduino-compatible boards, but I am not quite sure how many you can actually buy at the moment.


text:
Help with parts identification from arduino starter kit from aliexpress
Ordered an arduino starter kit from aliexpress Link
The parts list they provide (as a jpg on the order page) is vague and not very descriptive, I've gone through most of the parts and am down to three they did not list.

Capacitor? -- Looks to be a capacitor, labeled HDX and nothing else, rattles when I shake it.

Black LED -- I think this is a flame sensor; if it is, what's the difference between this and an infrared receiver (like a 1838B) or photoresistor?

They also list something as 'a digital control' near the bottom of the list, not sure what that is? Every other part from the list is matched up and I don't see anything different in the first picture (not parts list picture) from what I have received in the order.

Rather than linking to OneDrive you can press the image button, browse to the image on your PC and it will automatically put it on imgur. Stack Exchange back those up so the image won't go missing in the future.

The "black LED" is not a LED. I forget what exactly it is, but I have one sitting in my parts box. I'm pretty sure it is a photo-something. Light waves affect it. As for the capacitor-looking things that rattle, I got no idea.

Those are tilt sensors. The rattling is a metal ball that contacts two pins inside, closing the connection.
The 1838B is a full module that partially decodes the received IR so that a MCU can fully decode the rest easily. What you have there is a bare phototransistor with an IR window on the top. You would use it for proximity or presence sensing. Instead of varying its resistance, it varies the amount of current it will pass.
Probably the single-digit 7-segment display, as opposed to the 4-digit display they have listed as "4 digital tube".

@PGT: Flames give off much more IR than a light bulb.

Just a quick thanks. I ordered a set from a supplier called Sintron, also had some vague descriptions and the 2 listed above are the two I was also having difficulties with.  At first I thought caps, but...they shouldn't rattle... :D

I recently purchased the arduinotech module learning Kit and contains both components shown above. It does  mention an Infrared Photo Diode which it think is your "Black LED".
Thanks for the heads up on the HDX switches. Now I know what they are.:)

The HDX is a "Tilt Switch" Turns on/off depending on the angle.

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


text:
Arduino Digitalwrite for while loop set
My question is simple. Does Arduino set the digitalwrite() the moment it is called or at the end of the while loop. E.G.
int ledPin = 13;
void setup()
{
  pinMode(ledPin, OUTPUT);
}

void loop()
{for(int i=0; i<10; i++){
if(i%2==0){
  digitalWrite(ledPin, HIGH);
  delay(1000);}else{
  digitalWrite(ledPin, LOW);
  delay(1000);      }
}

A key point of the Arduino 'language' is every statement is completed before the next one can begin.
A simple statement has a ';' at the end of it.
Or followed by ')' instead of ';' in for (...; ...; statement) loop.
So digitalWrite() will set the pin, HIGH or LOW, before it completes and allows the next statement, delay(...) to begin.
Side note:
Actually digitalWrite() takes a small amount of time to do its work, so it is not exactly 'the moment' it is called. digitalWrite() is pretty quick, a few millionths of a second, which is usually near enough to be practically 'the moment' for most applications.

Arduino 'language' a.k.a. C++ (would add it in brackets to the answer but too short for edit)

Arduino sets the pin at the moment digitalWrite() is called.

To be extremely pedantic, it sets the IO pin state a short time into the processing time of the function call, which can be important if you're trying to run things very fast (digitalWrite() is actually quite slow, in comparison to writing pin control registers directly). It still sets the pin within the execution of the digitalWrite() function call, in any event.

The condition
if(i%2==0)

will be checked immediately upon entering the "for" loop, and again on every iteration of that loop. It will be the first code executed on each iteration. One form or another of the digitalWrite() will be called next, followed by the delay().


text:
What does the term "9g" in servo's rating mean?

I frequently see 9g mentioned in servos. I searched the web but couldn't find any worthwhile answers. At first I thought it meant 9grams but the weight of the servo isn't 9 grams, so have to be something else.

I'm voting to close this question as off-topic because it is not at all about Arduino.

If servos isn't an integral part of Arduino, then what is? I don't expect arduino to rotate a wheel from thin air.

The idea of servo weight seems irrelevant to me as I see servos measured in kilograms. I tend to think this measurement have to do something with servo's power, like how big things it can move.

According to Flite Test web site, the 9g reference is the weight without the wire lead. They measured one model at 8 grams rounded down. I suspect the weight also ignores the horn as well as the wire.
The article referenced on the web site calls the weight reference as a standard, which means that it more likely allows for heavier or lighter servos as long as the size of the servo matches.
If you purchase a servo for a model known to use a 9g servo, you know the hole you have to build for it to fit. If you purchase a 5g servo, it will be a different hole and you may have a 6 or 7 gram weight, but the servo fits as it should.

So the "9g" is a standardized case size for servos?

I should have put standard in quotes, as anybody can state a standard, but it's the consistent use of 9g for servos of a particular size, regardless of weight that makes it work in this sort of circumstance.

From a model airplane perspective...
The "9g" is supposed to mean 9 grams in weight. Each vendor has their own way to define their weight.

with wires
without wires
with or without control horns
"about the same as a competitor's 9 gram servo"

Most are not accurate.
It is not a standard for size, and has nothing to do with hole size or screw spacing

According to the link it is.
However, if you look at this more detailed datasheet, it shows 14.7 g.
Probably it's the weight of the motor part itself, not the plastic enclosure around it.
Btw, most websites (without actually using data sheets), mention a weight of 9 g.


text:
How do I debug on-chip with Arduino?
Though an emulator is quite useful for debugging code that has no side effects, most real-world applications include some circuitry besides the Arduino. If a microcontroller on an Arduino had a JTAG interface, it would be pretty straight-forward, but what if it's e.g. an Arduino Uno?

Could you elaborate on what you are trying to accomplish? Its not clear from the question that what exactly do you want to debug.

@AsheeshR The only thing that is possible to debug on Arduino is source code. There's a set of tools called "debuggers", which employ breakpoints, step-by-step evaluation etc. I don't understand your question.

@jippie You're wrong about that. DebugWire yes, but JTAG No. The ATMega168/368 has no JTAG support whatsoever. If you do a quick search of the datasheet you will not find any reference to JTAG

@Madivad Is it possible to make another Arduino into USB to DebugWire connector?

@polkovnikov.ph I have never used DebugWire, so I don't know the first thing about it. I just did a quick google search, and there is stuff out there, so have a look at that. I have only ever used the JTAG pre Arduino days (ATMega128).

DebugWire is an Atmel proprietary protocol, not much information available about it.

I would say you don't. The closest to debugging I've seem is having the Arduino listen to serial and perform commands (like e.g. variable dumping) on request.

It seems there is possibility for interactive debugging with this tool: http://www.visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx it is not free but it is quite cheap. I haven't used it myself so I don't want to provide an answer for it.

The Arduino Uno uses the Atmel Atmega328p microcontroller, which only has one debug option, DebugWire.  There are a few tools that can work with it, but the least expensive and most commonly available is the AVR Dragon.
You can use AVR Studio 6 for this.  You can use the .elf file file produced during the Arduino build process directly, but setting up the debugger is a little easier if you port the Arduino program to the AVR Studio.  It's not difficult, but there are a lot of little pieces to deal with.  There are guides online to help you through this.

Is there an AVR Dragon clone with open-source firmware?

Any links to those online guides?

There are MKII clones which will do debugwire with this chip, but I'm not aware of their open source hardware or software status, and am having trouble finding a good example easily. Here's one guide for using AVR Studio 6 with arduino projects: http://www.engblaze.com/tutorial-using-atmel-studio-6-with-arduino-projects/

Doesn't this require  removing a capacitor?

@PeterMortensen I don't know, you'd have to examine the arduino uno schematic and the debugwire requirements along with your debugger's documentation. It may be worth asking a new question to get or share details of a specific setup.

This might not be right for you, but the Visual Micro plugin for Atmel Studio and Visual Studio has a USB debugger which only uses Arduino code.
In the background the debugger uses Serial which might affect some time-sensitive applications.

Will this really work on Arduino Uno?