Arduino pro micro bluetooth

Arduino Pro Micro, get data out of Tx pin?

I have a Sparkfun Arduino Pro Micro with an ATmega32u4 on it and a Roving Networks RN32 Bluetooth Module Theoretically, I should be able to solder the Rx of the Bluetooth to the Tx on the arduino and vice versa and I should get serial communication over the Bluetooth. Of course, I do not. However, as a first question: How do I get my Arduino to transmit data over the Tx pin? I uploaded this to the Arduino with no hiccups:

However, when I plug up my o-scope, I see no signal over the Tx line. Nada. I see data coming over the USB into the COM port on my computer, but nothing over the Tx pin. How do I get the Arduino to put out serial data on the Tx pin?

Yes, it has the +5v in and the scope is on the arduino’s gnd pin. How do I push serial data over the TX (digital0) pin? I know it’s a code issue

5 Answers 5

You appear to have a «pro micro» style board in which the USB communication is directly sourced from the main ATmega32u4 processor, rather than generated as serial data and then forwarded to a distinct USB-serial converter as on traditional Arduinos. Your question could have been resolved much more quickly if you had clearly stated the type of board you were using in words, rather than only as a product link (so I edited that into your question).

According to the documentation for the official Arduino Pro Micro:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data using the ATmega32U4 hardware serial capability. Note that on the Micro, the Serial class refers to USB (CDC) communication; for TTL serial on pins 0 and 1, use the Serial1 class.

Therefore to generate output on the hardware UART you will need to change all occurrences of Serial to Serial1

The transmit data will be sourced from ATmega32u4 pin 21 which is «D1» (digital pin 1) on the headers. If you wish to probe it, that would be the best place to do so.

If you wish to transmit data out of a different pin which is not connectied to the ATmega32u4’s UART (as your example with digital pin 5 hints you might) you must instead use SoftwareSerial or similar implementation to bit-bang the serial data out of a general purpose I/O pin.

SoftwareSerial mySerial(4, 5); // RX, TX void setup() < mySerial.begin(9600); >void loop()

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Читайте также:  Logitech wireless keyboard with bluetooth

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pro Micro Arduino Bluetooth support? #423

Pro Micro Arduino Bluetooth support? #423

Comments

Are there anything I need to know to be able to connect an Arduino Pro Micro to a Bluetooth Serial Port?

I was able to set the BAUD rate correctly on a HC-06 module from a Pro Micro Arduino, but I can’t connect to the board using this module. If I take this bluetooth module and I add it to my UNO it works fineic .

I did put Standard Firmata back onto the Pro Micro board after setting the board BUAD rate of the HC-06. But I get this error:

1407526193657 Device or Firmware Error A timeout occurred while connecting to the Board. Please check that you’ve properly flashed the board with the correct firmware.

Anyone that connected a Pro Micro to bluetooth serial port successfully?

The text was updated successfully, but these errors were encountered:

I’m not sure why this issue is closed either. I’m having the same issue with an Arduino Micro and the HC-06 bluetooth module. The module was set up using the referenced notes, and it works great with an Arduino Uno or Nano, but no such luck with the Micro.

