Is using Bluetooth a problem?

micrometal

New Member
I built several Picaxe projects in the past but have been away for five years or so playing with Android applications. Now I would like to do a Picaxe data logger type project with a Bluetooth (HC-06) module to upload batches of collected data to my Android 'phone. I cannot tell whether this would be straightforward or problematic. There is a lot of experience on this forum which (naturally) deals with problems more than successes, and much of it is quite old, so I am not sure what to make of it. My question is ...

If I connect serin/serout pins of a Picaxe to the Rx/Tx pins of an HC-06 am I going to be able to transmit a string of byte data, or is it much more complicated?
 

inglewoodpete

Senior Member
My question is ...

If I connect serin/serout pins of a Picaxe to the Rx/Tx pins of an HC-06 am I going to be able to transmit a string of byte data, or is it much more complicated?
Once you have paired the app on your mobile phone to your HC-06 device, you just use the PICAXE's RxTx pins to receive and/or send data. You just need to format the data in a way the other end can interpret and handle correctly. From my experience, it can be surprisingly easy.
 

micrometal

New Member
From my experience, it can be surprisingly easy.
In my experience, as you might have guessed by now, if anything is easy it is a surprise!

Since I made the first post I have found a few more successful examples around the web, so I am going to order some modules. Thanks for your encouragement - I am more confident about handling the software side.
 

PhilHornby

Senior Member
Now I would like to do a Picaxe data logger type project with a Bluetooth (HC-06) module to upload batches of collected data to my Android 'phone. I cannot tell whether this would be straightforward or problematic.
My general advice (based on painful personal experience), is to stay away from Bluetooth!

However, the description of your project sounds like you might actually be trying to use Bluetooth in the way it was intended :) - unlike me, who was attempting to send data from multiple nodes, at frequent intervals, over largish distances, through granite walls!.
It worked on the test bench though ... ;)

I would recommend using the HC-05 rather the HC-06. On paper, the only difference is that the HC-06 is Slave only, whereas the HC-05 can be Master or Slave (so some initial config. required).

However, the HC-06 and HC-05 run totally different firmware - there have been quite a few posts on here, with people experiencing issues with the HC-06, that I didn't encounter with the HC-05.

See this thread, for example

Both HC-05 & HC-06 are quite long-in-the-tooth now, so there might be some better alternatives altogether out there.
 
Last edited:

micrometal

New Member
Thanks, Phil, that is useful advice.
I would recommend using the HC-05 rather the HC-06.
I had read in my research that HC-06 modules from different sources can have different firmware. That is exactly the sort of back-of-the-mind uncertainty that you don't want when trying out something for the first time. I will try an HC-05 instead.
Both HC-05 & HC-06 are quite long-in-the-tooth now, so there might be some better alternatives altogether out there.
I know about Bluetooth LE. In fact that is what I should be using for my application where the Bluetooth is only being woken up a couple of times a day to transfer logged data. I plan to buy a Bluetooth LE module too, but Bluetooth classic looks like it might be an easier interface to get started with.

So you have not put me off. Without a challenge there is no achievement. On the other hand, total failure is no achievement at all; that is what I was aiming to avoid..
 

Bill.b

Senior Member
Hi micrometal

This is code i used to control a robot car from my phone using bluetooth via a HC-06 and roboremo App.
B12 is the data block identifier, b13 is a null byte b14,15and 16 are the data bytes in ascii format. In most cases I only required the identifier byte as
most functions of the bot were digital. Only the speed control required further decoding.
Hope this may be of some help.

Code:
RemoteIn:
REM Controlling Robot with BT module HC-06 - PICAXE
do
 b12 = 0  ;clearing memory for commands
 serin [2000],a.0,T9600_16,b12,b13,b14,b15,b16 ;reading from bluetooth (waits 2s for character)
     pause 50

 'select b12  ;selection depending on received character
select case b12
 case 65
    gosub FWDFast    'FWD
case 66
    gosub TurnRight    'FWD Right
case 67
    gosub TurnRightR    'REV Right
case 68
    gosub BackFast    'REV
case 69
    gosub TurnLeftR    'Rev Left
case 70
    gosub Turnleft    'FWD Left
case 71
    gosub stopm    'Stop
case 72
    VoiceNo = 33
    GOSUB voice    'camera on
case 73
    VoiceNo = 34
    GOSUB voice        'camera off

case 74
    Pwmduty M1PWM,900
        gosub TurnAround2
case 75
    Pwmduty M1PWM,900    
        gosub TurnAround
 case 113        'Motor Speed
     b17= b14 -48
     if b15 = 10 then
         b18 = 0
          goto loopend
    else
        b18 = b15 -48
     endif
     if b16 = 10 then
         b19 = 0
    else
         b19 = b16 - 48
    endif


end select
loopend:
b7= b17 * 10 + b18 * 10 + b19 'Convert from ASCII to Binary
SpeedCount = b7 * 3 + 200        'Speed count for PWM = 200 to 950
Pwmduty M1PWM,speedCount
loop
return  ;end of loop
Bill.
 
Top