SoftwareSerial to use with Bluetooth module on a Leonardo

Post Reply
jeffeb3
Posts: 2
Joined: Thu Jan 16, 2014 10:28 pm

SoftwareSerial to use with Bluetooth module on a Leonardo

Post by jeffeb3 »

I just bought a Pocket Quad (V1.1) from HK. It's very small, based on the leonardo, and uses a DSM2 Satellite Rx. The Leonardo has only two serial ports. One is fixed to the USB. The second's Rx line is being used by a DSM2 satellite.

It would be cool to use a bluetooth dongle to 1) graph the telemetry on an android phone and 2) adjust the gains using an android phone. I'm not sure, but I don't think I can use the android app with only the Tx line from Serial1.

Does anyone have some suggestions on using a SoftwareSerial to connect to the BT dongle through some other pins (like MOSI/MISO)? Which serial do the android apps use? The Gui one? It seems like a first cut would be to drop hacks in the MultiWii.cpp functions, just replacing the calls to Serial.h with some software serial calls.

I'm not super worried about this thing breaking, or hurting anything because it's so small, but is there anything I should enable to determine the effects of this on the cycle time? I saw some config options for diagnostics, would one of these give me some interesting profiling metrics? Would anyone out there be interested in seeing these statistics?

jeffeb3
Posts: 2
Joined: Thu Jan 16, 2014 10:28 pm

Re: SoftwareSerial to use with Bluetooth module on a Leonard

Post by jeffeb3 »

I've learned a bit more.

1) The software is written such that nothing comes on the Tx without being requested on the Rx. So no real chance of getting gui data with just the tx...

2) The software serial library is prettylimited. I tried loading a simple sketch without the multiwii, to test software serial. I got it to work, at a slow rate, but it wouldn't work at 115200. The send part is blocking, so the higher speed should be lower impact on cycle rate.

3) The cycle rate in the GUI seems like a decent profile metric.

4) I added the SoftwareSerial the multiwii code, set up on a slow speed, and I can tell that available() is being called. Unfortunately, it never returns anything but zero. I think internally it's using an interrupt or timer that is being used or disabled by multiwii, and I don't know where. Kind of stuck here.

o_lampe
Posts: 117
Joined: Sat Nov 02, 2013 5:09 pm

Re: SoftwareSerial to use with Bluetooth module on a Leonard

Post by o_lampe »

Why not using the usb port for a Bluetooth dongle?

Post Reply