Tag Archive | "over"

Results – February 2012 Competition

Competition over.

Posted in competition

February 2012 Competition

Competition over

Posted in competition

Review – Freetronics EtherMega

In this review we take a look at what is possibly the most fully-featured Arduino compatible board on the market today – the Freetronics EtherMega. This board combines the functionality of an Arduino Mega2560, a microSD card shield, and an Ethernet shield that supports power over Ethernet with optional 802.3af standard. So instead of having these three mashed together at a great expense:

thelot

… you can have this:

Freetronics EtherMega Tronixlabs Australia

Which saves space, time and money. Firstly, the specifications:

  • 100% compatible with the Arduino Mega2560. So you have the ATmega2560 microcontroller, 54 digital I/O pins with 14 PWM-capable, 256KB of flash memory, 8KB of SRAM and 4KB of EEPROM to play with, the Atmel 16u2 micrcontroller taking care of the USB interface;
  • However unlike the original, the EtherMega contains a switchmode power supply that allows operation from a DC power supply of between 7 and 28VDC without overheating;
  • Complete c0mpatibility with the Arduino Ethernet shield, using the Wiznet W5100 controller just like the original;
  • Network status LEDs on both the socket and the PCB;
  • Fixed SPI behaviour on Ethernet chipset;
  • Complete microSD card compatibility with SD library, and chip-select is on digital pin 4 so Ethernet and microSD can work together on the same sketch;
  • optional 802.3af power over Ethernet support at up to 48V using the optional regulator board which mounts on the EtherMega;
  • mini USB connector instead of the larger standard USB socket which can interfere with shields – and a USB cable is included

Furthermore there are a few modifications to make using the EtherMega easier or simpler. The first of these is the onboard prototyping area allowing you to add your own circuitry:

Also notice that the I2C pins have been brought out alongside the 5V and GND pins on the right. The only difference to take note of are the jumpers that are used to select either USB or DC socket power:

However that is a small price to pay compared to the convenience of the wide voltage-handling capability. Finally, unlike the original Arduino Mega2560 the designers have placed the TX/RX indicators at the top-left of the EtherMega so they are still visible when extra shields have been mounted:

The overall design and quality of the EtherMega is top notch, with a thick PCB, rounded corners, descriptive silk-screening, and packaging that can be reused as Mega or other part storage.

If you are looking for an Arduino Mega2560 and could use Ethernet, power-over-Ethernet, a microSD card interface and full, 100% Arduino compatibility you could do a lot worse than getting yourself an EtherMega. If you are interested in learning how to use Arduino and Ethernet – check out our tutorial here. Or to get your Arduino tweeting, visit here.

And if you enjoyed this article, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a fourth printing!) “Arduino Workshop”.

visit tronixlabs.com

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our forum – dedicated to the projects and related items on this website.

Posted in 802.3af, arduino, ethermega, ethernet, freetronics, review, shield, tronixlabsComments (0)

Moving Forward with Arduino – Chapter 16 – Ethernet

Use Ethernet with Arduino in chapter sixteen of “Getting Started with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

[Updated 09/01/2013]

In this instalment we will introduce and examine the use of Ethernet networking with Arduino systems. This tutorial covers receiving data from an Arduino over the Internet. If you are interested in controlling an Arduino over the Internet, see here. It will be assumed that you have a basic understanding of computer networking, such as the knowledge of how to connect computers to a hub/router with RJ45 cables, what an IP and MAC address is, and so on. Furthermore, here is a good quick rundown about Ethernet.

First of all, you will need an Ethernet shield. There are a few on the market, such as the original version by the Arduino team. Readers of my articles will know my preference is for the Australian-designed Freetronics line of hardware, so I will be using their EtherTen – which combines an Arduino Uno-compatible board with an Ethernet shield. Plus it also has some interesting power-over-Ethernet features which you can read about here. However as long as your Arduino Ethernet shield has the W5100 controller IC – you’re fine.

Now, let’s get started!

