-1

I use a lot Arduino Uno, but in this case, I have some BQ ZUM BT-328 boards, which are based on Arduino BT. The problem with some of BQ ZUM BT-328 boards is that the ultrasonic sensor (HC-SR04) is not working in any pin. However, apparantely, the boards work and the 2 servos (SM-S4306R) work fine too. When I change the ultrasonic sensor to other pins and with other wires, it is not working yet. However, I use that sensor in another different BQ ZUM BT-328 board and it is working fine, and if I add the same setup (2 SM-S4306R) and same code, it continues working fine. Then, the problem is just in some boards, not in everyone.

The ultrasonic example is:

long distance;
long responseTime;

int pinTrig = 9;
int pinEcho = 8;

void setup(){
  Serial.begin(9600);
  pinMode(pinTrig, OUTPUT);
  pinMode(pinEcho, INPUT);
}

void loop(){
  digitalWrite(pinTrig, LOW);
  delayMicroseconds(5);
  
  digitalWrite(pinTrig, HIGH);
  delayMicroseconds(10);
  responseTime = pulseIn(pinEcho, HIGH);
  Serial.println("Tiempo "+ String(responseTime)+" microsegundos");
  
  distance = int(0.01716*responseTime);

  Serial.println("Distancia "+ String(distance)+"cm");
  delay(500);
}

Then, I suppose that those BQ ZUM BT-328 boards have some problem and maybe they are starting to fail. I say this, because the same problem works in some boards and in others fails. In those board in which it fails I checked the correct connection of pins (GND, VCC, digitals), change the pin and the wires without result. However, the servos continue to work fine and I can upload the code to the board. My questions are:

Am I correct and they are failing?

Why they are just failing with that sensor and not the SM-S4306R? I mean, maybe some specific component of the board is failing?

4
  • the questions are not answerable because your description lacks detail Commented May 2, 2023 at 14:47
  • Which more details do you need? I can add more or test more the board. Just tell me. Commented May 2, 2023 at 16:11
  • 1
    include information about the board, the sensors, the connection diagram and minimal program that shows the failure Commented May 2, 2023 at 16:18
  • I have added a reference to the datasheet of the board, the sensor, and the motor. I have explain better the mistakes, and added the code example. Commented May 3, 2023 at 6:17

1 Answer 1

0

Looks like in your sample code you did not complete the 10us pulse.

  digitalWrite(pinTrig, LOW);
  delayMicroseconds(5);
  
  digitalWrite(pinTrig, HIGH);
  delayMicroseconds(10);
  digitalWrite(pinTrig, LOW); // you missed this

See example.

1
  • Thank you so much for your answer. I tried in all boards adding that line, but the result is the same. The boards which was failing continue failing. Commented May 9, 2023 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.