Board configuration and programming
Following one of the main premises that guided the design of the Waspmote Prototyping Board 2.0, to offer the highest flexibility possible, only the pads' connections which give access to the mote's microprocessor input and output signals and to each one of the adaptation stages have been fixed, allowing to use any resources considered necessary in user's design. This way, to use any of the board's components or signals it will be necessary to weld a pin or cable to its access pad.
To facilitate handling of the different stages which have been added to the Prototyping Board 2.0, a series of functions have been implemented in the WaspSensorPrototyping_v20 library. When using the Prototyping Board 2.0 on Waspmote, remember it is mandatory to include the SensorProtov20 library by introducing the next line at the beginning of the code:
Next, the different functions that make up the library are described:
Turns on the sensor board by activating the 3.3 V and 5 V supply lines:
Turns off the sensor board by cutting the 3.3 V and 5 V supply lines:
This function is used to manage the power applied to the board. Assigning the value
SENS_ONto the variable
MODEactivates the board's switches which allow the passage of 3.3 V and 5 V voltage, while assigning the value
SENS_OFFdisconnects both switches cutting the power. This function is called inside
When a floating point (
float) value is assigned to the function
readADC(), it reads the analog-to-digital converter record through the I2C bus and returns the voltage value stored. Given that the chosen converter carries out the voltage conversion in its input immediately after reading, on occasions in which the time between record readings is high, so that the change in the converter's value may be significant, it may be recommended to carry out the reading instruction two consecutive times, at least 20 milliseconds apart, discarding the first of the values obtained and accepting the second.
This function allows the capture of the voltage value of one of the analog input pins to the Waspmote, indicating the variable
ANALOG7). Once a floating point (
float) variable is assigned it returns a value between 0 and 3.3 V, the maximum value which the Waspmote microprocessor can read at its input.
The files of the sensor board itself are: WaspSensorPrototyping_v20.h, WaspSensorPrototyping_v20.cpp