Manage Analog Sensor With Raspberry Pi2

Introduction

We continue our path on the development and prototyping with the board RaspberryPi2. In the previous article found at this link, our goal was to control the switching of an LED. In recent days, among other things, and the new release of Windows 10 IoT, namely 10.0.10586.0, which has brought with it several new features that we will see in later articles in this. Our goal now and that as the title, to manage an analog sensor. Unlike a digital, analog sensor it said very briefly, is taken as one example of temperature, provides a constant voltage value in time, according to the temperature value which is detected by the sensor itself. Another example, a potentiometer, a resistance variable type, which according to how we act on it through his knob, will vary its value in ohms and therefore also varies the value of the output voltage. Until version 10.0.10240.0 to which we refer, there and the opportunity to connect analog sensors on the GPIO pin as missing inputs and PWM outputs (which stands for power with modulation), so we have to resort to so-called Converter ADC (Analog to Digital converter), namely an electronic circuit capable of converting an analog signal into a binary value expressed in bytes.

Hardware required

After this brief introduction, we move to the next step. For the realization of our circuit, we need the following hardware material:

  • Raspberry Pi2 with installed version 10.0.10240.0 with power cable.
  • HDMI cable so as to connect the Raspberry Pi2 to a monitor.
  • Monitor with HDMI input.
  • Ethernet cable.
  • Breadboard, which is the necessary basis for mounting components and electrical wiring.
  • Jumper male-male and male-female.
  • Analog temperature sensor TMP36.
  • MCP3008 ADC converter.

A brief mention on the chip MCP3008

The datasheet you found at this link, it is an analog / digital converter powered at a voltage of 5 v DC max, 10 bit resolution. The following are the main features.

  • 10-bit resolution
  • ± 1 LSB max DNL
  • ± 1 LSB max INL
  • 4 (MCP3004) or 8 (MCP3008) input channels.
  • Analog inputs programmable as single-ended or pseudo-differential pairs.
  • On-chip sample and hold
  • SPI serial interface (modes 0,0 and 1,1)
  • Single supply operation: 2.7V - 5.5V
  • 200 ksps max. sampling rate at VDD = 5V
  • 75 ksps max. sampling rate at VDD = 2.7V
  • Low power CMOS technology
  • 5 nA typical standby current, 2 uA max.
  • 500 uA max. active current at 5V
  • Industrial temp range: -40 ° C to + 85 ° C • Available in PDIP, SOIC and TSSOP packages.

We can observe that the type of communication with the raspberry occurs through SPI protocol. Here's the pin.

The pin MCP3008
      Figure 1: The pin MCP3008

Starting from pin 1 to pin 8, we have Channels form CH0 to CH7, where we will connect the output of / Analog sensors. Each channel as we shall see must be configured by following the manufacturer's instructions as per attached datasheet. The pins 16-15 are connected to the positive pins 14-9 to zero volts (or Ground of the raspberry Pi2). The pins on pins 13-12-11-10 on bus SPI0 or SPI1 Raspberry Pi2.

Electrical / electronic circuit

The following is the final circuit of our project, undertaken with Fritzing, excellent software for the creation of patterns electrical / electronic.

The electronic circuit
                                                      Figure 2: The electronic circuit

Not to be confused in the electrical connections, see below how to connect the GPIO with the MCP 3008. Observing figure 1, we see that between the pins 1 and 16 we have a sign of recognition, by turning the component by 90 ° counterclockwise, pin 1 will be the one at the bottom left, pin 8 is the one on the bottom right, the top right 9 and 16 in the upper left.

  • PIN 16 MCP3008 ----> 3.3V DC (RED CABLE)
  • PIN 15 MCP3008 ----> 3.3V DC (RED CABLE)
  • PIN 14 MCP3008 ----> GND (BLACK CABLE)
  • PIN 13 MCP3008 ----> SPIO_SCLK (RED CABLE)
  • PIN 12 MCP3008 ----> SPIO_MISO (CABLE GREY)
  • PIN 11 MCP3008 ----> SPIO_MOSI (BLUE WIRE)
  • PIN 10 MCP3008 ----> SPIO_CE0_N DC (GREEN LEAD)
  • PIN 9 MCP3008 ----> GND (BLACK CABLE)
  • PIN 1 MCP3008 ----> PIN SENSOR VOUT TMP36 DC (YELLOW CABLE)

These are connections chip MCP3008 with the card Raspberry Pi2.

