Tuesday, June 27, 2017

TUNING OF PCB ANTENNA FOR NFC CIRCUITS #17102016

For testing the antenna, we first made a loop antenna as per reference to ISO/IEC 7810 ID-1 outline as per the figure shown below with dimension given.
o   Then an experimental setup was made as shown below:



o   The signal generator is connected across the antenna we had designed and then this PCB antenna board was placed on the loop antenna, which was connected to oscilloscope to view the frequency, and the voltage induced in the loop antenna (with 50Ω input resistance).
o   While measuring the inductance of the antenna alone using LCR meter, we observed it to be 3.6 micro henry at 1mhz. Since our LCR meter can only measure up to 1uH, we used hit and trial method using convergence of the resonant frequency by calculating the tuning capacitor and inductor each time with the frequency that was seen on oscilloscope.

o   The initial tests and results made showed the result as:
Antenna + 30pf(NFC ic equivalent) capacitor in parallel
At 26mhz, induced voltage = 150mv
At 15.8mV, induced voltage = 50mv
At 43.8mhz, induced voltage = 80mv
Antenna + 30pf(NFC ic equivalent) +10pf(tuning capacitor) in parallel
At 27.6mhz, induced voltage = 474mv



o  From the above, result we figured out that the tuning of capacitance leads to increase in the induced voltage as well resulting the increased efficiency. But the problem was the antenna was still tuned to 27.6Mhz, that is around next order of our required frequency 13.56mhz. i.e double than the required.

o   In above picture, we can see the voltage induced in loop antenna from our designed antenna when initially only some random tuning capacitor of 40pf was placed and the frequency was not tuned yet.
o   So to tune the antenna to the 13.56mhz, we first calculated the inductance at the frequency at which the highest voltage was induced and by placing value of capacitance as the used capacitor value. For this  



      formula was used.
o   For initial tuned frequency = 27.6mHz, tuning capacitor = 40pf, resultant calculated inductance was 0.83131uH.
o   So, in next iteration we used frequency = 13.56mhz, inductance = 0.831831uH, the calculated capacitor was 165.71pf.
o   So, next time we put this capacitor in the circuit. In continuing this iteration for several run, we got the calculated capacitor as 400pf and actual used capacitor as 380pf to get the resonant frequency at 13.56mhz and the maximum voltage induced.
o   Below is the maximum induced voltage at our required 13.56 mhz signal. But the efficiency is still low so which seems to be enough to get signal but not power up the circuit. (further study should be done on knowing about if this induced signal is enough or not as well as increase the efficiency)

    Induced signal on loop antenna         input signal (13.56mhz @ 5V p-p)

o   We also checked our designed antenna as receiver and the previously available 13.56mhz signal generator. The setup and response is shown in figure below.


o   Here we can see almost 3V was induced in our designed antenna.
We need to further study about antenna design, antenna tuning and antenna testing (use of network analyzer, use of antenna design software etc) and implement in our next version board.

Monday, February 6, 2017

ANTICOLLISION STEPS IN NFC ISO14443B

Anticollison Steps in ISO 14443B
o   ISO 14443B (TYPE 2), has two main components reader (PCD) and tag (PICC).
o   At first PCD uses the anti-collision sequence for checking for multiple PICCs.
o   Steps
§  PCD sends REQB command with N where N is number slots defined for anti collision.
§  PICC receives REQB and check for N

  • If N is 1 then returns ATQB (Answer to Request type B)
  • If N is greater than 1  then random number R is generated
  • If R is 1 then sends ATQB
  • If R is not 1 then it wait until slot marker sent by PCD is matched

SIGNALLING IN NFC ISO 14443B
o   Uses the frequency of 13.56MHz as major carrier.
o   Sub carrier if 847.5 KHz is used for carrying data.
o   Signal from PICC to PCD is load modulated and used different signaling than from PCD to PICC.

PCD to PICC signaling
o   Uses 10%(8 to 14% practically) amplitude modulation index, ie there is always a presence of 13.56MHz carrier
o   Uses the NRZ encoding for the data
o   The signal generated from the smart phone as captured shows modulation index of 15%
o   Uses BPSK (Binary Phase Shift Keying) modulation
o   Encoding is NRZ-L for the data.
o   Each of the bit is 8 sub carrier period long.

Wednesday, January 11, 2017