From reading the Arduino page related to the Micro (http://arduino.cc/en/Main/arduinoBoardMicro), it seems that the Serial ports work differently with the Micro vs the Nano. TTL requires Serial1 instead of Serial for example. Right now I’m assuming this is why it does not work.

Doing a little more digging I came across this: firmata/arduino#97. I’m now thinking this may be the underlying issue?

Not really, it’s that you can’t change what Serial object is used by firmata. That issue is about creating other serial connections outside of the main communication line.

Rick, I undertand that part, However, from reading the Arduino Micro page that I referenced above (http://arduino.cc/en/Main/arduinoBoardMicro) there is the following section:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data using the ATmega32U4 hardware serial capability. Note that on the Micro, the Serial class refers to USB (CDC) communication; for TTL serial on pins 0 and 1, use the Serial1 class.

To me this was implying that the standard Serial communication that the Uno would use with pins 0 and 1 (TTL) is accessed via the Serial1 library, which I thought that issue was saying was not currently supported by Firmata.

You should be able to use either USB (CDC) serial or Serial 1. Both are supported by Firmata. However currently StandardFirmata only demonstrates the USB serial method.

To use USB serial with an Arduino Micro, try adding the following line to StandardFirmata after Firmata.begin(57600) in the setup function:

// this is necessary because the Micro does not restart when the serial connection is established // and the setup code is never run again unless you disconnect the board from power // with an Arduino Uno on the other hand, the board is reset each time a serial connection is made while (!Serial); 

If you want to use Serial1, then do the following in the setup function of StandardFirmata:

// add these 2 lines to the top of the setup function Serial1.begin(57600); while (!Serial1) <> // Change Firmata.begin(57600) to the following: Firmata.begin(Serial1); 

Thanks for the help, but neither approach seemed to help with the bluetooth module. For what it’s worth, using just StandardFirmata worked great over USB with the Arduino Micro. It’s just the Bluetooth module using Tx/Rx pins that is not working.

Читайте также:  Леново v580c драйвера блютуз

Perhaps my original guess as to why it doesn’t work on the Micro, but works on the Nano and Uno was incorrect.

soundanalogous That worked!! And just in time for nodebots day!

I have a pile of micros/leonardos that would not work with bluetooth even though the same HC-05 (in my case) would work just fine on an UNO or a mini. I read the arduino serial reference page ( https://www.arduino.cc/en/Reference/serial ) and thought i would change Serial to Serial1 somewhere. haha. Anywho it was enough to lead me here and now I can control my arduino micro nodebots via bluetooth. This has been bugging me for so long. I like the micros with the usb (that everyone has) over the minis that need something no one has (at home). I made the changes in StandardFirmata ( which I saved as Serial1Firmata ). This is how my setup method looks now:

void setup()
Serial1.begin(57600); // the arduino leonardo and pro micro use serial1 to communicate on pins 0 and 1 (serial RX and TX)
while (!Serial1) <> // While the virtual serial port is not connected all messages will be lost, so wait till it’s ready

Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
Firmata.attach(SET_PIN_MODE, setPinModeCallback);
Firmata.attach(START_SYSEX, sysexCallback);
Firmata.attach(SYSTEM_RESET, systemResetCallback);

// Firmata.begin(57600); // rem’d for use with Arduino Pro Micro / Leonardo
Firmata.begin(Serial1); // Use Serial1 for leonardo and pro micro (as noted above) Serial1 is initialized above at 57600 baud
systemResetCallback(); // reset to default config
>

Источник

Arduino Pro Micro and HC-05 Bluetooth module

I am using Sparkfun Arduino Pro Micro with an ATmega32u4(3.3v, 8MHz) on it (https://www.sparkfun.com/products/12587) and a HC-05 Bluetooth Module. I also running this on Windows 10. I’ve made these connections: (same as this tutorial) with some additional for leds Arduino Pro Micro TxD (Pin 0) -> HC-05 RxD HC-05 TxD -> Arduino Pro Micro RxD (Pin 1) I am following this tutorial: http://playground.arduino.cc/Learning/Tutorial01 I have two Serial ports available for the HC-05 COM30(incoming) and COM31(Outgoing). When I try to send letter ‘H’ in Serial monitor on COM31 the arduino ide freezes and the HC-05 flashes rapidly. When I try to send letter ‘H’ in Serial monitor on COM30 it sends but nothing happens as H should ideally turn on the led. The arduino pro works with a button but I would like to send the command externally as in the tutorial. I also try in processing but the same thing happens as when using the arduino serial monitor. I have been trying for a couple of days now with no idea why it is not working, I have tried adjusting baud rates and changing to Serial1 with no change. I uploaded this to the Arduino to test the Bluetooth module:

#include char val; // variable to receive data from the serial port int ledpin = 6; // LED connected to pin 48 (on-board LED) int ledpin2 = 5; void setup() < pinMode(ledpin, OUTPUT); // pin 48 (on-board LED) as OUTPUT pinMode(ledpin2, OUTPUT); // pin 48 (on-board LED) as OUTPUT Serial.begin(9600); Serial1.begin(9600); // start serial communication at 9600bps >void loop() < if( Serial1.available() ) // if data is available to read < digitalWrite(ledpin2, LOW); val = Serial1.read(); // read it and store it in 'val' >else < digitalWrite(ledpin2, HIGH); >if( val == 'H' ) // if 'H' was received < digitalWrite(ledpin, HIGH); // turn ON the LED >else < digitalWrite(ledpin, LOW); // otherwise turn it OFF >delay(100); // wait 100ms for next reading > 
//import class to set up serial connection with wiring board import processing.serial.*; Serial port; //button setup color currentcolor; RectButton rect1, rect2; boolean locked = false; void setup() < //set up window size(200, 200); color baseColor = color(102, 102, 102); currentcolor = baseColor; // List all the available serial ports in the output pane. // You will need to choose the port that the Wiring board is // connected to from this list. The first port in the list is // port #0 and the third port in the list is port #2. println(Serial.list()); // Open the port that the Wiring board is connected to (in this case 1 // which is the second open port in the array) // Make sure to open the port at the same speed Wiring is using (9600bps) port = new Serial(this, Serial.list()[2], 9600); // Define and create rectangle button #1 int x = 30; int y = 100; int size = 50; color buttoncolor = color(153, 102, 102); color highlight = color(102, 51, 51); rect1 = new RectButton(x, y, size, buttoncolor, highlight); // Define and create rectangle button #2 x = 90; y = 100; size = 50; buttoncolor = color(153, 153, 153); highlight = color(102, 102, 102); rect2 = new RectButton(x, y, size, buttoncolor, highlight); >void draw() < background(currentcolor); stroke(255); update(mouseX, mouseY); rect1.display(); rect2.display(); >void update(int x, int y) < if(locked == false) < rect1.update(); rect2.update(); >else < locked = false; >//Turn LED on and off if buttons pressed where //H = on (high) and L = off (low) if(mousePressed) < if(rect1.pressed()) < //ON button currentcolor = rect1.basecolor; port.write('H'); >else if(rect2.pressed()) < //OFF button currentcolor = rect2.basecolor; port.write('L'); >> > class Button < int x, y; int size; color basecolor, highlightcolor; color currentcolor; boolean over = false; boolean pressed = false; void update() < if(over()) < currentcolor = highlightcolor; >else < currentcolor = basecolor; >> boolean pressed() < if(over) < locked = true; return true; >else < locked = false; return false; >> boolean over() < return true; >void display() < >> class RectButton extends Button < RectButton(int ix, int iy, int isize, color icolor, color ihighlight) < x = ix; y = iy; size = isize; basecolor = icolor; highlightcolor = ihighlight; currentcolor = basecolor; >boolean over() < if( overRect(x, y, size, size) ) < over = true; return true; >else < over = false; return false; >> void display() < stroke(255); fill(currentcolor); rect(x, y, size, size); >> boolean overRect(int x, int y, int width, int height) < if (mouseX >= x && mouseX = y && mouseY else < return false; >> 

Источник

Оцените статью
Adblock
detector