This is an ethernet shield on top of an Arduino-compatible board. Nothing new here – just a nice RJ45 socket which you connect to your router/hub/modem with a patch lead:

shieldbss

First of all, let’s do something quick and easy to check that all is functional. Open the Arduino IDE and select File > Examples > Ethernet > Webserver. This loads a simple sketch which will display data gathered from the analogue inputs on a web browser. However don’t upload it yet, it needs a slight modification.

You need to specify the IP address of the ethernet shield – which is done inside the sketch. This is simple, go to the line:

And alter it to match your own setup. For example, in my home the router’s IP address is 10.1.1.1, the printer is 10.1.1.50 and all PCs are below …50. So I will set my shield IP to 10.1.1.77 by altering the line to:

You also have the opportunity to change your MAC address. Each piece of networking equipment has a unique serial number to identify itself over a network, and this is normall hard-programmed into the equipments’ firmware. However with Arduino we can define the MAC address ourselves. If you are running more than one ethernet shield on your network, ensure they have different MAC addresses by altering the hexadecimal values in the line:

However if you only have one shield just leave it be. There may be the very, very, statistically rare chance of having a MAC address the same as your existing hardware, so that would be another time to change it. Once you have made your alterations, save and upload the sketch to your Arduino or compatible board. If you haven’t already, disconnect the power and add your Ethernet shield.

Now, connect the shield to your router or hub with an RJ45 cable, and the Arduino board to the power via USB or external power supply. Then return to your computer, and using your web browser, enter your Ethernet shield’s IP address into the URL bar. The web browser will query the Ethernet shield, which will return the values from the analogue ports on the Arduino board, as such:

As there isn’t anything plugged into the analog inputs, their value will change constantly. Neat – your Arduino is now serving data over a network. It is quite motivating to see it actually work.

At this point – please note that the Ethernet shields use digital pins 10~13, so you can’t use those for anything else. Some Arduino Ethernet shields may also have a microSD card socket, which also uses another digital pin – so check with the documentation to find out which one. If you are considering using an Arduino Mega and Ethernet – check out the EtherMega.

Nevertheless, now that we can see the Ethernet shield is working we can move on to something more useful. Let’s dissect the previous example in a simple way, and see how we can distribute and display more interesting data over the network. For reference, all of the Ethernet-related functions are handled by the Ethernet Arduino library. If you examine the previous sketch we just used, the section that will be of interest is:

Hopefully this section of the sketch should be familiar – remember how we have used serial.print(); in the past when sending data to the serial monitor box? Well now we can do the same thing, but sending data from our Ethernet shield back to a web browser – on other words, a very basic type of web page. However there is something you may or may not want to  learn in order to format the output in a readable format – HTML code. I am not a website developer (!) so will not delve into HTML too much.

However if you wish to serve up nicely formatted web pages with your Arduino and so on, here would be a good start. In the interests of simplicity, the following two functions will be the most useful:

Client.print (); allows us to send text or data back to the web page. It works in the same way as serial.print(), so nothing new there. You can also specify the data type in the same way as with serial.print(). Naturally you can also use it to send data back as well. The other useful line is:

this sends the HTML code back to the web browser telling it to start a new line. The part that actually causes the carriage return/new line is the <br /> which is an HTML code (or “tag”) for a new line. So if you are creating more elaborate web page displays, you can just insert other HTML tags in the client.print(); statement.

Note that the sketch will only send the data when it has been requested, i.e. received a request from the web browser. So let’s put our new knowledge into action with some simple sensor hardware – measuring temperature and pseudo-light levels. In chapter fourteen we did this and sent the results over the air using XBee wireless modules. Now we shall make that data available to a web browser instead.

We will need:

  • Arduino Uno or compatible board and Ethernet shield, or
  • Freetronics EtherTen
  • Analog Devices TMP36 temperature sensor
  • 10 k ohm resistor
  • light-dependent resistor/photocell

Here is the schematic for the circuit:

example16p1sch

