Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino Pin Guide

pins analog digital uart rx tx pwm

  • Please log in to reply
7 replies to this topic

#1 tridy

tridy

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationStockholm, Sweden

Posted 11 September 2015 - 01:08 PM

Hello.

 

I was wondering if there a guide somewhere that describes what different connection pins are, how they are different and why this and not another type of connection is used, as well as an example of a module/component that could be connected to each pin type.

 

digital pin
analog pin
UART pin
RX/TX
PWM/MOSI
MISO
SPCK
SD/SC
SDA/SCL

 

 

what happened to wiki, by the way?
 



#2 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 11 September 2015 - 07:49 PM

Interesting that the Wiki has disappeared, there were several pin outs for the Netduino family in there.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#3 Dr Who

Dr Who

    Advanced Member

  • Members
  • PipPipPip
  • 261 posts
  • LocationNYC

Posted 12 September 2015 - 04:05 AM

Interesting that the Wiki has disappeared, there were several pin outs for the Netduino family in there.

 

Regards,

Mark

I believe the site itself is offline. Oddly enough several days ago the database behind this forum had taken a brief sabbatical.



Doctor Who
"This signature does not exist!"

#4 TechnoGuy

TechnoGuy

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • LocationCanada

Posted 12 September 2015 - 07:30 AM

See this post:

Netduino Plus 2 Pinout Reference Sheet

http://forums.netdui...eference-sheet/

 

 

There is a nice diagram attached.  I refer to it all the time & it prints out nicely.

http://forums.netdui...&attach_id=2376


- Ian

 

My Current Dev Boards:

  • 3 x Netduino Plus 2
  • 1 x Netduino 3 WiFi

#5 tridy

tridy

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationStockholm, Sweden

Posted 14 September 2015 - 07:45 AM

well, gurus, how about "what this type of pin can do and what cannot"? What are all those pins anyways? Why are they different?

 

For example, why would I use Analog Pin and not RX1? What is so special about I2C and when should I use it? Or any other pin actually. What would happen if I instead of  digital in I use analog in? Well, things like that.

 

I am sure there are people like me who have experience with programming/development on the full scale computers and not so much with the hardware on the lower level. While it might be easy to guide a novice into flashing a led step by step, as soon as one starts asking why have you plugged the led into this pin and not that, exploring of inputs and outputs might be a good area to explore, especially if it's possible to damage the device by doing it incorrectly.



#6 TechnoGuy

TechnoGuy

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • LocationCanada

Posted 14 September 2015 - 09:54 AM

First, a disclaimer:  I'm still learning as well ... I do NOT claim to be a guru.

 

Before going on, I will let you know that some of what you're asking is actually covered off in Chris Walker's book, "Getting Started with Netduino".  He does discuss the differences between the digital pins and the analog pins and how to use them.

 

Digital vs Analog Pins

Basically, the digital pins are meant for doing discrete logic (i.e. on/off or "black & white") whereas the analog pins are meant for dealing with ranges of values.  Each analog pin can discern between 4096 possible values.  If you think of the digital pins as handling black & white situations (i.e. on/off or yes/no), the analog pins handle the grey area in between.

  • You can connect on/off switches to the digital pins & turn things (e.g. LEDs) on/off with them.
  • You can connect things like analog sensors & potentiometers to the analog pins.

Overloaded Usage of the Digital Pins

You will see in the referenced diagram that all of the digital pins can be used for MORE than just turning things ON/OFF (or reading when things have switched states).  You will find that the certain subsets of the pins can be used in tandem to implement certain communication protocols.  In particular, the board supports these communication protocols:

I have included in the above list links to the corresponding Wikipedia articles.

 