Temperature Sensor TMP36

Pinout Sensor TMP36
      Figure 3: Pinout Sensor TMP36

It is an analog temperature sensor, which supplies a voltage value of 10mV for degree directly proportional to the temperature value which is detected. It has a reading range that goes from -40 to 125 ° C. Here's how to connect it. Looking at the picture above, we see that it has three pins, the first on the left (1) connect me to the voltage of 3.3 v DC, the center pin (2) as shown on the input CH0 of the MPC3008, the pin right (3) on GND.

  • PIN LEFT TMP36 ----> 3.3V DC (RED CABLE)
  • PIN CENTRAL TMP36 ----> ON PIN 1 MCP3008 (YELLOW CABLE)
  • PIN RIGHT TMP36 ----> GND (BLACK CABLE)

Create the test project with Visual Studio 2015

Once the hardware part, the materials needed for the components and their characteristics, and now time to focus on the software side. We will use Visual Studio 2015. If you have not been carried out and, besides Visual Studio 2015 and Windows 10 (at least the Professional version), you must download and install the SDK for the development of Windows 10 that find this link. After installation finishes, we start Visual Studio 2015, and create using the File, New Project application using the blank template app (Windows Universal) as shown and call the project "AnalogTemperature".

New screen project
                                                         Figure 4: New screen project

Confirm with OK button. A project created to develop within the IoT, we need the necessary libraries. In exploring solutions position the cursor to the "References", right click select "Add Reference” and the subsequent screens to the "Extensions" select Windows IoT extensions for the UWP as visible in the next picture.

Management screen references
                                                Figure 5: Management screen references

In terms of extensions we have everything you need. We now need to create a couple of classes that will serve for the management of the sensor TMP36 and MCP 3008.

Creating Classes MCP3008 and TMP36

