Data reading impossible from Bluetooth to a Arduino board

Hi everyone,

I’m trying to use a Bluetooth module ([SMD module) with an Arduino board.

What I have in my ‘project’ is :

  • - a laptop with a home-made software in VB Express 2010,

    • a Bluetooth dongle because my laptop is not Bluetooth built-in,

    • a Bluetooth module which is linked to my Arduino board,

    • an Arduino board (ATmega 328, 5V/16MHz)

    My Bluetooth module and my Arduino board are linked together as shown on [that.

    I’m able on my software to read what is sent from my Arduino board thanks to the Bluetooth communication. That is not a problem.

    The problem I have now is to read a data in my Arduino from my software using the Bluetooth communication.

    My software must read and send messages and my Arduino must send and read messages.

    In my software in VB Express 2010, I use a SerialPort tool to set up communication between my laptop and the Bluetooth module.

    I just put the code below in a button to send the value to my Bluetooth module :

    OutSerialPort.Open()
    If OutSerialPort.IsOpen Then
      OutSerialPort.Write(True)
    End If
    OutSerialPort.Close()
    

    And on my Arduino board, there is another program that normally turn on a LED when it sees True from the Bluetooth module.

    boolean fromComputer;
    
    void setup() {
      Serial.begin(9600);
      pinMode(13, OUTPUT);
      digitalWrite(13, LOW);}
    
    void loop() {
      if (Serial.available() > 0) {
        fromComputer = Serial.read();
        if (fromComputer == true) {
          digitalWrite(13, HIGH);
          delay(1000);
        }
        else {
          digitalWrite(13, LOW);
        }
        delay(1000);  
      }
    }
    

    Both programs works with a USB wire in both way : Arduino to Laptop and Laptop to Arduino,

    But with a Bluetooth module, the communication seems to be possible in only one way (Arduino to Laptop).

    So, have you already had this problem with a Bluetooth module ?

    Normally, if my programs work with USB, they must work with a Bluetooth module, mustn’t they ?

    For me, the Bluetooth module is like a USB wire, it’s just a way of communication, so maybe I need to use another settings that I didn’t use before ?

    In VB Express 2010, there are few settings that could be useful (or not) like RtsEnable, DrtEnable, …

    On the Bluetooth module, there are few pins not used yet like Reset, ReadyToSend, ClearToSend, …

    Help me :slight_smile: , anything can be useful :idea: .

    (And I’m french, so if someone wants to speak french, that’s ok for me :D)](Bluetooth Module (Device) | Hobbyist.co.nz)](Bluetooth SMD Module - SparkFun - WRL-08474 - SparkFun Electronics)

  • Hi again,

    Could it because the Arduino Board is in 5V and the Bluetooth module in 3.3V ?

    So when something is sent from the BT module to the Arduino board, 3.3V for Arduino means 0, it’s probably not enough for it to be seen as a 1 ? What do you think of that ?

    :?:

    toofil:
    Could it because the Arduino Board is in 5V and the Bluetooth module in 3.3V ?

    That’s certainly a likely suspect. To investigate it:

    1. Measure the actual output voltage from the BT module. You’ll need a device that tells you the voltage of the “1”'s (such as an oscilloscope), not one that tells you the average voltage of the output pin (such as an analog voltmeter). A peak-sampling voltmeter might work, it depends on how fast it is and the shape of the logic pulses.

    2. Similarly, measure the voltage on the input pin of the 328 chip (or, at least, the Arduino board input pin).

    3. Compare the actual voltages with the specifications for the processor on your Arduino board.

    If the voltage out of the BT module is high enough, but the voltage into the Arduino board is not, you may be able to get this working by fixing how they’re connected to each other.

    If the voltage out of the BT module is your problem, the fix is a “level shifter”. You can either find one, or make your own. If you search this forum, you should find plenty of hints.

    Happy Hunting,

    Eric

    UARTs have their pins idle-high, so if nothing is sent, then there are no bits on the line disturbing the voltage measurement with an analog multimeter. So judging logic level alone should work with a multimeter.

    But that’s no garuantee, the shape of the pulses might also be the culprit. And for that you need an oscilloscope.