1

I am planning to make a laser tripwire but I have an issue. Let me explain what I am trying to do:

Making a laser tripwire is actually pretty easy at its core. You just need an LDR and a laser diode. You look at the normal results of the LDR; it's usually around 60.

When the laser hits the LDR, it's usually around 600 so you write an if statement saying if LDR value is below 500, power the LED or buzzer.

But there is an issue here. The LDR module must be connected to Arduino with cables for signalling. I don't want that. Luckily, I have a Bluetooth module but I have no idea how to use it for sending signal to my Android phone. I know how to send signals though. So to simplify things:

1Can I send any kind of signal to my phone with Bluetooth (I am using an app called Arduino Bluecontroll but I can upload a different app if necessary)? If yes, how?

10
  • 1
    First, LDR module must be connected to Arduino with cables for signaling. I don't want that. -- So use a retro-reflector. That's what most people use. It also makes aiming a whole lot easier...
    – Majenko
    Jan 6, 2021 at 15:38
  • @Majenko That's actually... pretty clever. I don't want to buy more equipment though. Can I use a tiny mirror instead? Jan 6, 2021 at 15:41
  • 2
    No, it has to be a retroreflector. They're special - they always reflect back near 180° - a normal mirror reflects at the inverse of the incident angle - so you'd not only have to aim perfectly at the right spot on the mirror, but the mirror would also have to be at precisely the right angle. Theoretically doable, but a nightmare in practice.
    – Majenko
    Jan 6, 2021 at 15:46
  • you actually may already have a retroreflector in your house ... it is what is used on bicycles ... usually a red one on back and a clear one on front
    – jsotola
    Jan 6, 2021 at 16:00
  • @jsotola brilliant advice but sadly, I don't have one. Jan 6, 2021 at 16:06

1 Answer 1

1

Can I send any kind of signal to my phone with Bluetooth?

You have an HC-06, which is a bluetooth Serial (UART) bridge. Thus the bluetooth device exposes the profile for a serial terminal. You can only transmit serial data. It doesn't work for HID input to the smatphone or audio. The Bluecontrol app seems to use serial. So that is not a problem.

To get the communication to work, you need to pair the HC-06 with your phone. The actual connection is then established by the app. It will send serial data to the HC-06, which will output it on its TX pin. Serial communication on its RX pin will be transmitted back to the app.

You need to test, for which baudrate the HC-06 is configured. For that write a test sketch, you use an extra serial interface (either another hardware interface or SoftwareSerial) for the HC-06 and send every byte, that you receive from it, to your PC, so that you can see, what the Arduino receives. Try different standard baudrates (like those, which are listed in the serial monitor), until you find the one, which gives you the correct output.

When that works, you can write your sketch to read the commands from the HC-06 serial interface and act accordingly. How exactly that works depends on the data, that the app is sending. Most likely is sends ASCII encoded text, each message terminated by a newline character \n. In that case you could read the data into a buffer byte by byte, when they arrive. When you read a newline character, you know, that you received a full message. Then you can process it and act accordingly.

2
  • Thanks chrisl but I already solved it with my own way. Jan 9, 2021 at 20:39
  • Then please write an own answer and accept it as correct. That way others can learn from you
    – chrisl
    Jan 9, 2021 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.