In exploring solutions, we place the cursor on the project name, right-click and choose "Insert" and right after "Class" and we call the MCP3008 as a chip. In the same way, we create a class called TMP36. Within the class MCP3008 insert the following code,

  1. using System;  
  2. using Windows.Devices.Enumeration;  
  3. using Windows.Devices.Spi;  
  4. using Windows.UI.Popups;  
  5.   
  6. namespace AnalogTemperature  
  7. {  
  8.     public class MCP3008  
  9.     {  
  10.         SpiDevice _device;  
  11.         TMP36 _TMP36 = new TMP36();  
  12.         string _CHOICECHANNEL;  
  13.   
  14.   
  15.         const double _MAXVALUE = 1023.0;  
  16.         const int _MINVALUE = 0;  
  17.         const int _RESOLUTIONBITS = 10;  
  18.         const int _SHIFTBYTE = 8;  
  19.   
  20.         byte[] _CH0 = new byte[] {1, 0x80, 0};  
  21.         byte[] _CH1 = new byte[] {1, 0x90, 0};  
  22.         byte[] _CH2 = new byte[] {1, 0xA0, 0};  
  23.         byte[] _CH3 = new byte[] {1, 0xB0, 0};  
  24.         byte[] _CH4 = new byte[] {1, 0xC0, 0};  
  25.         byte[] _CH5 = new byte[] {1, 0xD0, 0};  
  26.         byte[] _CH6 = new byte[] {1, 0xE0, 0};  
  27.         byte[] _CH7 = new byte[] {1, 0xF0, 0};  
  28.         byte[] _DATARECEIVED =  new byte[] {0, 0, 0};  
  29.   
  30.   
  31.   
  32.         /// <Param name = "serialcomunication">Define type comunication</ Param>  
  33.         /// <Param name = "channel">Define number of channel MCP3008</ Param>  
  34.         /// <Param name = "spicomunication">Define spicomunication channel</ Param>  
  35.         /// <Param name = "fashions">Define spi mode</ Param>  
  36.         public async void InitializeMCP3008 (SerialComunication serialcomunication,Channel channel,SpiComunication spicomunication, SpiMode mode)  
  37.         {  
  38.             var spiconnectionsettings = new SpiConnectionSettings((int) Spicomunication);  
  39.             spiconnectionsettings.ClockFrequency = _TMP36.CLOCK_SIGNAL;  
  40.             spiconnectionsettings.Mode = mode;  
  41.   
  42.             string spiDevice = SpiDevice.GetDeviceSelector (Spicomunication.ToString ());  
  43.             var deviceInformation = await DeviceInformation.FindAllAsync (SpiDevice);  
  44.   
  45.             if(DeviceInformation! = null && DeviceInformation.Count> 0)  
  46.             {  
  47.                 _device = await SpiDevice.FromIdAsync (DeviceInformation [0] .id, spiconnectionsettings);  
  48.                 _CHOICECHANNEL = Channel.ToString ();  
  49.             }  
  50.   
  51.             else  
  52.             {  
  53.                 var dialog = new MessageDialog("Device Not Found");  
  54.                 await dialog.ShowAsync ();  
  55.                 return;  
  56.             }  
  57.         }  
  58.   
  59.         public double ReturnResult ()  
  60.         {  
  61.             switch (_CHOICECHANNEL)  
  62.             {  
  63.                 case "CH0":  
  64.                     _DEVICE.TransferFullDuplex (_CH0, _DATARECEIVED);  
  65.                     break;  
  66.   
  67.                 case "CH1":  
  68.                     _DEVICE.TransferFullDuplex (_CH1, _DATARECEIVED);  
  69.                     break;  
  70.   
  71.                 case "CH2":  
  72.                     _DEVICE.TransferFullDuplex (_CH2, _DATARECEIVED);  
  73.                     break;  
  74.   
  75.                 case "CH3":  
  76.                     _DEVICE.TransferFullDuplex (_CH3, _DATARECEIVED);  
  77.                     break;  
  78.   
  79.                 case "CH4":  
  80.                     _DEVICE.TransferFullDuplex (_CH4, _DATARECEIVED);  
  81.                     break;  
  82.   
  83.                 case "CH5":  
  84.                     _DEVICE.TransferFullDuplex (_CH5, _DATARECEIVED);  
  85.                     break;  
  86.   
  87.                 case "CH6":  
  88.                     _DEVICE.TransferFullDuplex (_CH6, _DATARECEIVED);  
  89.                     break;  
  90.   
  91.                 case "CH7":  
  92.                     _DEVICE.TransferFullDuplex (_CH7, _DATARECEIVED);  
  93.                     break;  
  94.             }  
  95.   
  96.             var result = ((_DATARECEIVED [1] & 0x03) << _SHIFTBYTE) + _DATARECEIVED [2];  
  97.             var mVolt = result * (_TMP36.VOLTAGE / _MAXVALUE);  
  98.             var tempCelsius = mVolt / _RESOLUTIONBITS;  
  99.             return tempCelsius;  
  100.         }  
  101.     }  
  102.   
  103.     public enum SerialComunication  
  104.     {  
  105.         SINGLE_ENDED,  
  106.         DIFFERENTIAL  
  107.     }  
  108.   
  109.     public enum Channel  
  110.     {  
  111.         CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7  
  112.     }  
  113.   
  114.     public enum SpiComunication  
  115.     {  
  116.         SPI0,  
  117.         SPI1  
  118.     }  
  119. }  
Let's analyze the code above. They were defined variables at the class level. The first is nothing but the base class for testing and managing device connected to / and SPI ports of GPIO.
  1. SpiDevice _device;  
Here we define a new object type TMP36 that we will see later.
  1. TMP36 _TMP36 = new TMP36();  
The variables that follow, are all features of the integrated circuit MCP3008, starting from _MAXVALUE, which will be the maximum value in a 10-bit resolution as features found in the datasheet. _MINVALUE is the minimum value, _RESOLUTIONBITS and the maximum resolution of the MCP3008, _SHIFTBYTE representing the movement of 8 bits that must be performed once acquired the values that are returned from the DOUT pin of the MCP3008. The variables from _CH0 to _CH7 represent the eight channels available where you can connect an analog component, we will use in this example the _CH0. The variable _CHOICECHANNEL, will serve to store and what channel was used and pass the byte with the correct configuration, we will see it in the method ReturnResult (). Remains _DATARECEIVED, the byte that contains the end of the bit information to be processed and displayed to the user as the detected temperature.
  1. string _CHOICECHANNEL;  
  2. const double _MAXVALUE = 1023.0;  
  3. const int _MINVALUE = 0;  
  4. const int _RESOLUTIONBITS = 10;  
  5. const int _SHIFTBYTE = 8;  
  6.   
  7. byte[] _CH0 = new byte[] {1, 0x80, 0};  
  8. byte[] _CH1 = new byte[] {1, 0x90, 0};  
  9. byte[] _CH2 = new byte[] {1, 0xA0, 0};  
  10. byte[] _CH3 = new byte[] {1, 0xB0, 0};  
  11. byte[] _CH4 = new byte[] {1, 0xC0, 0};  
  12. byte[] _CH5 = new byte[] {1, 0xD0, 0};  
  13. byte[] _CH6 = new byte[] {1, 0xE0, 0};  
  14. byte[] _CH7 = new byte[] {1, 0xF0, 0}  
  15. byte[] _DATARECEIVED = new byte[] {0, 0, 0};  
