With this super simple code, I feel to receive some data from the device.
int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
int compte = 64;
float somme = 0;
float moyenne = 0;
void setup() {
Serial.begin(115200);
delay(250);
Serial.println("Ready");
}
void loop() {
// read the value from the sensor:
for(int x=0; x<compte; x++) {
sensorValue = analogRead(sensorPin);
somme = somme + sensorValue;
delay(2);
}
moyenne = somme / compte;
Serial.println(moyenne);
moyenne = 0;
rendu = 0;
somme = 0;
delay(2000);
}
When the device is turned toward the table, the average (moyenne) is around 180.
When the device is turned toward the ceiling the average (moeynne) is around 350
That means, I hope, that the reading works.
Basic connexion only - under Arduino Uno
from device « TX » to Arduino « A0 »
According to
« LD8001B module can directly use UART0 to output the detection results » written in the datasheet.pdf
This is wrong. The LD8001B outputs the data using the serial protocol (UART). But you are trying to read it as if it was putting out an analog voltage!!!
You must read the serial data as serial data. Unfortunately this is going to be quite challenging to accomplish on the UNO because it only has one hardware serial interface (pins 0 and 1), which is already used for communication with the computer. You can add additional serial interfaces using the "SoftwareSerial" library, but it can only receive data at 57600 baud maximum, while the LD8001B transmits at 115200 baud.
It is possible to use the UNO as a basic USB to serial bridge module, where the bridge chip on the UNO (e.g., ATmega16U2 on the official or clone Unos, CH340 on the Chinese derivative Unos) is simply passing the data from pins 0 and 1 to the computer, without any involvement from the Uno's primary ATmega328P microcontroller.
That approach is not terribly interesting for those of us who like to make projects based around microcontrollers, but it will at least allow you to see if the LD8001B is working, and perhaps would even be sufficient for an application where you don't actually need the Uno to do anything more.
If you want to try it, connect the TX pin on the LD8001B to pin 1 on the Uno. In addition, connect the "RESET" pin on the UNO to the "GND" to disable its ATmega328P so it can't interfere with the communication between the bridge chip on the UNO and the LD8001B.
The fact that I am instructing you to connect the pin on the UNO that is marked "TX" to the TX pin on the LD8001B might seem wrong since we must always make TX-RX connections. However, this is actually what is needed to make such connections. The reason is that the markings on the UNO board are referring to the pins on the ATmega328P, but in this use case you are communicating between the LD8001B and the UNO's USB to serial bridge chip so must make the TX-RX connections between those two chips. The bridge chip has an RX-TX,TX-RX connection to the ATmega328P, so the pin marked "TX" on the board is actually connected to the "RX" pin on the bridge chip.
Both down pulled P19 and P12 :
I receive "C" ( HEX 43 ) infinitly almost every ½ second
If I unplug the P19 pull-down while it gives me "C" ... nothing : keep same pace ½ second of "C"
With only P12 pulled down, I receive:
[ 3 ]EEPROM code does no exist
Looks like the double pull-down (P12 & P19) set into programming mode, the HEX 43 be signal of « I'm waiting for RX »
I don't know ... only hypothesis.
If you think like me, what code should I try ?
The datasheet referes to a software I don't know (below)
Thanks for the updates on your findings. It looks like you are making some good progress at least!
Unfortunately I am not familiar with the LD8001B and don't have access to one. The support I provided so far was all based on the information I gleaned from the product page link you shared and the datasheet downloaded from that page. Sadly, the manufacturer was not kind enough to provide much information about this complex device so I am limited in how much assistance I can be. Hopefully one of the other forum helpers might be more knowledgeable on this subject.
I don't think that will work. From section 7 of the datasheet:
The radar module has extremely high power requirements, requiring an input voltageof3.1~3.5V, power supply ripple ≤50mV, and current ≥1A.
The 3.3 V regulator on the UNO board isn't going to be able to provide anywhere near to 1 A.
It definitely could be. From the information I found, I assumed that the device just constantly transmitted the reading. However, it might be that the device sends it on demand after it receives a command.
However, I don't know why it would send the "C" repeatedly over and over again under that scenario. My hypothesis is that this might actually be the reading, or rather an error code. It might be caused by the insufficient power supply.
It is great that you got SPI communication working as well as the UART. This will allow you to use the LD8001B in an Arduino project with the UNO once you manage to get the LD8001B working.
Thanks for all that.
I've red the same (yes, from the same document ) about the power consumption. I did know about the arduino limitations. I'll provide 3.3V with enought Amp next time. I have power supply capable of providing upto 3A. Then, I'll give you news.