Based on the LDC1000 inductor-to-digital converter, a car capable of automatically following the shape of a wire has been designed and developed. The system comprises several key modules: a main control module, a metal signal detection module, a speed detection module, a motor drive module, and a power supply module. The STC89C52 microcontroller acts as the central unit, which evaluates whether the trolley deviates from its path based on the detected metal distance signals. This allows for directional adjustments, enabling the trolley to track along a specified plane runway automatically.
Wire tracking systems are widely used in industrial automation and various applications, with numerous methods available, each having its own limitations. For instance, mechanical chain-based systems suffer from wear and require significant space. Photoelectric reflective systems require a black track and are sensitive to ambient lighting conditions. Camera-based pattern recognition systems rely heavily on strong algorithms and are also affected by external light. These drawbacks have motivated the development of more reliable and efficient alternatives.
Therefore, this paper proposes using the LDC1000 to detect and interpret the presence of a wire, thereby enabling automatic tracking. The LDC1000 is a new Inductor-to-Digital Converter (LDC) developed by Texas Instruments (TI). It offers advantages such as low power consumption, a compact size, and cost-effectiveness. Its SPI interface makes it easy to integrate with microcontrollers. The LDC1000 only requires one external PCB coil or a custom-made coil for non-contact inductive sensing. Unlike traditional Q meters that measure the inductance of a coil, the LDC1000 detects the spatial relationship between an external metal object and the coil connected to it.
The LDC1000 can be used to detect horizontal or vertical distances, angles, displacement, motion, vibration, and metal components. Its versatility makes it suitable for a wide range of applications, including automotive, consumer electronics, computers, industrial systems, communications, and medical equipment.
STC89C52 Interface with LDC1000
Mcu and LDC1000 interface diagram
When using the OC port of the STC89C52 to simulate the SPI interface and communicate with the LDC1000, the following steps should be followed:
- Set the chip select signal to low (0).
- Write the register address to the LDC1000 through the SPI line. The highest bit indicates whether it's a write (0) or read (1), while the remaining 7 bits represent the register address.
- During the 8 clock cycles, the SDO line remains in a high-impedance state.
- If the command is in read/write mode, the highest bit of the transmitted data is 1, and the SDO sends the 8-bit byte from the corresponding register.
- The SDI line receives the 8-bit data from the STC89C52 and writes it to the appropriate register.
- Set the chip select signal back to high (1) to release the slave device.
LDC1000 SPI read and write timing diagram
STC89C52 Driver Design
The following driver functions were implemented based on the SPI timing of the LDC1000:
// Read 1B data
unsigned char Ldc_SPIread(void);
// Write 1B data
void Ldc_SPIwrite(unsigned char ch);
// Write register
void LDC1000_WriteReg(unsigned char addr, unsigned char dat);
// Read register
unsigned char LDC1000_ReadReg(unsigned char addr);
// Chip initialization
void LDC1000_Init(void);
// Read distance parameters
unsigned int ReadValue(void);
Control Logic
The front of the car is equipped with an inductive antenna. As the car moves along the wire, it may deviate due to factors like uneven road surfaces or asymmetrical wheels. There are three possible deviation scenarios: A, B, and C. When the car is aligned correctly, the value obtained from the function ReadValue() is Fb. If the value is Fa or Fc, the car turns left or right accordingly. The program flow is as follows:
According to the above principle, the system tracks the wire, and the experimental car monitors the wire data via a serial port. The wire has a diameter of over 0.9mm, and the tracking car includes a control board, display, photoelectric speed measurement, motor, Bluetooth transceiver module, and more. The sampled data is monitored to determine if the car is off track.
Summary
Non-contact inductive coil detection can be achieved using either a PCB coil or a custom-made coil. By analyzing how a metal object affects the magnetic field of the induction coil, metal detection becomes straightforward. After actual testing, it was found that metal objects up to 3cm away can be effectively detected by setting the module’s register values appropriately. External lighting conditions have minimal impact on the system, and it can quickly detect and identify metal within a certain range.
Attached: LDC1000 Driver
#include "reg52.h"
// LDC COMMANDS
#define LDC1000_CMD_REVID 0x00
#define LDC1000_CMD_RPMAX 0x01
#define LDC1000_CMD_RPMIN 0x02
#define LDC1000_CMD_SENSORFREQ 0x03
#define LDC1000_CMD_LDCCONFIG 0x04
#define LDC1000_CMD_CLKCONFIG 0x05
#define LDC1000_CMD_THRESHILSB 0x06
#define LDC1000_CMD_THRESHIMSB 0x07
#define LDC1000_CMD_THRESLOLSB 0x08
#define LDC1000_CMD_THRESLOMSB 0x09
#define LDC1000_CMD_INTCONFIG 0x0A
#define LDC1000_CMD_PWRCONFIG 0x0B
#define LDC1000_CMD_STATUS 0x20
#define LDC1000_CMD_PROXLSB 0x21
#define LDC1000_CMD_PROXMSB 0x22
#define LDC1000_CMD_FREQCTRLSB 0x23
#define LDC1000_CMD_FREQCTRMID 0x24
#define LDC1000_CMD_FREQCTRMSB 0x25
sbit PIN_LDC_CS = P1^0;
sbit PIN_LDC_SO = P1^1;
sbit PIN_LDC_SCK = P1^2;
sbit PIN_LDC_SI = P1^3;
#define SET_PIN_LDC_SI(bValue) PIN_LDC_SI = bValue
#define GET_PIN_LDC_SO() PIN_LDC_SO
#define SET_PIN_LDC_SCK(bValue) PIN_LDC_SCK = bValue
#define SET_PIN_LDC_CS(bValue) PIN_LDC_CS = bValue
/*--------------------------------------------------------------- Function: Read 1B data Input: None Output: 1B data ---------------------------------------------------------------*/
unsigned char Ldc_SPIread(void)
{
unsigned char i = 0;
unsigned char ch = 0;
for(i = 0; i < 8; i++)
{
SET_PIN_LDC_SCK(0);
ch <<= 1;
SET_PIN_LDC_SCK(1);
if(GET_PIN_LDC_SO()) ch = ch | 0x01;
}
SET_PIN_LDC_SCK(0);
return (ch);
}
/*--------------------------------------------------------------- Function: Write 1B data Input: ch--1B data Output: None ---------------------------------------------------------------*/
void Ldc_SPIwrite(unsigned char ch)
{
unsigned char i = 0;
for(i = 0; i < 8; i++)
{
SET_PIN_LDC_SCK(0);
if(ch & 0x80) SET_PIN_LDC_SI(1);
else SET_PIN_LDC_SI(0);
SET_PIN_LDC_SCK(1);
ch <<= 1;
}
SET_PIN_LDC_SCK(0);
}
// Write register
void LDC1000_WriteReg(unsigned char addr, unsigned char dat)
{
addr = addr & 0x7F;
SET_PIN_LDC_CS(0);
Ldc_SPIwrite(addr);
Ldc_SPIwrite(dat);
SET_PIN_LDC_CS(1);
}
// Read register
unsigned char LDC1000_ReadReg(unsigned char addr)
{
unsigned char temp;
addr = addr | 0x80;
SET_PIN_LDC_CS(0);
Ldc_SPIwrite(addr);
temp = (UINT8)Ldc_SPIread();
SET_PIN_LDC_CS(1);
return temp;
}
// Chip initialization
void LDC1000_Init(void)
{
LDC1000_WriteReg(LDC1000_CMD_RPMAX, 0x13);
LDC1000_WriteReg(LDC1000_CMD_RPMIN, 0x3A);
LDC1000_WriteReg(LDC1000_CMD_SENSORFREQ, 0x94);
LDC1000_WriteReg(LDC1000_CMD_LDCCONFIG, 0x17);
LDC1000_WriteReg(LDC1000_CMD_CLKCONFIG, 0x02);
LDC1000_WriteReg(LDC1000_CMD_INTCONFIG, 0x02);
LDC1000_WriteReg(LDC1000_CMD_THRESHILSB, 0x50);
LDC1000_WriteReg(LDC1000_CMD_THRESHIMSB, 0x14);
LDC1000_WriteReg(LDC1000_CMD_THRESLOLSB, 0xC0);
LDC1000_WriteReg(LDC1000_CMD_THRESLOMSB, 0x12);
LDC1000_WriteReg(LDC1000_CMD_PWRCONFIG, 0x01);
}
// Read distance parameters
unsigned int ReadValue(void)
{
unsigned int iTemp;
iTemp = LDC1000_ReadReg(LDC1000_CMD_PROXMSB);
iTemp <<= 8;
iTemp += LDC1000_ReadReg(LDC1000_CMD_PROXLSB);
return iTemp;
}
This battery is for replacing lead-acid battery, it has the standard appearance and size as well as capacity, but longer cycle life and high energy and good charge and discharge performance.
Capacity:100AH/150AH/180AH/200AH/250AH.
Voltage:12.8V, cycle life is more than 2000 times, also can customize the capacity.
Lifepo4 Battery,Lifepo4 Battery 12V,Solar Battery Pack,180Ah Lithium Mobile Battery,2304Wh Lithium Battery Power Bank,Lead Acid Replacement Battery
Enershare Tech Company Limited , https://www.enersharepower.com