and in real life. If you were to construct a permanent application, the Freetronics shield is great as you have all that prototyping space:

exam16p1hardss

and download the sketch from here. Finally, the example in action, on the desktop PC:

exam16p1chrome

… and on a phone via my internal wireless access point (the screen is a little fuzzy due to the adhesive screen protector):

exam16p1desiress

Now you can see how easy it is to send data from your Arduino via an Ethernet network to a web browser. But that is only to a local web browser. What if I wanted to read that data using my phone from an Internet cafe in downtown Vientiane? It can be done, but is a little bit tricky for the uninitiated – so let’s get initiated!

You will need a static IP address – that is, the IP address your internet service provider assigns to your connection needs to stay the same. If you don’t have a static IP, as long as you leave your modem/router permanently swiched on your IP shouldn’t change.

However, if your internet service provider cannot offer you a static IP at all, you can still move forward with the project by using an organisation that offers a Dynamic DNS. These organisations offer you your own static IP hostname (e.g. mojo.monkeynuts.com) instead of a number, keep track of your changing IP address and linking it to the new hostname. From what I can gather, your modem needs to support (have an in-built client for…) these DDNS services. As an example, two companies are No-IP and DynDNS.com. Please note that I haven’t used those two***, they are just offered as examples.

Now, to find your IP address, usually this can be found by logging into your router’s administration page. For this example, if I enter 192.168.0.1 in a web browser, and after entering my modem administration password, the following screen is presented:

wanip

What you are looking for is your WAN IP address, as artistically circled above. To keep the pranksters away, I have blacked out some of my address. The next thing to do is turn on port-forwarding. This tells the router where to redirect incoming requests from the outside world. When the modem receives such a request, we want to send that request to the port number of our Ethernet shield. Using the Server server(80); function in our sketch has set the port number to 80. Each modem’s configuration screen will look different, but as an example here is one:

bobportfwdss

So you can see from the line number one, the inbound port numbers have been set to 80, and the IP address of the Ethernet shield has been set to 192.168.0.77 – the same as in the sketch. After saving the settings, we’re all set. The external address of my Ethernet shield will be the WAN:80, e.g.  213.123.456.128:80 into the browser of a web device will contact the lonely Ethernet hardware back home. Furthermore, you may need to alter your modem’s firewall settings, to allow the port 80 to be “open” to incoming requests. Please check your modem documentation for more information on how to do this.

Now from basically any Internet connected device in the free world, I can enter my WAN and port number into the URL field and receive the results. For example, from a phone when it is connected to the Internet via 3.5G mobile data:

How neat is that? The web page, not the phone. Well, the phone is pretty awesome too.

OK, it’s just the temperature – but with your other Arduino knowledge from our tutorials and elsewhere – you can wire up all sorts of sensors, poll them from your Arduino and use the Ethernet shield and an Internet connection to access that data from anywhere. Here are some applications that spring to mind, all can be made possible with details from our previous tutorials:

  • Sensitive temperature monitoring (e.g. a smoke house, tropical fish tank, chemical storage room, and so on);
  • “Have the children come home from school?” – children must swipe their RFID tag when they arrive home. Arduino stores time and tag number, which can be converted into display data for web output;
  • For single room-mates – perhaps a remote, high-tech version of a necktie on a doorknob… when the “busy” flatmate arrives home, they turn a switch which is read by the Arduino, and is then polled by the sketch – the other flatmates can poll from their phone before coming home;
  • Using reed switch/magnet pairs, you could monitor whether important doors or windows (etc.) were open or closed.
  • A small RFID could be placed on the collar of your pet – two RFID readers on each side of a cat/dog flap door. Using simple logic the Arduino could calculate if the pet was inside or outside, and the last time the pet went through the door.
  • send twitter messages

The possibilities are only limited by your imagination or requirements.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, DEV-09026, education, ethernet, etherten, learning electronics, lesson, microcontrollers, shield, tronixstuff, tutorialComments (13)


Subscribe via email

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: