The LEDs don't turn on at all. I went to the Arudino code to try and debug the issue. When I print the "inSerial", it's just an empty string. Printing "inStr" in the Check_Protocol function throws that backwards question mark. I'd appreciate any help I could get because I can't understand why it's doing this
I'm using an HC 06 module and in the setup() function, Serial.begin(9600) is called. Shouldn't that rule out any baud issues?
Edit: I tried running AT commands using the Serial Monitor in the Arduino IDE. When I type "AT" and click Send, nothing happens. I assume this is a problem, right?
The HC 06 RX is connected the Arduino TX, the HC 06 TX is connected to the RX pin, the VCC pin is connected to the 5 V pin and the HC 06 GND pin is connected to the Arduino GND pin
theflyingoreo:
The HC 06 RX is connected the Arduino TX, the HC 06 TX is connected to the RX pin, the VCC pin is connected to the 5 V pin and the HC 06 GND pin is connected to the Arduino GND pin
The BT module is a 3.3volt device. RX most be protected from Arduino's 5volt signals.
The youtube video you posted shown a voltage divider on the RX pin for that reason.
The TX/RX pins of the Arduino are also used for serial comms with the USB chip.
Better to use SoftwareSerial (in the examples of the IDE) on different pins for the BT device.
If you use the normal TX/RX pins, dont "pinMode" them.
Leo..
Setup:
http://imgur.com/a/brexs
The HC 06 RX is connected the Arduino TX, the HC 06 TX is connected to the RX pin, the VCC pin is connected to the 5 V pin and the HC 06 GND pin is connected to the Arduino GND pin
NO, NO, NO. I'm sick of asking people for photo's of their setup and they post a Fritzing diagram. THERE IS A DIFFERENCE. Sorry for the rant, but this is getting ridiculous. If a photo is asked, you should post a photo (like, from a camera that shows your ACTUAL project).
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
A picture of a hand drawn circuit will be more informative, label ALL components and pinouts used please.
We need to see your BT unit, front and back, as some modules come with 5V inputs and on board regulators.
Wawa:
The BT module is a 3.3volt device. RX most be protected from Arduino's 5volt signals.
The youtube video you posted shown a voltage divider on the RX pin for that reason.
The TX/RX pins of the Arduino are also used for serial comms with the USB chip.
Better to use SoftwareSerial (in the examples of the IDE) on different pins for the BT device.
If you use the normal TX/RX pins, dont "pinMode" them.
Leo..
I tried setting up the circuit with the voltage dividers, but instead of 2.7k and 4.4k ohm resistors, I replaced them both with 1k resistors (the only other resistors I have are 100, 10k, 470k and 10 million) and the exact same issue came up (reverse question marks)
theflyingoreo:
I tried setting up the circuit with the voltage dividers, but instead of 2.7k and 4.4k ohm resistors, I replaced them both with 1k resistors (the only other resistors I have are 100, 10k, 470k and 10 million) and the exact same issue came up (reverse question marks)
No offense, but those pictures are pretty bad (the first too at least). You should take new ones so that all the connections are easily seen and verified. Then post those pics.
Well, to be 100% honest, I don't know how you expect it. Considering none of the wire lengths are customizable (they all have headers and cutting them would defeat the purpose), they're inevitably going to be tangled up when I try to snap a picture of them. Also, the fact that they're long wires makes it hard for me to get any kind of good close up shot while still getting everything in the shot. I tried labeling this portion of the circuit but I don't know if you're going to find it any more useful
The Blink sketch works perfectly, so I know that the LED circuit isn't the source of the problem. The premise is the same as a Blink sketch. When I press the On Button, the app sends the string "2on" to the Arduino, which calls digitalWrite(ledblue,HIGH). When the Off button is pressed, the app sends "2off" to the module, which calls digitalWrite(led,LOW). It's something up with the Bluetooth module. For whatever reason, the Arduino isn't getting the correct string when either button is being pressed.
There's no real way for me to get a decent shot of the Bluetooth module. The module is so small and the wires are long enough to the point where if I zoom out so that I could capture everything, you wouldn't be able to see anything properly.
The module is connected like this:
HC 06 -> Arduino
Update: So when I call Serial.read(), pressing the ON button results in the Arduino getting the integer 253. When I press the OFF button, the Arduino gets the integer 252. I updated my code to work with this, but I specifically coded my app to send the strings "2on" and "2off". How the hell is the Arduino getting an integer from the module?
Power_Broker:
No offense, but those pictures are pretty bad (the first too at least). You should take new ones so that all the connections are easily seen and verified. Then post those pics.
What did you find bad about the first image? It shows everything clearly, except whether OP mixed the LED's + and - pin. I don't want to be a smartass, I just don't understand...
Maybe my eyes are bad, but the connections on both the breadboard and Arduino were very difficult to verify without assumptions. It just wasn't clear. It has nothing to do with resolution, but more with composition.
I modified my app a little bit and added a green LED too.
Green ON sends the integer 1 -> Serial.read() gets 254
Red ON sends the integer 2 -> Serial.read() gets 255
OFF sends the integer 0 -> Serial.read() gets 254
If I do (psuedocode)
if integerRecieved == 254
//turn green on
else if integerRecieved == 255
//turn red on
this works perfectly (aside from the fact that I can't turn them off, since OFF is 254 as well).
I still have no idea why it's doing this. I thought that there might have been some significance to these number (ie. ASCII values), but that doesn't seem to be the case. This project is simple enough that I could leave it like this and call it a "fix". However, I want to work on some more complex projects and I can't have Serial.read() spitting out random integers. Does anyone have an idea?