Error 507 hc 05 bluetooth module

Hi, I am creating an app using mit app inventer where I would control stepper motor using microcontroller and hc 05 bluetooth module. I ran into a problem of connecting the phone tog bt module, when I get the list of nearby devices and click on hc 05 It says error 507, is your device on, smth like that. I'm guessing the problem might not be with the module since I am unable to connect to other devices. This is just a starting design in order to see if it would work. Any help would be much appreciated. Thanks in advance.

Ps. If the phone model is important(samsung galaxy a54)



Dear @Bruno_Dragas,
honestly it's a bit confusing when you say that : "the problem might not be with the module since I am unable to connect to other devices" . (probably you wanted say able ?).
Anyway, to start from a securely working situation you could have a look to @Juan_Antonio's web site (kio4.com) where you can find a huge quantity of ready made code (both AI2 and Arduino) from where you can start and then develop yours. In other words: after you have succeeded to run one of the kio4 examples, you are sure that the hardware is working fine, and then you can go on with your own app.

EDIT: having a look to your AI2 blocks, I see that you have a clock that checks for the BT connection. Is the clock already enabled at app start ? If yes, this could be the error: such a clock shall be enabled only after the BT device has been already successfully linked otherwise it tries to verify a connection that is not effective yet.
Typically a clock is used to verify whether some characters have been received on the BT line, but obviously only after the BT is surely operating.

Best wishes.

Hi, thanks for yur reply.
I meant to say that I was unable to connect to any other device so I am thinking it has nothing to do with the module rather, it might with he phone or the code?

When I said other devices I meant my headohones, smart watch...

I don't find his tutorials helpful since I hadd to use different blocks to be able to see nearby devices... with his way I couldn't see them...

You have a coding error in the Clock timer that checks connection.

The second if/then is identical to the first.

Either add a logical not block or switch to an if/then/else structure.

Hi, is clock timer block neccessary in order to connect to bluetooth?

Yes

2ff4e5a78bd555a99f9211e8df410cc649be7496_2_690x357

Do you see the error yet?

1 Like

Yes, haha, I tried out many blocks so I guess, i made an error, Thanks!

Hi, yes I agree.
But what I suggested was to use one of his examples, so to be sure that your hardware is working fine.
Once you are done with that, you can implement whatever code or blocks you want but until you aren't sure that the hardware works well, you run the risk to search into the software a problem which is in the hardware instead.

I changed used the math block "not" and it works!! Thanks a lot guys!

1 Like

Hi, before my real project I decided to try with smaller one to see if it works, controlling the led. I was unable to do so, button doesn't do anything, there is no message on serial monitor... so I wonder where is the prob



lem

upali means turning led on
ugasi means turning led off

Ps the problem is I don't have a button on my hc 05 so I randomly set 9600 because most of them are this rate

You check for character '0' or '1' in your sketch:
image

But you do not send character '0' or '1'
image

You send 0x00 and 0x01 values.

Look in an ASCII Table for the hex values of character '0' and '1':
image
They are 0x30 and 0x31.

Since you are testing for character '0' and '1', it is easier to use the AI2 block that sends text '0' or '1'.

You might have to put those ReceiveText blocks in a Clock Timer, since it takes time for the send '0' or '1' to reach the Arduino and for it to respond and for the response to arrive in your app, and the ReceiveText may have completed empty handed.

How exactly should I put them in clock timer? I mean it should fit in button block

Try the text corrections first, and see how your app and sketch work together.

It is better not to add anything until you know that it is needed.

By text correction you mean changing 1 and 0 to 31 and 30?

No, switch to the send text block and send a purple text block.

You mean this?

blocks (1)