This block allows full control over the Prototype Sensor Board. You can read the values from any of the five analog inputs and read and write data to the six digital input/outputs. This allows you to safely connect your own electronics experiments to the NXT.
The five analog input channels are numbered A0 - A4. The six digital input/output bits are numbered B0 - B5. The board can also supply a range of voltages to help you power your experimental circuitry. There is a common GND (ground) which is the negative supply connection. There are four positive supply connections available, 5V, 9V, 4V and 3V. There is also an LED to warn you when power is being supplied to the board from the NXT. Commonly, you should disconnect the connection to the NXT while adjusting your experimental circuitry.
There are two versions of the Prototype Sensor Board, a solderless one as shown in the picture which is intended to be plugged into a solderless breadboard and a solderable one on which you can mount the components and wires you need permanently once you have your circutiry working correctly. Both boards work the same way as far as programming is concerned.
You must drag at least one output data wire from this block's data hub to another block for any information to be sent.
You can control the Color Sensor block dynamically by connecting data wires (from other block's data hubs) to the Color Sensor block's data hub.
Open a block's data hub by clicking the tab at the lower left edge of the block after it has been placed on the work area.
Data wires carrying input information to a block are connected to the plugs on the left side of its data hub. Data wires carrying output information are connected to the plugs on the right side.
[A] Input plug
[B] Output plug
[C] Number data wire (yellow)
[D] Logic data wire (green)
[E] Text data wire (orange)
[F] Broken data wire (gray)
If an input plug has a corresponding output plug (see A above), the input data will pass through from the input plug to the output plug without being changed. In this case, you can only use the output plug if the input plug is connected to an input data wire; connecting an output data wire to such an output plug without a connected input data wire will cause the output data wire to be "broken" (and colored gray).
Each data wire carries a specific type of data between blocks. For example, if a data wire is dragged from a logic plug on a block's data hub, it can only be connected to a logic plug on another block's data hub. The chart below shows what kind of data each plug can accept or send out.
Data wires are identified with specific colors: wires carrying number data are colored yellow, wires carrying logic data are colored green, and wires carrying text data are colored orange.
If you try to connect a data wire to a plug of the wrong data type, the data wire will be broken (and colored gray). You will not be able to download your program if a data wire is broken.
If you click a broken wire you can read why it is broken in the small help window in the lower right corner of the work area.
If an input data wire transmits a value outside the possible range of the plug it is connected to, the block will either ignore the value or change it to a value within its range. For plugs that allow just a few input values (example: just 0, 1, or 2), the plug will ignore the input if a value arrives outside its range.
For plugs that accept larger input ranges (example: 0 - 100), the plug will force any input outside its range to fit. For example, if a Move block's Power plug receives an input value of 150, the block will change the input value to 100 (i.e., a number within the Power plug's range).
You must click on the Data Hub to open it as shown.
This plug wires the number for which of your NXT's ports are connected to the prototype sensor.
The prototype analog channels A0 - A4 convert the input voltage in the range of 0 - 3.3 volts into a value in the range 0 - 1023.
The selected channel's value will be placed on the block's Read Analog output. The simplest way to convert these values into a voltage in units of milli-volts (1/1000 of volts) is to multiply the number by 129 and divide the result by 40.
Vmv= Value x 129 /40
If an input which is not connected to anything is read, it will return an unpredictable reading.
The prototype digital bits will be read as a value in the range 0 - 63.
Each digital port bit has a binary value as follows;
Bit | Value |
B0 | 1 |
B1 | 2 |
B2 | 4 |
B3 | 8 |
B4 | 16 |
B5 | 32 |
In order to make it easy to use the digital port's individual bits, it is necessary to use logical functions AND and OR. For example, if you wish to determine if bit B3 is a one or a zero, simply take the port value and AND it with 8 (the binary value for bit 3). If the bit was a one, the result will be non-zero, ie; 8. If the bit was a zero, the result will be zero.
The logic block can be downloaded from www.hitechnic.com.
The voltage level ranges for the logic inputs are;
Logic 0 0v - 0.5v
Logic 1 2v - 3.3v
The prototype digital connections can be set as inputs or outputs. A Digital Control register can be set to any value between 0 - 63. For each bit B0 - B5, a control bit of zero will configure the connection as an input whereas a control bit of one will configure it as an output. So for example, if you wish to make B0 - B3 as outputs and B4 and B5 as inputs, you would output a control value of 15 (1 + 2 + 4 + 8).
The corresponding bits in the Digital Out value will then be used to set the state of the prototype digital connections which have corresponding one bits in the Digital Control register.
An output which is set to a zero has a connection to GND which can sink up to 12mA. An output which is set to a one has a connection to the 3.3v supply can source up to 12mA.
When a connection is configured as an output, its current state will be reflected when the digital port is read.
There are four power supply outputs available.
9V
The 9V output is basically the NXT battery voltage which is normally provided to sensors. This voltage may range from 6 - 9 volts and can supply about 12mA.
5V
The 5V supply is provided by a 5.0 volt regulator connected to the 9V supply. If no power is being drawn from the 9 volt supply, then about 12mA is available from this output.
4V
The 4V output is basically the NXT 4.3 volt sensor supply voltage. The output can supply about 20mA.
3V
The 3V supply is provided by a 3.3 volt regulator connected to the 4V supply. If no power is being drawn from the 4 volt supply, then about 20mA is available from this output.