The method InitializeMCP3008, requires certain parameters, the first and the type of management data read from the channels of MCP3008, that we can set to "single-ended" or "Differential" as required in the datasheet, the channel on which connect the sensor in our TMP36 case of CH0, which we use on the SPI port GPIO, then the mode of communication on the SPI bus.
  1. /// <Param name = "serialcomunication">Define type comunication</ Param>  
  2. /// <Param name = "channel">Define number of channel MCP3008</ Param>  
  3. /// <Param name = "spicomunication">Define spicomunication channel</ Param>  
  4. /// <Param name = "fashions">Define spi mode</ Param>  
  5. public async void InitializeMCP3008(SerialComunication serialcomunication, Channel channel, SpiComunication spicomunication, SpiMode mode)  
  6. {  
  7.   
  8.     //It is defined as an instance of the class SpiConnectionSettings, passing an integer argument that defines which SPI bus is used,  
  9.     //for we will be 0.  
  10.   
  11.     var spiconnectionsettings = new SpiConnectionSettings((int) Spicomunication);  
  12.   
  13.     //Then we set the clock frequency and mode.We note to set the clock rate we use a class property TMP36.  
  14.   
  15.     spiconnectionsettings.ClockFrequency = _TMP36.CLOCK_SIGNAL;  
  16.     spiconnectionsettings.Mode = mode;  
  17.   
  18.     //Subsequently, with the class and method SpiDevice GetDeviceSelector, we get all the SPI bus on the card Raspberry Pi2.  
  19.   
  20.     string spiDevice = SpiDevice.GetDeviceSelector(Spicomunication.ToString());  
  21.   
  22.     //This section with the class DeviceInformation, we retrieve all the necessary information on / the SPI bus.  
  23.   
  24.     var deviceInformation = await DeviceInformation.FindAllAsync(SpiDevice);  
  25.   
  26.     //If the parameter deviceInformation not null, and greater than zero, we can define which SPI bus use, open the channel of communicat ion that we have set for us will be how SPI0 said, passing the method FromIdAsync Id bus and configuration.  
  27.   
  28.     if(DeviceInformation! = null && DeviceInformation.Count > 0)  
  29.     {  
  30.         _device = await SpiDevice.FromIdAsync(DeviceInformation[0].id, spiconnectionsettings);  
  31.         _CHOICECHANNEL = Channel.ToString();  
  32.     }  
  33.   
  34.     Else  
  35.   
  36.     //If there has been no SPI warn the user with a MessageDialog.  
  37.   
  38.     {  
  39.         var dialog = new MessageDialog("Device Not Found");  
  40.         await dialog.ShowAsync();  
  41.         return;  
  42.     }  
  43. }  
In this method, according to the channel that we decided to use, always it will be call the method TransferFullDuplex, who will send the settings on each channel selected on the SPI bus, and the second parameter byte where you will store the converted data from the signal analog to digital that we then process in a timely manner. Finally we will have a result which will be our final temperature value.
  1.     public double ReturnResult ()  
  2.     {  
  3.         switch (_CHOICECHANNEL)  
  4.         {  
  5.             case "CH0":  
  6.                 _DEVICE.TransferFullDuplex (_CH0, _DATARECEIVED);  
  7.                 break;  
  8.   
  9.             case "CH1":  
  10.                 _DEVICE.TransferFullDuplex (_CH1, _DATARECEIVED);  
  11.                 break;  
  12.   
  13.             case "CH2":  
  14.                 _DEVICE.TransferFullDuplex (_CH2, _DATARECEIVED);  
  15.                 break;  
  16.   
  17.             case "CH3":  
  18.                 _DEVICE.TransferFullDuplex (_CH3, _DATARECEIVED);  
  19.                 break;  
  20.   
  21.             case "CH4":  
  22.                 _DEVICE.TransferFullDuplex (_CH4, _DATARECEIVED);  
  23.                 break;  
  24.   
  25.             case "CH5":  
  26.                 _DEVICE.TransferFullDuplex (_CH5, _DATARECEIVED);  
  27.                 break;  
  28.   
  29.             case "CH6":  
  30.                 _DEVICE.TransferFullDuplex (_CH6, _DATARECEIVED);  
  31.                 break;  
  32.   
  33.             case "CH7":  
  34.                 _DEVICE.TransferFullDuplex (_CH7, _DATARECEIVED);  
  35.                 break;  
  36.         }  
  37.   
  38.         var result = ((_DATARECEIVED [1] & 0x03) << _SHIFTBYTE) + _DATARECEIVED [2];  
  39.         var mVolt = result * (_TMP36.VOLTAGE / _MAXVALUE);  
  40.         var tempCelsius = mVolt / _RESOLUTIONBITS;  
  41.         return tempCelsius;  
  42.     }  
  43. }  
