PINOUTS

Liked this post? Share with others!

Analog Pins

The IndusBoard coin has 16 analog pins that can be used through the analogRead() function.

value = analogRead(pin, value);

PWM Pins

Most of the digital & analog pins can be used as PWM (Pulse Width Modulation) pins. There are a total of 26 PWM pins on the IndusBoard coin.

analogWrite(pin, value);

Digital Pins

There are a total of 32 digital pins, out of which the 16 pins can be used as both analog and digital pins.

To use them, we first need to define them inside the void setup() function of our sketch.

pinMode(pin, INPUT); //configured as an input

pinMode(pin, OUTPUT); //configured as an output

To read the state of a digital pin:

state = digitalRead(pin);

To write a state to a digital pin:

digitalWrite(pin, HIGH);

VIN Pin

The IndusBoard coin operates at 3 V. The VIN pin is typically used for USB power, which is usually 5V. You can connect the 5V to the VIN pin and also to the 5V pin. This will provide power to both the board and the sensor.

If the board is powered through the 5V pin or USB, the voltage is regulated down to 3V to power the board. It can accept an input voltage range from 12V to 3.3V, which will be regulated to power the chip effectively.

If you’re using a 3.3V battery, connect it to the 3V pin. For sensors that operate on 5V, use USB power, which supplies 5V, and connect to the 5V pin.

Touch sensor

The board comes with 15 capacitive touch sensor pins. The onboard touch sensor facilitates touch input and can function as a switch or push button, eliminating the need for additional mechanical switches or buttons, which saves space and reduces costs. 

Utilizing the touch sensor, you can create an electrical switch board for controlling room lights, design a basic touch-based keyboard leveraging its built-in HID capability, develop touch control wearable devices, wireless switches, and more.

To read the data from the touch pin, we use the following command.

touchRead(Touch_Pin);  

IMU

The LSM303 by STM is an Inertial Measurement Unit (IMU) equipped with both a 3D digital accelerometer and a 3D digital magnetometer. It includes a machine learning core, making it ideal for motion detection projects like free-fall detection, step detection, counting steps, and functioning as a pedometer.

Additionally, this module incorporates an embedded temperature sensor for measuring environmental temperature.

To access the data from the accelerometer and magnetometer on board, we need to install the LSM303AGR library, which comes with examples that can be used directly with the IndusBoard coin.

.

To install the library kindly follow the following steps.

  1. Open Arduino IDE 2.0
  2. Click on the Library manager on the left panel
  3. Search for LSM303AGR in the search bar
  4. Click on STM32duino LSM303AGR by AST and select the latest version from the dropdown
  5. Click on the install button

It might take a few seconds to install fully. If you have already installed the library on Arduino IDE kindly check the version and update to the latest version.

After installing the library, to utilize it, include it at the beginning of your sketch.

#include <LSM303AGR_ACC_Sensor.h>

#include <LSM303AGR_MAG_Sensor.h>

And to initialize the components, we can use the following command inside void setup().

Acc.begin();

Acc.Enable();

Acc.EnableTemperatureSensor();

Mag.begin();

Mag.Enable();

The accelerometer data can be accessed through the following commands:

 int32_t accelerometer[3];

 Acc.GetAxes(accelerometer);

The magnetometer data can be accessed through the following commands:

 int32_t magnetometer[3];

 Mag.GetAxes(magnetometer);

The temperature data can be accessed through the following code:

float temperature;

Acc.GetTemperature(&temperature);

Communication

SPI

The pins used for SPI (Serial Peripheral Interface) on the IndusBoard coin are the following:

  • (MISO) – GPIO37
  • (MOSI) – GPIO35
  • (SCK) – GPIO36
  • (CS) – Any GPIO (except for A6/A7)

Apart from these pins any GPIO pins can be used as MISO, MOSI, SCK or CS pins.

To use SPI, we first need to include the SPI library.

#include <SPI.h>

Inside void setup() we need to initialize the library.

SPI.begin();

And to write to the device:

digitalWrite(CS_pin, LOW); //pull down the CS pin

SPI.transfer(address); // address for device, for example 0x00

SPI.transfer(value); // value to write

digitalWrite(CS_pin, HIGH); // pull up the CS pin

I2C

The pins used for I2C (Inter-Integrated Circuit) on the  IndusBoard coin are the following:

  • (SDA) – GPIO8
  • (SCL) – GPIO9

To use I2C, we can use the Wire library, which we need to include at the top of our sketch.

#include <Wire.h>

Inside void setup() we need to initialize the library.

Wire.begin();

And to write something to a device connected via I2C, we can use the following commands:

Wire.beginTransmission(1); //begin transmit to device 1

Wire.write(byte(0x00)); //send instruction byte 

Wire.write(val); //send a value

Wire.endTransmission(); //stop transmit

UART

The pins used for UART (Universal asynchronous receiver-transmitter) are the following:

  • (Rx) – GPIO44
  • (Tx) – GPIO43

To send and receive data through UART, we will first need to set the baud rate inside void setup().

Serial1.begin(115200);

To read incoming data, we can use a while loop() to read each individual character and add it to a string.

while(Serial1.available()){

    delay(2);

    char c = Serial1.read();

    incoming += c;

  }

Learn how we helped 100 top brands gain success