HC-06 Arduino Nano Embedded Project?

Hi,

I have an LED project I'm working on, and I want to incorporate Bluetooth so that it can be controlled via smartphone.

I got an HC-06 and Arduino Nano for this purpose, but now I am not sure it will work based on some things I read online: http://forum.arduino.cc/index.php?topic=410046.0

The problem is that I want this to be an embedded / self-contained device, so I won't be able to unplug the TX and RX pins every time I want to make changes to the software.

I also have an Arduino Mega, which I don't think has this problem (can anyone confirm?). I would prefer to use the Nano since it is smaller and cheaper, but if the Mega will work then I might just use that.

Any suggestions for how I should proceed?

Thanks,

Austin

You can use software serial, which enables you to run bluetooth on other pins. Mega has four hardware serial pins, which is probably two more than you need, and you might as well keep it for something more appropriate. Using software serial is not such a great idea but it will be fine if you are just flashing LEDs about.

Thanks, what exactly are the disadvantages of software serial vs. the hardware serial?

SoftwareSerial is slow (9600 baud to 38400 baud) and uses up a fair bit of the Arduino's CPU cycles. Neither should matter for a simple project that turns an LED on or off.

There is also AltSoftSerial and NeoSwSerial as alternatives

...R

I don’t know if the software serial will work if it’s slow. Maybe I should be more specific.
The project is not a single LED, it’s a 16x16 LED Matrix:

https://drive.google.com/file/d/14whhAoXe4I85A--owvhVrnugu9NhdASK/view?usp=sharing

I want to make a snake game that can be controlled via the smartphone Bluetooth app.
It needs to be fast enough for somewhat fluid game-play.

Another idea I had was to make a switch that would disable the TX / RX lines of the HC-06.

I bet you are not as fast with your fingers as you think you are, and you will never know the difference between 9600 and 38400, let alone 115200. If you have a substantial stream of computer-generated data, you probably would know. I don't think you have a problem with the LEDs, you can always suck it 'n' see. The switch isn't a bad idea but likely to be unnecessary.

Nick_Pyner: I bet you are not as fast with your fingers as you think you are, and you will never know the difference between 9600 and 38400, let alone 115200. If you have a substantial stream of computer-generated data, you probably would know. I don't think you have a problem with the LEDs, you can always suck it 'n' see. The switch isn't a bad idea but likely to be unnecessary.

Okay, thanks for the feedback. I will try out the software serial and see how it works.

Do you think the regular SoftwareSerial library will work fine, or is one of the other libraries better?

Thanks everyone for the suggestions.

I'm afraid I am not familiar with any software serial. You might as well try the standard one as it is already in your hand, and it will probably be OK. ..

Update: SoftwareSerial works great, only problem is I am running out of RAM on the Arduino Nano. The atmega328p version I have only supplies 2 kB, which is right on the edge.

potato_power: Update: SoftwareSerial works great, only problem is I am running out of RAM on the Arduino Nano.

What is using the RAM?

Post your program.

...R

^ Listen to this… they will help you change some syntax/coding approaches to free up some more RAM.

** @Robin2 -

Thanks for mentioning that NeoSWSerial library.

I had never heard of it before… (and I like that it doesnt disable interrupts!)
not sure if it has any advantages for me yet… but good to know it exists!