_DATARECEIVED, is a byte array, we serve the first two left bits of the second element, while the first, _DATARECEIVED [0] we ignore it because there will be no value. Then we go to add up _DATARECEIVED [1] with _DATARECEIVED [2]. The subsequent calculations do nothing but obtain the value of temperature, _TMP36.VOLTAGE to note, that we will see later. I also added three enumerations that will be used when the MainPage define the code to implement the method InitializeMCP3008, are the type of communication channel used and what bus SPI intend to send and receive data.
  1. public enum SerialComunication  
  2. {  
  3.     SINGLE_ENDED,  
  4.     DIFFERENTIAL  
  5. }  
  6.   
  7. public enum Channel  
  8. {  
  9.     CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7  
  10. }  
  11.   
  12. public enum SpiComunication  
  13. {  
  14.     SPI0,  
  15.     SPI1  
  16. }  
This and the need for the class MCP3008. Now for the class TMP36, after you create it, insert the following code.
  1. namespace AnalogTemperature  
  2. {  
  3.     public class TMP36  
  4.     {  
  5.         const int _CLOCKSIGNAL = 1650000;  
  6.         const double _VOLTAGE = 2000;  
  7.   
  8.   
  9.         public int CLOCK_SIGNAL  
  10.         {  
  11.             get  
  12.             {  
  13.                 return _CLOCKSIGNAL;  
  14.             }  
  15.         }  
  16.   
  17.         public double VOLTAGE  
  18.         {  
  19.             get  
  20.             {  
  21.                 return _VOLTAGE;  
  22.             }  
  23.         }  
  24.     }  
  25. }  
Simply, the parameters that are defined are the clock frequency, and the maximum voltage that can dispense the sensor at maximum output, the TMP36 to 125 ° c, delivers a voltage of about 2 vdc.

Creation of the graphical interface and code in MainPage class


Now is time to define the necessary classes, let's see how to implement it in Class MainPage. In exploring solutions, double click with the mouse on MainPage.xaml, entered in the code define our user interface, by entering the following XAML.
  1. <Page  
  2.     x:Class= "AnalogTemperature.MainPage"  
  3.     xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  4.     xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"  
  5.     xmlns:local= "Using: AnalogTemperature"  
  6.     xmlns:d= "Http://schemas.microsoft.com/expression/blend/2008"  
  7.     xmlns:mc= "Http://schemas.openxmlformats.org/markup-compatibility/2006"  
  8.     mc:Ignorable= "D">  
  9.   
  10.     <Grid Background= "{ThemeResource ApplicationPageBackgroundThemeBrush} ">    
  11.         <Grid.RowDefinitions>  
  12.             <RowDefinition Height= "Auto" />  
  13.             <RowDefinition Height= "Auto" />              
  14.         </Grid.RowDefinitions>  
  15.   
  16.         <Grid.ColumnDefinitions>  
  17.             <ColumnDefinition Width= "Auto" />  
  18.             <ColumnDefinition Width= "Auto" />  
  19.             <ColumnDefinition Width= "Auto" />              
  20.         </Grid.ColumnDefinitions>  
  21.                     
  22.             <TextBlock Grid.Row= "0" Grid.ColumnSpan= "3" x:Name= "TxtHeader" FontSize= "50" Text= "TMP 36 MCP AND SAMPLE 3008" />  
  23.             <TextBlock Grid.Column= "0" Grid.Row= "1" x:Name= "TxtReadingTemp" FontSize= "30" Margin= "15,0,0,0" Text= "Temperature value is:" />  
  24.             <TextBlock Grid.Column= "1" Grid.Row= "1" x:Name= "TxtReading" FontSize= "30" Margin= "15,0,0,0" />  
  25.             <TextBlock Grid.Column= "2" Grid.Row= "1" x:Name= "TxtCelsius" FontSize= "30" Margin= "15,0,0,0" Text= "C" />                
  26.     </Grid>  
  27. </Page>  