SOFTWARE BASED UART ON ANY CONTROLLER

UART are very easy way for communication in electronics, it is used mostly in any where. UART are available in any micro controllers and very easy to use and understand. 
Sometimes in some controllers we may required some extra UART than available in hardware, in such case we can use software based UART. The details of USART communication is out of scope of this post. 

The code is running on MSP430FR5969, the device is running on 4 MHz DCO. The following code do not utilized any kind of interrupt and strictly depended on polling. While receiving the data, it uses while statement for the start bit. But this code be easily be made efficient using techniques like interrupts and also using PT thread technique. This just gives a basic implementation for the newbies.

The setup is as


Here macros are used for making the code simpler, following are the snippets of the functions.

#define settxoutput P1DIR |= BIT4  //SET AS TX OUTPUT PORT 1 BIT 4
#define highontx P1OUT |= BIT4 //SET OUTPUT HIGH ON TX
#define setlowontx P1OUT &= ~BIT4 //SET OUTPUT LOW ON TX

#define setrxinput P1DIR &= ~BIT3 //SET AS RX INPUT PORT 1 BIT 3
#define isrxhigh P1IN&BIT3

#define baudrate 9600
#define Bittime 4000000/baudrate // one bit time in uS
#define bittime Bittime - 40
#define rbittime Bittime - 40

void tx8_uart(unsigned char data8){
unsigned char i;
setlowontx;
__delay_cycles(bittime); //since frequency of operation is 1mhz its 1us
for( i = 0;i < 8 ; i++){
if( ( (data8>>i) & 0x01) == 0x01 )
highontx;
else
setlowontx;
__delay_cycles(bittime);
}
highontx;
__delay_cycles(bittime);
}


unsigned char  rx8_uart(){
unsigned char data8=0;
int i;

while(isrxhigh); //start bit is 0

__delay_cycles(rbittime);
__delay_cycles(rbittime/2);//taking sample at mid time

for( i = 0;i<8;i++){
if( /*i%2 == 0*/ isrxhigh ){
data8 += (1<<i);
//P1OUT |= BIT7;
}
else{
data8 = data8;
// P1OUT &= ~BIT7;
}
__delay_cycles(rbittime);
}

if( isrxhigh ){
__delay_cycles(rbittime/2);
return data8;
}else{
__delay_cycles(rbittime/2);
return 0x00;
}
}

Monday, July 25, 2016

P10 LED MATRIX BOARD DISPLAY

Here in this project I have used 12 P10 led matrix board in array of 4 horizontal and 3 vertical ie 4 columns and 3 row.
All displays are cascaded ,while last one become the origin or 0,0.

You need a long flat cable of 16 pin connector for connecting the display on different line as suggested in the figure.
I have used the DMD library by freetronics.
First I have planned to display time temperature one the first line, display two messages scrolling in line two and three.
I have used LM35 as temperature sensor which gives 10mV per degree change in celsius scale and used 1.1V as ADC reference for maximum resolution. 
DS1307 as RTC with IIC interface, but the problem is whenever is use DMD with IIC, I dont know why the time value of RTC is not stable its always changing like it gives right time for 3 or 5 times and then 165 165 and 85. May be due to some conflict on resources couldnt really figure out.
Solve this problem using two controller using one as just display drivers and second sending all data of temperature, time, font, writing message , reading message and saving message and controlling the speed of the message scroll.
Here's the link to the code final code https://github.com/kieran-shrestha/led_notice_board

Saturday, July 9, 2016

INTERFACING ADC OF AVR MICROCONTROLLER

The following is the code for using the internal 10 bit ADC of AVR microcontroller.
The code is written for ATMEGA328 with system clock of 16MHZ.
The code uses standard c header files for using printf function and then print the content in serial uart of the microcontroller.

Sunday, June 26, 2016

ATMEGA328P UART0

CONNECTION CONNECT RX AND TX TO TX AND RX OF OTHER DEVICE

//This define the system frequency
#define F_CPU 16000000UL

//Including the required files
#include <avr/io.h>
#include <util/delay.h>

Sunday, June 12, 2016

LCD INTERFACING 8 BIT MODE

Circuit connection is 
RS => PB0
RW => PB1
EN => PB2
D0-D3 =>PORTD 0 TO 3
D4-D7 => PORTC 0 TO 3