Your choice of which pin(s) you use will generally be governed by the requirements of whatever sort of device you wish to connect to the Netduino.  For example, I have purchased a variety of temperature &/or humidity sensors from an outfit called Adafruit (they have good stuff).  I've purchased other things from a company called SparkFun Electronics (good stuff also).

  • My HTU21D-F temperature & humidity sensor communicates using I2C, so I have to use the 3V3, GND, SCL & SDA pins on Netduino to communicate with it
  • My DS18B20 temperature sensor communicates using OneWire, so I have to use 3V3, GND and then ANY available Digital I/O pin
  • I just got something called a BME280 (temperature, humidity & pressure) which can connect using either SPI or I2C, so this gives me options...
  • There's a fellow on the Netduino Forums who's using a TMP36 (Analog Temperature Sensor) to read temperature & upload it to a database - he has to interface it using 3V3, GND & one of the analog pins.

You basically need to read the product descriptions when you're buying these things.  Both of the companies mentioned above offer sample code (but it's written for the Arduino) and tutorials on making the connections.  You will benefit from going and reading the datasheets as well...  (I get my kicks from reading the Arduino code samples & translating them into equivalent code that runs under NETMF).

 

About the differences between the different communications protocols (I'm sure other people will have more to say about this or correct anything here that's not quite on the money):

  • I2C is considered to be a low speed communications protocol - it's used when the amount of data to be transferred is generally small (I have found that sensors usually use I2C versus SPI).  Usually you send a 1 or 2 byte command and get back a 2-4 byte response.
  • SPI is a high speed communications protocol (I have found that things like high resolution LCD & OLED displays are frequently implemented using SPI).
  • I2C & SPI are bus-oriented (i.e. you can connect multiple things to the bus / share communication lines).  With I2C, devices are distinguished from one another by means of a hard-coded bus address.  With SPI, an extra wire (one per device) is used to distinguish between devices.
  • OneWire is also a bus-oriented communications protocol.
  • I2C & SPI communicate using synchronous I/O (there is a separate clock signal)
  • UART-based devices communicate using asynchronous I/O (there is NO separate clock signal)
  • (I believe) that I2C & SPI peripheral devices need to be in fairly close proximity to the controller (i.e. the Netduino)
  • UART & OneWire devices can actually be more distant from the controller (with UART you'd use a TTL to RS-232 converter for this purpose...)

I'll leave it here for now.  My recommendation would be for you to buy a couple of temperature sensors and to read the various tutorials on how to use them / read the datasheets.  As mentioned above, the code samples are almost invariably oriented around the Arduino.  There's lots of benefit to be gained from "porting" the code over to NETMF (translating it).

 

If you want some particular recommendations, I'd suggest getting the following:

  • DS18B20 (OneWire):  $3.95 @ Adafruit
  • TMP36 (Analog):  $1.50 @ Adafruit
  • MCP9808 (I2C):  $4.95 @ Adafruit

That's 3 sensors for less than $11.00 US.  (Not including the shipping costs).

 

I have working code for all of these; I can share it with you.  There is working code for the DS18B20 posted in the forums also.


- Ian

 

My Current Dev Boards:

  • 3 x Netduino Plus 2
  • 1 x Netduino 3 WiFi

#7 TechnoGuy

TechnoGuy

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • LocationCanada

Posted 14 September 2015 - 10:01 AM

Correction:  I have working code for DS18B20, MCP9808 & HTU21D / HTU21D-F.  I don't have a TMP36.


- Ian

 

My Current Dev Boards:

  • 3 x Netduino Plus 2
  • 1 x Netduino 3 WiFi

#8 tridy

tridy

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationStockholm, Sweden

Posted 14 September 2015 - 03:41 PM

Nice. Thanks for the explanations. I appreciate that.

 

So, that's pretty much the device/component that I am connecting that should say in the description/datasheet how it communicates and from that I should look if and how it's possible to connect it to Netduino.

 

It is still kind of interesting that temperature sensors use different connections. I would think that some of the connections are more accurate and reliable (for example in medicine one would want a pretty accurate result compared with just room or water in the pool temperatures).

 

The first thing that I was hungry about when I first started using Netduino is to create a RF 433.92 signal repeater and that did not work well because of how fast and timespan dependent the readings should be. So I had to use Arduino for that.

 

Thanks for pointing to Adafruit, I will take a look what kind of components they have there.







Also tagged with one or more of these keywords: pins, analog, digital, uart, rx, tx, pwm

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.