In itself it is very simple, but enough to display the temperature value returned by the method ReturnResult () class MCP3008 that is our goal. With F7 key, enter in the code C #, entering the underside.
  1. using System;  
  2. using Windows.UI.Xaml;  
  3. using Windows.UI.Xaml.Controls;  
  4. using Windows.Devices.Spi;  
  5.   
  6. // The item template for the blank page is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x410  
  7.   
  8. namespace AnalogTemperature  
  9. {  
  10.     /// <Summary>  
  11.     /// Blank page that can be used independently or explored within a frame.  
  12.     /// </ Summary>  
  13.     public sealed partial class MainPage : Page  
  14.     {  
  15.         DispatcherTimer _timer = new DispatcherTimer();  
  16.         MCP3008 _mcp3008 = new MCP3008();  
  17.   
  18.         public MainPage ()  
  19.         {  
  20.             InitializeComponent ();  
  21.             _mcp3008.InitializeMCP3008 (SerialComunication.SINGLE_ENDED, Channel.CH0, SpiComunication.SPI0,SpiMode.Mode0);  
  22.             _timer.Interval = new TimeSpan(0, 0, 5);  
  23.             _timer.Start ();  
  24.             _timer.Tick + = _timer_Tick;  
  25.         }  
  26.   
  27.         private void _timer_Tick (object sender, object is)  
  28.         {  
  29.             txtReading.Text = Math.round (_mcp3008.ReturnResult ()). ToString ();  
  30.         }  
  31.     }  
  32. }  
Analyzing the previous C # code, we initialize a timer.
  1. DispatcherTimer _timer = new DispatcherTimer();  
We define an object of type MCP3008.
  1. MCP3008 _mcp3008 = new MCP3008();  
We InitializeMCP3008 implement the method, passing the necessary parameters.
  1. _mcp3008.InitializeMCP3008 (SerialComunication.SINGLE_ENDED, Channel.CH0, SpiComunication.SPI0,SpiMode.Mode0);  
We set the timers Interval property with a value of type TimeSpan 5 seconds, we start with the Start () method and finally we manage its Tick event.
  1. _timer.Interval = new TimeSpan(0, 0, 5);  
  2. _timer.Start ();  
  3. _timer.Tick + = _timer_Tick;  
Inside the event Tick, let's highlight the Text property of the TextBox txtReading, showing the temperature value by calling the ReturnResult (), but before we round the value with the static class Math and Round () method to remove decimal too.
  1. private void _timer_Tick (object sender, object is)  
  2. {  
  3.    txtReading.Text = Math.round (_mcp3008.ReturnResult ()). ToString ();  
  4. }  
Test the application

After the piece of code, before running the test application, there are a few things to see. The first being that we are developing on Raspberry Pi2, and to set the ARM compilation mode, you can invoke it from the pull down menu as in the following figure,

The main menu of Visual Studio 2015
Figure 6: The main menu of Visual Studio 2015

In reference to the previous image, you will notice that is on the run as "Remote computer". This is because we want to run the application on the card Raspberry Pi2. Select this mode, and go to the next screen to select the device and the IP address of the Raspberry Pi2 clearing authentication or you can change these settings by selecting the project, right-click, select "Properties" and immediately after "Debug", we will be led by the following screen.

Section debugging in the project properties
                                       Figure 7: Section debugging in the project properties

After this activity, we can run the Debugging. F5 key, and if everything was done correctly, that's what the monitor will display,

The sample application running on Windows 10
                  Figure 8: The sample application running on Windows 10 and Raspberry Pi2 IoT.

Conclusion

In this article we saw an introduction on what are the sensors Analog, and what an ADC, because the card RaspberryPi2 need this component to make use of sensors and instruments with analog signal. In future articles, we'll explore further using other components and see how to adapt different types of sensors and analog instruments on the ADC and Raspberry. 

Up Next
    Ebook Download
    View all
    Learn
    View all