Skip navigation

I just got this come through to my email, so I thought I would share it with you all


it is short notice, Im going so if your in Ontario and go, ill see you there






Atmel Tech on Tour is coming to Ontario in April


Portsmouth Arduino Day

Posted by markvenn Mar 28, 2015

It's a great success so far with plenty of people turning up and with a nice mix of knowledge. We have some interesting projects on the go, will write these up soon.

here's some pictures!







Arduino Day 2015 - Portsmouth

Posted by markvenn Mar 28, 2015

Well, we are all set, waiting for the first people to arrive!



Arduino GSM Shield

Posted by markvenn Mar 27, 2015

I've been playing with the GSM shield and the sms functions. As some of you may remember a while ago I was having problems with my mega and the shield. paulellison helped me out considerably with identifying problems with the mega and the shield using different pins and also we found the power drain could be quite high during some functions. Anyway, I have been playing with some ideas, using incoming sms messages to trigger events and so far I have got the Uno I am using to receive a test and, depending on the first character of the text it will reply to the sender with an appropriate text message and, if the message starts with a '#' it will discard the text and let the sender know that this is what has happened.


This is going to be the starting code for something I am going to try to work on during our Arduino Day so I give you the basic code now and will let you see how it works tomorrow!


 SMS receiver

 This sketch, for the Arduino GSM shield, waits for a SMS message
 and displays it through the Serial port. Then returns message to sender
 letting them know it has been received on Arduino

 * GSM shield attached to and Arduino
 * SIM card that can receive SMS messages

 created 27 Mar 2015 by Mark Venn
 based on code by Javier Zorzano / TD & Tom Igoe


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

// PIN Number for the SIM
#define PINNUMBER ""

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup()
  // initialize serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only

  Serial.println("SMS Messages Receiver / Responder");

  // connection state
  boolean notConnected = true;

  // Start GSM connection
  while (notConnected)
    if (gsmAccess.begin(PINNUMBER) == GSM_READY)
      notConnected = false;
      Serial.println("Not connected");

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");

