How to use the Nanoshields
Nanoshields allow you to build electronics projects in a very dynamic way, allowing you to easily experiment with different hardware configurations. You can easily swap modules to add or remove features, without spending most of the time with wiring, soldering or fastening of parts. Furthermore, your project's hardware assembly becomes mechanically more robust, making real life usage viable.
Now we are going to show an example of how to develop a project using Nanoshields. For that, we will build TempLog, a temperature measurement device with incorporated logging of date, time of day and temperature. You could use it, for example, to monitor a given place's temperature throughout days, months or years, and then retrieve the data to show it on a table of chart.
Select the modules
Let's determine what are the features we need for this project in the following sections, and which Nanoshields we need to make that happen.
1. Measure temperature
One way to measure temperature electronically is by using a thermocouple sensor. The Thermocouple Nanoshield allows you to integrate one of these sensors to your project. With it, it's possible to measure a wide temperature range, from -270ºC até 1372ºC (or -454ºF até 2502ºF), with a resolution of 0.25ºC (or 0.45ºF).
2. Track date and time
A good way to keep an accurate log of the date and time of each temperature reading is to use a real time clock, ou RTC. An RTC is capable of tracking date and time with a very low power consumption, being usually powered by a dedicated small battery. It can keep an accurate record of date and time even disconnected from other sources of power (e.g. the power grid). The RTCMem Nanoshield contains an RTC with its own battery and is the ideal choice to add date and time tracking to this project.
3. Store temperature, date and time
The RTCMem Nanoshield mentioned in the last section can also be used to store temperature, date and time. It contains integrated EEPROM memory which can be used for that purpose. An EEPROM is a type of non-volatile memory, meaning it retains the stored data without connection to any source of electrical power. The result of using EEPROM memory together with an RTC is that you can connect and disconnect your temperature monitor from the power outlet in a transparent way, always keeping accurate date and time records and never losing any data due to loss of power.
4. Data processing
To manage all the different parts of a project, including sensors, actuators and interfaces, a microcontroller is often used. This is the standard approach with Nanoshields, and it's one of the features that allow building a modular hardware system in this way.
The Nanoshields platform is Arduino-compatible, and there are many microcontroller options that can be used:
- Arduino Nano
- Arduino UNO
- Arduino Duemilanove
- Arduino Mega
- Arduino Diecimila
- Other modules that are compatible with the ones above
In our example, we are going to use the Alevino, which is the Arduino-compatible Nanoshield that we provide. It contains an 8-bit, 16MHz ATmega328 microcontroller, and you can program it in the same way you program an Arduino with the Arduino IDE. You can also use other, more traditional software development tools (like Atmel Studio, for instance).
5. Extracting data
To extract and analyze the recorded temperature, date and time, you can use the USB Nanoshield. With it, you can connect your project to a computer through a USB port in a very simple way. It creates a standard serial interface (COM port), such that you can use any standard serial terminal application, or your own code, to visualize the data.
Another essential feature of the USB Nanoshield is that it allows you to write you own software on your Alevino.
6. Putting everything together
To connect all the modules together you can use a Base Board. It contains a number of slots where you can simply plug in the Nanoshields that are part of your project.
Once you have all the modules at hand, the hardware assembly is very simple: you only need to plug all the modules on the slots available in the Base Board.
WARNING: when connecting the Nanoshields to the Base Board, it's very important to use the correct orientation, lining up the white square marks in the Base Board with the ones in the Nanoshields. Connecting a Nanoshield in the opposite orientation can cause malfunction and, possibly, irreversible damage to your modules. See the example in the image below: there we can see that the Nanoshields connected to slots 1, 2 and 4 are connected correctly, since the white marks on the Base Board are lined up with the white marks on the Nanoshields. However, the Nanoshield in slot 3 is incorrectly connected, because it's white mark is not aligned with the in the Base Board.
See below an image of all the modules mounted on top of the Base Board:
After assembling the hardware, we have to write the software that will make the microcontroller execute the tasks needed by the project. The tasks for this project are basically these:
- Read temperature from the Thermocouple Nanoshield
- Read current date and time from the RTCMem Nanoshield
- Create a record to store temperature, date and time
- Read and write the record above to the EEPROM memory in the RTCMem Nanoshield
- Transmit the collected data through the USB interface
To learn how to perform the tasks above, check out more details at the TempLog project page. There, you will find all the project source code and more details on how to use the open source software libraries that we provide.
Now that you already know how to use the Nanoshields, check out the modules section, choose your Nanoshields and create your own projects!