PmodALS User Guide
Table of Contents
What is this Pmod
This is Digilent's PmodALS, an ambient light sensor. By utilizing the SPI protocol, this peripheral module is able to communicate information about the current ambient light level.
Features
This Pmod uses Texas Instruments ADC081S021, an 8-bit analog-to-digital converter, and Vishay Semiconductors TEMT6000X01 ambient light sensor. The ambient light level at 8 bits of resolution is transmitted via Serial Peripheral Interface.
Walk Around the Board
Photograph and table relaying what the numbered components are.
Walk around the board | |
---|---|
Number | Description |
1 | Pin header J1 to connect to the system board |
2 | ALS1, the ambient light sensor |
3 | IC1, the 8-bit analog-to-digital converter |
Physical Dimensions
This Pmod™ uses a standard 1×6 male pin header with 100 mil of spacing between each of the pins. The board is in a square shape that is 0.8 inches on each side to ensure that it will fit nicely next to other Pmods attached other Pmod headers.
Fritzing Files
How to Connect the Pmod
The PmodALS communicates with the host board via the SPI protocol. Since the on-board analog-to-digital converter is a read-only module, the only wires in the SPI protocol that are required are the Chip Select, Master-In-Slave-Out, and Serial Clock lines. The location of each of these lines on the Pmod header are shown in the table below.
Pin | Signal | Description |
---|---|---|
1 | CS | Chip Select |
2 | NC | Not Connected |
3 | SDO | Master-In-Slave-Out |
4 | SCK | Serial Clock |
5 | GND | Power Supply Ground |
6 | VCC | Power Supply (3.3V/5V) |
Table 1 Connector J1- Pin Descriptions as labeled on the Pmod
To connect these pins to the default SPI pins on a variety of chipKIT boards, you can check out the table below. If your board is not listed, or if you do not wish to use the default SPI protocol, or if you simply wish to learn more about SPI and the associated SPI library that Digilent uses, check out the SPI topic page.
Pmod pins | various chipKIT (Pro) pins | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
PmodALS | Uno32 | uC32 | Max32 | WF32 | Wi-FIRE | MX3 | Pro MX4 | Pro MX7 | DP32 | Pmod Shield | ||
Pin | Signal | Pin | Pin | Pin | Pin | Pin | Pin | Pin | Pin | Pin | Pin | |
1 | CS | 10 | 10 | 53 | 10 | 10 | JE-01 | JB-01 | JF-01 | RB3 | JC-01 | |
2 | NC | 11 | 11 | 51 | 11 | 11 | JE-02 | JB-02 | JF-02 | RB8 | JC-02 | |
3 | SDO | 12 | 12 | 50 | 12 | 12 | JE-03 | JB-03 | JF-03 | RB2 | JC-03 | |
4 | SCK | 13 | 13 | 52 | 13 | 13 | JE-04 | JB-04 | JF-04 | RB15 | JC-04 | |
5 | GND | GND | GND | GND | GND | GND | JE-05 | JB-05 | JF-05 | GND | JC-05 | |
6 | VCC | VCC | VCC | VCC | VCC | VCC | JE-06 | JB-06 | JF-06 | VCC | JC-06 |
Table 2 Corresponding Pin locations on chipKIT (Pro) boards for where the PmodALS can connect to
Communication Protocol
As mentioned previously, this Pmod uses SPI to communicate with the system board. As a read-only Pmod, information will never be sent to (or more specifically, received by) the PmodALS. This Pmod with it's 8-bit ADC will send out the 8 bits of data related to the ambient light level to the system board.
The data itself comes in a set of 15 bits– the first 3 bits are leading zeros, bits 4-11 are the information about the light level with the MSB first, and bits 12-15 are trailing zeros. However, there are 16 clock pulses that are associated with the operation of this Pmod.
The on-board ADC, which we are communicating with via the system board, is set up so that data is “clocked out” on the falling edge of the serial clock and is “clocked in” or “read” by the system board just before or on the subsequent rising edge of the serial clock. With this internal setup, it is recommended that after the chip select signal is brought to a low voltage state the serial clock is then raised to a high voltage state to ensure that enough time passes for ADC conversion so that the first falling clock edge “clocks out” valid data.
In terms of timings, it is recommended that the serial clock is run between 1 MHz and 4 MHz with a 50% duty cycle. An explanation of how you might set the serial clock frequency can be found here.
Power Requirements
The PmodALS has the following recommended/standard operating conditions based on the datasheets of the on-board components and in conjunction with the Digilent system boards:
Parameter | Value |
---|---|
Power Supply (VA) | 3.3V |
Input “High” | 2.1V (min) |
Input “Low” | 0.4V (max) |
Output “High” | VA - 0.2V (min) |
Output “Low” | 0.4V (max) |
Current Draw | 0.37 mA |
Power Consumption | 1.3 mW |
The PmodALS has the following absolute maximum ratings:
Parameter | Value |
---|---|
Power Supply (VA) | 2.7V - 5.25V |
Digital Input Pins Voltage Range | -0.3V - 5.25V |
Analog Input Pins Voltage Range | 0V - VA |
Input current at any pin | ±10 mA |
Power Dissipation | 100 mW |
Example Code
Example code for the PmodALS specific to Digilent Products can be found below:
code for MPIDE is completed; it needs to be cleaned up to have the “Digilent” look. I also need to determine where/how I might link to a file or where I would put the file to be publicly available (likely on the github once its ready)
Schematics and Additional Documentation
Schematics of the PmodALS can be found on the main page of the PmodALS or can be downloaded here. The datasheet for the 8-bit analog-to-digital converter, a Texas Instruments ADC081S021, can be found here. The datasheet for the on-board ambient light sensor, Vishay Semiconductors TEMT6000X01, can be found here.
FAQ
–I set up SPI like I normally do for other projects but I'm not getting back values that make any sense…
There are two possible issues here. One is that you may not have shifted the incoming data right four places to “get rid of” the trailing zeros. Another possibility is that your clock frequency is outside the recommended operating range of 1 MHz to 4 MHz. Check out the example code for more details on how to set the clock frequency.
Comments or questions not answered here should be put on the Digilent Forum. This page will then be appropriately updated as the need arises.