void loop()
  char c;

  // If there are any SMSs available()
  if (sms.available())
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);

    // An example of message disposal
    // Any messages starting with # should be discarded
    if (sms.peek() == '#')
      Serial.println("Discarded SMS");
      Serial.println("\nSENDING REPLY");
      sms.print("Message discarded. (Began with #");
    else if (sms.peek() == '@')
      Serial.println("\nSENDING REPLY");
      sms.print("Message began @");
    else if (sms.peek() == ';')
      Serial.println("\nSENDING REPLY");
      sms.print("Message began ;");
    else if (sms.peek() == '!')
      Serial.println("\nSENDING REPLY");
      sms.print("Message began !");

    // Read message bytes and print them
    while (c =

    Serial.println("\nEND OF MESSAGE");

    // return message to sms sender
    sms.print("Message Received!");

    // Delete message from modem memory
    Serial.println("MESSAGE DELETED");




I am thinking of trying case statements instead of the dreaded if else if else mess, this was just to try to get something working ready for tomorrow! We shall see how it goes! Going to have a good day I think, odion is going over with me, he is really getting in to Arduino and using python to do clever stuff depending on what is spat out of the serial port. Will get him to write something up sometime.

I was working on a project for my UNO that would randomly fade in and out the RGB and make different colors.. After troubleshooting.. I find that the green portion of the RGB LED is not working..

I tested it with a pretty well used 3.3 v watch battery. The red and blue work fine..

Since they closed the local Radio Shack.. I will have to order some I guess..

Hi mates


I was looking for something to read about sensors and found this site Meccanismo Complesso


I have liked very much this tutorial Arduino: measuring the Earth’s magnetic field with the magnetometer HMC5883L | Meccanismo Complesso


I hope this be interesting for someone

For all the hobbyist, maker community, students and beyond - we're supplying free reference designs that you can work with, take from and build up to make

your own designs!    No need to start from scratch!

                uno.PNG      uno2.PNG

These PADS Arduino Uno & Arduino Uno SMD Rev3 reference design data sets have 19 files including:

    • Schematic design in xDX Designer format (.prj)
    • Layout design in PADS 9.5 format (.pcb)
    • Bill of Materials for the design ( Bill of Materials.html)
    • PDF of the schematic design ( (Schematic).pdf)
    • PDF of the layout design ( (Layout).pdf)
    • Property definitions file (netlist.prp)
    • PCB Configuration file (pads95.cfg)
    • Land Patterns
    • Schematic symbols


Be sure to check out all 24 Reference Designs found here: can be used with our new inexpensive (PADS based) Designer Schematic and Designer Layout tools now available for the hobbyist/maker community from Digikey ! as well as our desktop PADS products.

Cheers !     John

Though this combination seems weird Christopher Connell has wrote this fantastic tutorial to make it possible:




I love it.

Enjoy this video prototype testing. It shows the Digital Potentiometer Lab Arduino Shield prototype demonstration.

The device shown in the video is the number zero prototype while a full description on how it works, features, schematics and circuits are on the article I have published on Electro Schematics This shield is based on AD5206 digital potentiometer.

A note on the content

The first part of the video shows how the shield works: it has been developed around the AD5206 device from Analog Devices but there are also 6 analog triggers (that can be excluded if needed) to test the digital potentiometer features and for testing purposes.

The second part of the video just show a very simple application: a second Arduino receives an analog input to control the PWM movement of a micro servo. See it in action. The PCB of this shield (or the fully assembled version) can be found on Tindie at production cost.


@Tindie @techrmcom @enricomiglino @BalearicDynamic

All What you want about Arduino & RaspberryPi

Projects , hints , Links , Blogs


Hello mates


I was researching about stepper motors and I have found this video by Bret Stateham



I think it is very usefull


Arduino Day 2015 - UK

Posted by markvenn Mar 17, 2015

Hi All

As you all know it is International Arduino Day on the 28th of March, only 11 days away. I expect some of you are attending or running events. A few of us, including pizak , who are working on various levels or education are running an event at the University of Portsmouth, Hampshire on the south coast of the UK, (not the one in the US, New Hampshire I think. I don't know, people leave England and then use the same names for so many places.... )

Anyway, I asked element14 if they were able to help us out with some gear for those people who want to come along and try out our beloved Arduino and they have been extremely helpful. We have 3 Arduino Starter Kits on the way!!! Arduino Starter Kit - Premier Farnell So, anyone who lives locally and wants to come along please look at our Eventbrite page and book your tickets! Arduino Day 2015: Portsmouth- Eventbrite


We are hoping to turn this into a regular event, although we are not sure of the name of the group that we are going to start to run these events. We want to be able to have people along who not only use Arduino but we will be opening up to all single board computers. I know that there are many people who, like me, use various Arduino boards, Beaglebone and RaspPi to do their work and I think we want to bring them in too, at a later date so they can help spread the word about how much fun can be had with a tiny computer, a few LEDs, a handful of wires, a motor and a bunch of friends!


We are going to be blogging throughout the day with info on the sort of things people are coming up with so look for updates!

In my previous post on the subject I showed how to configure the Arduino Ethernet shield, in such a way you can save a lot of memory. Now it's time to use the shield for something useful.

Arduino is mostly used to take data from sensors and to drive actuators to perform actions (such as motors, servos, relays, etc.). In this post we are going to use Arduino to collect some data (e.g. temperatures) and store them on a computer disk for subsequent analysis. As a physics teacher, in fact, I am interested in using Arduino as a laboratory tool and in physics you always collect data from experiments to be analysed offline.

Then, suppose you want to perform the following calorimetry experiment: take a resistor and wrap it in a waterproof material; then connect its leads to a voltage generator and make current flow through it. If R is the resistance of the device and V the voltage across its leads, the Ohm's Law states that the current flowing is I=V/R. The resistor dissipates heat, because of the Joule's effect, as W=RI2, where W is the amount of energy per unit time. If you plunge the resistor into water, the energy released by the resistor causes the heating of the water and you expect that the temperature of the water raises linearly with time.

You can perform this experiment using an LM35 connected to an Arduino to measure the water temperature versus time (the sensor leads must be made waterproof, of course, e.g. using some heat-shrink tubing). An Ethernet shield can then be used to send data to a computer.

Let' start looking at the Arduino sketch, shown below.

#include <Ethernet.h>
#include <SPI.h>

#define PORT 5000
#define LM35PIN A0

byte mac[] = {0x5e, 0xa4, 0x18, 0xf0, 0x8a, 0xf6};
IPAddress arduinoIP(192, 168, 1, 67);
IPAddress dnsIP(192, 168, 1, 1);
IPAddress gatewayIP(192, 168, 1, 1);
IPAddress subnetIP(255, 255, 255, 0);

EthernetServer server(PORT);
boolean notYetConnected;

void setup() {
  Ethernet.begin(mac, arduinoIP, dnsIP, gatewayIP, subnetIP);
  notYetConnected = true;

void loop() {
    int i = 0;
    EthernetClient client = server.available();
    if (client) {
      if (notYetConnected) {
        notYetConnected = false;
      if (client.available()) {
        unsigned long now = millis();
        int lm35 = analogRead(LM35PIN);
        now += millis();
        double T = 5000.*lm35/10240.;
        server.print(" ");

The first include directives are needed to use the Ethernet shield. Then we define two symbols: PORT is used to send data over the Internet, LM35PIN represents the Arduino pin to which the LM35 sensor is connected.

Besides the addresses used to configure the Ethernet shield (see my previous post), a number of data members are defined: in particular, the EthernetServer object called server is instantiated, listening on port PORT. This creates an object in the Arduino memory that connects to the Internet and waits for signals on the given port, represented as an integer (5000 in the example).

The setup() method just initialise variables and configure the Ethernet shield. The most interesting part is in the loop() method. Here we instantiate (create) an object called client of class EthernetClient. Such an object is returned by the server object that continuously polls the port to which is connected. If no client is connected, the server returns NULL. Then, as soon as client is found to be not NULL, and available for communication, we can send and receive data to/from it.

Before sending data we must get them: first of all we obtain the current time as the number of milliseconds elapsed since the beginning of the execution of the sketch (we don't care about the absolute time of the event). This time is returned by the function millis() and is represented as an unsigned long integer, i.e. a binary code of 32 bits. With 32 bits, the highest number that can be represented is 232-1= 4294967295. Dividing this number by 86400 (the number of seconds in a day) and by 1000 we get about 50: this is the number of days during which the millis() can work without reaching the overflow condition. In other words, there is plenty of time to perform our experiment.

Then we get the reading from the LM35 sensor using analogRead and measure the time again. Averaging the last time with the one previously measured provides a better estimate of the time of reading. Note that, in between, we just read raw data, in such a way we minimise the time spent in data acquisition and obtain the time with as much precision as possible. Computing the temperature in degrees is made after getting the time: the analog pin reading is a 10 bits binary number: its highest value (1024) corresponds to an input of 5 V, i.e. 5000 mV. The actual temperature, in Celsius, can be obtained reading the output voltage of the sensor divided by 10.

To transmit data to a remote client, it's enough to call the print method of the server object. We then print the time reading, a blank and the actual temperature. Without any delay in the loop(), the sketch will read temperatures at a rate of one measurement every few milliseconds (quite fast, indeed).

In order to collect those data on a computer you need an Internet client that connects to the Arduino port 5000, writes some data on that port to announce it (knock, knock) and waits for data. An example of such a program in C is below.

#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>

#define PORT 5000
#define ADDRESS ""

int main() {
  int len;
  int i;

  /* create socket */
  int sock = socket(AF_INET , SOCK_STREAM , 0);
  if (sock <= 0) {
    printf("Can't create socket. Error");
    return -1;

  struct sockaddr_in server;
  server.sin_addr.s_addr = inet_addr(ADDRESS);
  server.sin_family = AF_INET;
  server.sin_port = htons(PORT);

  /* connect */
  if (connect(sock , (struct sockaddr *)&server , sizeof(server)) < 0) {
    printf("can't connect to the server. Error");
    return -1;

  printf("CONNECTED: hit return to start DAQ\n");

  char message[255];
  scanf("%s", message);
  send(sock, message, strlen(message), 0);

  /* read */
  while (1) {
    unsigned char c;
    recv(sock, &c, sizeof(unsigned char), 0);
    printf("%c", c);

  return 0;

Briefly, we first create a so-called socket to make a connection between the client and the server (the Arduino). We must connect the socket to the same port to which the server is listening at. Once connected, with scanf we just read a string from the keyboard and send it to the server. This way the server answer and data acquisition starts. Data sent from the server are read with the recv statement (one character at a time). In the above example the reading loop lasts forever and just print characters on screen. You can, of course, write data on a file until some event happens (e.g. key pressed, maximum number of data received, etc.).

On the Farnell Element14 site you can find all the products mentioned above (just follow links) and many others, with which you can realise much more experiments using a similar technique.

The content of this post can be found in my blog, too, and will be available as a chapter in a free publication of mine: Arduino Scientific Programming.


I've decided to record quick video using the ESP8266 ESP-01 WiFi Transceiver Module.

It's just getting started guide in how to establish the serial communication to send AT commands with an Arduino or a FTDI programmer.

I hope you find this video useful.

You can also visit the link below for more information in how to use this module.


This is the first of a series of posts devoted to the (clever) usage of Arduino, with particular emphasis to scientific tasks. The content of these posts will also be available on my free publications on using Arduino for scientific purposes: Scientific Arduino Programming.

With respect to other similar posts, mine will not only show how to do something using Arduino: as a physics teacher I will explain why you are required to do that. In order to use any tool at its best, it is important to understand how it works behind the scenes.

As a physicist I often do measurements. Some of them can be done using an Arduino board equipped with some sensor. In fact, the advent of Arduino boards was a great advantage, mostly for those in need of cheap data acquisition systems for scientific purposes, like teachers in high schools or graduate students.

Most scientists do not take measurements, analyse them and show results in one single application: taking data can be a hard job that can keep your CPU very busy. Hence, in most cases, they just take as much data as they can out of the sensors and barely copy them as such on some mass storage device. Those data are then analysed offline using the best available tools that not necessarily coincide with the best tools for data acquisition. Presentation is a further step: once data have been analysed, the relevant results must be presented in the proper way and that job can be done with an even different technology.

In this post we show how to use Arduino to take data from some sensor and store them for further analysis. There are at least two very effective solutions: storing data onto files on SD cards or transfer data over the Internet to a remote location. The first solution is fairly simple, but data cannot be accessed during data acquisition; if the data taking persists for a long time you may prefer adopting the second solution.

Let's then assume we are going to use an Arduino board to get the values of few sensors during an experiment that lasts for a relatively long time. Moreover, imagine that the equipment used to take data needs to be kept in conditions such that it is difficult to have access to it (e.g. a dark room, or a climatic chamber). The only solution to get the data out of the system in almost real time is to use an Ethernet shield, i.e. an Arduino shield capable to connect to the Internet and exchange data over the connection.

In order for any device to connect to the Internet, the device must acquire a unique identity on the network: the IP address. The IP address (IP stands for Internet Protocol) of a device is a unique identifier composed, in the IPv4 version of the standard (the most commonly used), of four bytes, each of which can have a value between 0 and 255. Few of them are reserved internationally and, in particular, subnetworks whose first two bytes are 192 and 168 are non-routable, i.e. packets sent over such a network cannot go beyond an Internet switch. In other words they can only reach those devices on the same physical network. That's why devices in a home network usually have IP addresses like 192.168.x.y. The IP address of a device can be statically or dynamically assigned to it. In the first case, the device administrator tells the device its IP address: in this case the address is going to remain the same forever. A device not having a static IP address can ask for an IP address to any computer on the same network running as a DHCP server (Dynamic Host Configuration Protocol). Depending on the configuration of the server, available IP addresses can be assigned to the device randomly or based on the device identity.

Every physical device, in fact, brings a unique MAC (Media Access Control) address: a set of six bytes, usually expressed in the hexadecimal notation, as 5e:a4:18:f0:8a:f6. The MAC address is broadcasted over the network so that a DHCP server can choose if the request must be ignored, served using a randomly chosen address or with a fixed address.

Having an IP address in not enough for a device to communicate with other devices: data packets must reach a special device, called the gateway, that knows how to send data to the recipient. The gateway, too, must be assigned an IP address and its address must be known to the devices aiming to communicate with others.

IP addresses can be associated to strings composed of a host name and a domain name. All devices on the same network shares the same domain name, while host names are unique. A DNS (Domain Name System) is a device able to associate the IP address of any other device to its host name.

The last piece of information needed to setup a network device is the subnet mask. This is a rather technical element, but we can think of it as a way to identify the range of addresses a device can reach directly DSC_0434.JPGthrough a gateway. It is usually in the form of an IP address (but it is not, it is a mask) and often equal to, meaning that all the devices on the same network share the first three bytes of their IP address.

We now have all the ingredients to connect our Arduino to the network: first of all plug the Ethernet shield to the Arduino board (see the picture), then connect the shield to your router using an RJ45 cable. In order to configure the device you must know the MAC address of your shield (you can find it printed on the box or you can just invent it, provided it is unique in your network). Consider now the following excerpt of Arduino sketch:

#include <Ethernet.h>
#include <SPI.h>

byte macAddr[] = {0x5e, 0xa4, 0x18, 0xf0, 0x8a, 0xf6};
IPAddress arduinoIP(192, 168, 1, 67);
IPAddress dnsIP(192, 168, 1, 254);
IPAddress gatewayIP(192, 168, 1, 254);
IPAddress subnetIP(255, 255, 255, 0);

void setup() {
  Ethernet.begin(mac, arduinoIP, dnsIP, gatewayIP, subnetIP);

Including Ethernet.h and SPI.h is mandatory: that files contain the definition of the classes used in the sketch. The MAC address is defined as an array of bytes, each of which is represented as a pair of hexadecimal digits (thanks to the 0x preceding each number). The IP addresses of the shield, the DNS and the gateway is given as an object of class IPAddress, as well as the subnet mask (that is not an address, but has the same structure). The object constructor (called after the declaration, as in IPAddress arduinoIP(192, 168, 1, 67);) takes four arguments that represent the four bytes of the address. Our Arduino will then acquire a fixed IP address, in a network whose gateway's address is; the gateway works also as the DNS in this case, while the subnetwork is restricted to those devices having an IP address like 192.168.1.x.

The Ethernet.begin(mac, arduinoIP, dnsIP, gatewayIP, subnetIP) call does the job: it configures the Ethernet shield as above (and, of course, it does that in the setup() method).

In many tutorials you can easily find a much simpler configuration, that reads as

#include <Ethernet.h>
#include <SPI.h>

byte mac[] = {0x5e, 0xa4, 0x18, 0xf0, 0x8a, 0xf6};

void setup() {

In this case the Ethernet shield acquire a dynamic IP address from a DHCP server on the network. In fact the begin() method of the Ethernet class exists in many variants (it is said to be polymorphic). To many novices the last sketch may appear much more convenient: it's simpler and shorter and does not require the knowledge of too many parameters. However, attention must be paid to the size of the memory. It turns out that the length of the source code has mostly nothing to do with the size of the sketch in the Arduino memory.

This happens because what is stored in the Arduino memory is not the sketch as you can see in the editor, but the sketch in machine language. Microprocessors work using electrical signals representing data and instructions. Because an electrical device can be easily found in two states (e.g. on/off), information (data and instructions) is represented as binary strings. A program for a microprocessor is then a long sequence of bits 0 and 1, not a flow of characters. The characters you write in the editor are translated into corresponding sequences of bits by the compiler (automatically invoked before uploading the sketch or when you click on the Verify button of the Arduino IDE). It is this long sequence of bits that is uploaded on the Arduino memory, not your sketch.

It happens that, in order for the shield to ask for an IP address to a DHCP server, the number of operations to perform is much larger with respect to those needed to assign manually all the parameters. As a result, the compiled program in the two cases is very different in size: the first sketch takes 2634 bytes in memory, once added an empty loop() method; the latter takes 10424 bytes! It's about a factor 4 more space!

The memory space of an Arduino is precious, since it is not so large: as a result you may prefer the apparently longer sketch of the first example to the second one. This is a very clear demonstration that knowing what you are doing is extremely important! Don't just copy and paste computer code! Always try to understand it!

Now we own an Internet connected Arduino board. We are going to take data with it and send them to some remote storage for further analysis. In the next post we will show how to do that efficiently. Stay tuned...

ok so i am new to arduino. i am trying to have one button turn on the led witch is in pin 13 and another button to turn it off but im having problems. when i press the button it turns on when i let off the button it goes off.  here is my code so far.


const int buttonPin = 2;     // the number of the pushbutton pin

const int ledPin =  13;      // the number of the LED pin

const int buttonPin1 = 3;

// variables will change:

int buttonState = 0;         // variable for reading the pushbutton status



void setup() {

  // initialize the LED pin as an output:

  pinMode(ledPin, OUTPUT);    

  // initialize the pushbutton pin as an input:

  pinMode(buttonPin, INPUT); 

  pinMode(buttonPin1, INPUT);




void loop(){

  // read the state of the pushbutton value:

  buttonState = digitalRead(buttonPin);

   buttonState = digitalRead(buttonPin1);

  // check if the pushbutton is pressed.

  // if it is, the buttonState is HIGH:

  if (buttonState == HIGH) {   

    // turn LED on:  

    digitalWrite(ledPin, HIGH);



    delay(100);  // Wait 0.5 seconds before re-checking button states


    if (buttonState == HIGH) {   

    // turn LED on:  

    digitalWrite(ledPin, LOW);






if some one can tell me what im doing wrong please tell me.i just started programming and i dont know much i can read and under stand code but i am not good at writing code.

Filter Blog

By date: By tag: