Hello,
New here and pretty noob in Arduino projects.
I wish to use the pin 0,1 (Rx, Tx) of the Arduino UNO because I don’t have anymore spare digital pins for communication with the Bluetooth HC-05 module.
The Blynk project on the App consist of 4 button (Up, Down, LightsON. LightsOFF)
I wish to be able to use the App and a RF remote keyfob to activate the stuffs.
According to my actual research:
- I can’t use the software serial standard code used normally in all examples…
- if I understand correctly it need to be in AT command mode to work ??
(HC-05 Not working with Blynk!)
(https://www.instructables.com/id/AT-command-mode-of-HC-05-Bluetooth-module/) - Can’t have the USB plugged while having pin 0,1 connected to the BT module. Otherwise it will create interference of some sort.
- Baud rate on pin 0,1 is 9600, 115200 or something else ??
- I’ve read I should use the 3.3V or having resistances if using the 5V on Vcc but some other places says 5V is fine, especially since the BT board says 3.6 to 6V but Arduino board might use different voltage on pin 0-1… ?
Sometimes I see the BT module on my phone bluetooth devices list, some other times not… red LED on HC-05 is blinking rapidly. tried to pair one time but didn’t work (password 1234)
• Hardware model + communication type. : Arduino UNO with Bluetooth BT HC-05
• Smartphone OS (Android) + version: Galaxy S7, v8.0.0
• Blynk Library version 0.6.1
I know in the code it’s software serial being used but I tried other things as well…
// Table control using AdaFruit RF keyfob remote
// & Bluetooth (Blynk App with HC-05 module)
// Raising up/down & lighting
// Stepper motor driver used: 2X 4A TB6600
// Stepper motor used: NEMA23
// By quebecois_sti, June 15th 2019
// Blynk App code
#define BLYNK_USE_DIRECT_CONNECT
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(0, 1); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
// Link created by Blynk App
char auth[] = "MyAuthCodeHereFromBlynk";
// defines pins numbers
#define stepPin 6
#define dirPin 7
#define enPin 8
#define LTrelay1 3
#define LTrelay2 5
volatile byte relayState1 = LOW;
volatile byte relayState2 = LOW;
#define UPlimitsw 4 // TOP limit switch
#define DWlimitsw 2 // BOTTOM limit switch
#define UPbutton 9 // UP button for raising from RF keyfob Remote-A
#define DWbutton 11 // DOWN button for lowering from RF keyfob Remote-C
#define LTONbutton 10 // ON button for light from RF keyfob Remote-B
#define LTOFFbutton 12 // OFF button for light from RF keyfob Remote-D
void setup() {
delay(3000);
pinMode(LTrelay1, OUTPUT);
pinMode(LTrelay2, OUTPUT);
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(enPin,OUTPUT);
digitalWrite(enPin,LOW);
//Debug console
DebugSerial.begin(9600);
DebugSerial.println("Waiting for connections...");
Serial.begin(9600);
Blynk.begin(Serial, auth);
}
void loop() {
Blynk.run();
//Turn ON the lights
while(digitalRead(LTONbutton) == HIGH){
if(relayState1 == LOW && relayState2 == LOW){
digitalWrite(LTrelay1, LOW);
digitalWrite(LTrelay2, LOW);
}
relayState1 = HIGH;
relayState2 = HIGH;
}
//Turn OFF the lights
while(digitalRead(LTOFFbutton) == HIGH){
if(relayState1 == HIGH && relayState2 == HIGH){
digitalWrite(LTrelay1, HIGH);
digitalWrite(LTrelay2, HIGH);
}
relayState1 = LOW;
relayState2 = LOW;
}
//Raising table & stop at top
while(digitalRead(UPbutton) == HIGH && digitalRead(UPlimitsw) == HIGH){
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(800);
digitalWrite(stepPin,LOW);
delayMicroseconds(800);
}
}
//Lowering table & stop at bottom
while(digitalRead(DWbutton) == HIGH && digitalRead(DWlimitsw) == HIGH){
digitalWrite(dirPin,LOW); //Changes the rotations direction
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(800);
digitalWrite(stepPin,LOW);
delayMicroseconds(800);
}
}
}