Friday, October 20, 2017

DAUGHTER BOARD FOR RF430FRL152H

RF430FRL152 is the NFC SOC by Texas Intrument. The SoC comes with a MSP430 core 16 bit processor, with 2KB of FRAM for user code. It contain 8KB of builtin ROM code.  The chip has in built temperature sensor and current sources for external sensors.
IIC for digital sensor interfaces and internal energy harness and also the voltage doubler. The IC operates with 1.5 voltage with maximum of 1.65 voltage.


Wednesday, September 27, 2017

DEBUGGING ON TMP112 INTERFACE WITH MSP430FR5969 #20102016

  • Temperature sensor was successfully interfaced with the processor and giving the current temperature data in degree Celsius.
  • Minimum resolution of the current sensor is 0.0625 degree C, and accurate up to 0.5 degree C up to 65 degree C and 1 degree C beyond.

  • The picture shows the temperature at the time of measurement highlighted, upto precision of 3 digits after decimal.
  • ‘a’ section of the waveform is the address of temperature sensor,
    ‘b’ section is the internal temperature register address, which is all zero.
    ‘c’ and ‘d’ are the temperature value in binary(16 bits).

  • Changes made in Code
A) After software reset of IIC some delay is required, this issue took most of the time.
B) Set the IIc master mode with synchronous setting of 400Khz of data rate.
C) Low power implementation in current sensor for the long term battery life.
D) This configuration keeps the sensor in sleep mode and only waking up when temperature is need to be measures and then sent to sleep again. 




Saturday, September 23, 2017

TMP112 INTERFACING WITH MSP430 MICROCONTROLLER #19102016

TMP112, temperature sensor by Texas Instrument, with very interesting features as
a) SOT563 Pacakge (1.6mm x 1.6mm) is 68% smaller than SOT23.
b) Accuracy of 0.5C
c) Low quiescent of 10uA active and 1uA sleep
d) 12 bit resolution (0.0625C)
e) Supply range 1.4 to 3.6V




The i2c algorithm that we are using to sense the temperature sensor is as

A)      Should be in reset state while changing some register content. (check in datasheet)
B)      Set the IIc master mode with synchronous setting.
C)      Set IIc clock equal to sub master clock
D)     Set some divider smclk/x = 100khz (can be varied as per requirement up to 400khz)
E)      Set the slave address in 7 bit format
F)      Disable or enable the interrupts
G)     Disable the reset state


a)      Again put in reset mode
b)      Generate the stop condition after transmission of 1 byte automatically.
c)      Disable reset mode
d)      Send the start condition, it will also send the slave address.
e)      Wait until transmission is finished
f)      Send the register we need to read from and wait till transmission is done
g)      Set IIC write operation in receiver mode to generate auto stop after two bytes are received.
       TMP112 sensor gives 16 bits of data
h)      Setup for repeated start
i)       Receive two bytes of data
j)       Convert according to the formula

 (50°C) / (0.0625°C / LSB) = 800 = 320h = 0011 0010 0000
 0011 0010 0000 = 320h = 800 × (0.0625°C / LSB) = 50°C

(|–25°C|) / (0.0625°C / LSB) = 400 = 190h = 0001 1001 0000 Two's complement format: 1110 0110 1111 + 1 = 1110 0111 0000

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