[[ANT]]

*ANT/BC-ANT-SERIAL with Data Display [#v98d03a8]

>
This is an example of electrics work, which employs BC-ANT-SERIAL and an LCD display unit. This display units shows the status of ANT communication, which the BC-ANT-SERIAL is currently engaging.~

>
BC-ANT-SERIAL can be connected to a microcontroller with only five pins. One pin is used for power supply between 1.9V and 3.3V, and another pin works with ground. The other three pins are assigned to TXD, RXD, and RTS at single end. (Using the pads, rest, sleep, suspend functions of ANT chip can be managed.) The five pins can accept 2.54mm pitch (0.1inch) pin-headers, which are commonly used.~

>
This example uses PIC24F64GA002 (28pin, 300mil width, and DIP) of Microchip Technology Inc. 

>
- Schematic~
&ref();~
&ref(maker-2012-0005a.pdf);~

>
- Example of Implementation~
&ref();~
&ref(DSCF8198.JPG,,25%);~

>
- Parts List~
|No.|qty.|Reference |Product Name|Specifications|Memo|
|1|2|C1, C2|Laminated Ceramic Capacitor|0.1uF|Non-specific, any qualified products|
|2|1|C3|Tantalum Capacitor|10uF|Electrolytic capacitor, attention to the polarity|
|3|1|C4|Laminated Ceramic Capacitor|10uF|This must be a laminated ceramic capacitor, electrolytic capacitor is not acceptable|
|4|4|D1, D2, D3, D5|LED|| Either chip type or /w lead φ3~5mm|
|5|1|J2|Female Pin Header (Pin Header Socket)|1 x 5 pin|2.54mm pitch, it is adjusted to BC-ANT-SERIAL|
|6|1|J3|Pin Header|1 x 6 pin|2.54mm pitch, used for connecting to PICKit and other connectors for programming|
|7|1|R1|Resistor 1/16 ~ 1/4W|10kΩ||
|8|4|R2, R3, R4, R5|Resistor 1/16 ~ 1/4W|1.5kΩ|Approximately 330 ~ 3.9kΩ, the value is highly deponent on which types of LEDs are used here. For LEDs with lead φ3~5mm, select 330 ~510Ω of resistors. To use chip LEDs, resistors are not specified.|
|9|1|R6|Resistor 1/16 ~ 1/4W|10kΩ|Semi-fixed resistor|
|10|4|S1, S2, S3, S4|Push Switch|Momentary Type|As it is pressed, it is turned ON.|
|11|1|U1|CPU|PIC24FJ64GA002|You may buy any parts-shops.|
|12|1|U4|LED|SC1602BS-B(-XA-GB-K)|You may replace this with other models, but pins of some LEDs are not compatible with this model's. Please be careful.|
|13|1|U5|DC-DC Convertor|DC-DC boost converter, 5V 0.2Aoutput, StepUp・DIP-Ver.2|It is used for boosting 3.3V to 5V. If your LED can accept 3.3V, this will not be needed.|
|14|1||BC-ANT-SERIAL|||
|15|1||Pin Header|1 x 5 pin|This 2.54mm pitch pin header is soldered on BC-ANT-SERIAL and connected to J2|

>
LEDs, resistors, capacitors, a switch, pin headers, and a CPU can be purchased at any electrics parts shops, mail orders, and/or the internet.~

>
Please carefully assemble the data display. In this section, checking (critical) points are stated here.~

>
C3 is added if the power line is unstable. A 1~10uF of tantalum capacitor is suitable for this case. There is polarity, excepting some. The + terminal of the capacitor is connected to Vdd, and the – terminal is attached to GND.~

>
LEDs are turned on if 0 is sent, and they are turned off if there is 1. The values of resistors (R2 ~ R5) are adjusted to types of the LEDs.~
To use the size 1608 of chip LED, the LED is emitted with few electric current (less than 500μA), so a 1.5kΩ resistor is selected on the schematic. However, to use the LED with a 5mm diameter lead, 2~3 mA of electric current is required for recognizably emitting the LED. The value of resistor is needed to me small. A chip LED accepts 2~3mA of electric current, so the value of resistor should be 330 ~ 510Ω. (If the quiescent current is increased, the LED emits brighter. In this example, the resistor that works with the chip LED is set around 2kΩ.)~

>
The push switch connects to GND while it makes the pull-up resistor, which is included in CPU, is effective. As the switch is disconnected, 1 is read. As it is connected, 0 is read.~
If this pull-up resistor remains ineffective and the power supply is turned on, its input terminal becomes unstable. 1 is often read, but CPU may not work currently. In the worst case, it causes  thermal issue, and the CPU gets really hot. Eventually, the CPU breaks because of the high temperature of the CPU. To avoid the worst case happening, please add a pull-up resistor to the power supply.~

>
The development environment for this project is MPLAB IDE.~
Create a “New Project” and select PIC24FJ64GA002 as CPU.  PICKit2 or PICKit 3 can be used as programmer. The source code debugger can be used here, too. To set up power supply for this board, 3.3V power supply is attached to J3 pin,  the + terminal and - terminal are connected to the 2nd pin and 3rd pins, respectively.~

* Program Example [#b10aeec1]
>
A set of program files is shown below. Each file is added to the created project. To do “Compile/Program,” compile it and download to the PIC.~

>
- ANT API
-- &ref(ant.c);

>
- LCD Display
-- &ref(C_LCD.c);


>
- Delay Function
-- &ref(delay.c);

>
- Main
-- &ref(main.c);

>
- UART
-- &ref(uart.c);

>
- ANT API Header 
-- &ref(ant.h);

>
- LCD Display Header
-- &ref(C_LCD.h);

>
- Delay Function Header
-- &ref(delay.h);

>
- UART Header
-- &ref(uart.h);

** Explanation [#x4925a50]

>
To execute this program, the title screen appears. Then, to press SW4, start executing the program.~
At the first line of the LCD screen, a received command and a part of payload  in hexadecimal. The second line shows the number of received data.~
To press SW1, open ANT channel in the transmitting mode, broadcast the data, and turn on LED1.~
To press SW2, open ANT channel in the receiving mode, receive the data, and turn on LED2. If it cannot receive ANT signals and faces the timeout, it closes the channel and turns off the LED2.~
To press SW3, send the order of software resetting to the ANT module, turn off LED1 and LED2. It stays in the waiting mode.~

>
Most processes are written in the main() function.~

* Revision History [#j4d68117]
>
- 2013/02/06 This article is initially uploaded

Front page   Edit Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes