Building Connected Things with Windows 10 IoT and Microsoft Azure
Shield and Port Descriptions
The GrovePi is stacked on top of the Raspberry Pi 2 without the need for any other connections. Communication between the two occurs over the I2C interface. All Grove modules connect to the universal Grove connectors on the GrovePi shield via the universal 4 pin connector cable.
Grove modules, which work on analog and digital signals, connect directly to the ATMEGA328 microcontroller (the same MCU as the Arduino Uno) on the Grove Pi. The microcontroller acts as an interpreter between the Raspberry Pi 2 and the Grove sensors. It sends, receives, and executes commands sent by the Raspberry Pi 2.
In addition, the GrovePi allows the Raspberry Pi 2 to access some Grove sensors directly. The Raspberry Pi 2 has an I2C Bus and a Serial bus. These buses can directly connect to sensors via the I2C Ports and the USART Port.
The GrovePi runs an ATmega328 which contains an onboard 6 channel analog-to-digital (A/D) converter. The A/D converter has 10-bit resolution, returning values 0-1023. Analog pins are usually used for reading analog sensors but can also be used for general purpose i/o, just like the digital pins 0-13. If you need more digital sockets, you can re-purpose an analog socket.
The pinMode() method is used to set the pin to INPUT or OUTPUT.
analogRead(2) and digitalRead(2) will read from different GrovePi sockets.
- grovepi.analogRead(2) will read from the socket labelled A2.
- grovepi.digitalRead(2) will read from the socket labelled D2.
GrovePi sockets A0, A1, and A2 use the A/D converter and support
analogRead() values 0-1023.
GrovePi sockets D2 through D8 are digital and support 1-bit input/output, values 0-1, using
GrovePi sockets D3, D5, D6 also support Pulse Width Modulation (PWM) which means you can write 8-bit values 0-255 with
You can’t use
analogRead() with D3, D5, D6; it is only supported on A0, A1, and A2 (aka D14, D15, and D16).
Sensors and Actuators
The sensors and actuators included in the GrovePi+ Starter Kit can be classified as follows:
|Type||Direction||Examples||GrovePi API Calls|
|Analog||Input||Light sensor, Temperature sensor, Rotary Angle sensor, Sound sensor||SensorValue()|
|Digital||Input||Button, Ultrasonic Range sensor||CurrentState(), MeasureInCentimeters()|
|Digital||Output||LED, Buzzer, Relay||ChangeState(SensorStatus)|
|I2C||Output||RGB LCD Display||SetBackLightRgb(r,g,b), SetText(string)|
This information is taken from http://www.dexterindustries.com/GrovePi/engineering/port-description/.
Conclusion & Next Steps
In this lab, you learned how the GrovePi solution works. Next, you will use the Raspberry Pi 2 and the GrovePi to build the IoT equivalent of ‘Hello, World!’. That is to say, you will make an LED blink.