Author Topic: Bluetooth logger  (Read 2745 times)

trungosu

  • NewMember
  • *
  • Posts: 1
Bluetooth logger
« on: February 21, 2019, 12:22:02 PM »
I just got a Current, it's working amazingly. However, my test requires to put it in a chamber to test.
- Already soldered HC-06 Bluetooth Module. Is there any app already on the store which I could download and get the data from the CurrentRange? I guess it on Serial Communication, right?
- Curious question about the Power button, what actually holding 2s waiting time to turn off. I haven't seen any pin on the code to control that. I guess it comes from the hardware.

Thank you very much.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Bluetooth logger
« Reply #1 on: February 21, 2019, 03:54:11 PM »
Hi trungosu,
Glad to hear you're enjoying your CR!
Sorry but there is no special app for serial logging header. The serial header/BT header allows you to connect the a BT module and simply get the serial logging wirelessly. How you interpret that data (which in fact you can manipulate and rewrite in any way you need) is up to you.
You can use the ArduinoIDE to look at that serial output if you'd like. More details here.

The power button is not controlled by a pin. The unit can shut itself down after a given time (can be changed in firmware) but that is a separate function and has nothing to do with the actual power button. For details [utl=https://lowpowerlab.com/guide/currentranger/specs-architecture/]see the schematic[/url].

Uncle Buzz

  • Full Member
  • ***
  • Posts: 146
  • Country: fr
Re: Bluetooth logger
« Reply #2 on: February 23, 2019, 07:03:02 AM »
- Curious question about the Power button, what actually holding 2s waiting time to turn off. I haven't seen any pin on the code to control that. I guess it comes from the hardware.
If you are curious how the power button works, you can find a description there "Press ON - Hold OFF latching circuits" (fig. 6)

RK_aus_S

  • NewMember
  • *
  • Posts: 7
Re: Bluetooth logger
« Reply #3 on: June 08, 2019, 07:15:35 AM »
Hello Felix

May I participate here?
I got my HC-06 und configured it to 230400. Now I'm able to send AT command with 230400 Baud within my terminal program:

AT (without CR+LF) gives me back an OK
AT+VERSION (without CR+LF) gives me back an OKlinvorV1.8

But, I don't know how to proceed?

I can connect the HC-06 to my Windows 10 and then get two more serial ports (COM10 and COM11); the HC-06 is coupled, it's LED still blinking.

When I choose a terminal program of my choice (e.g. the Arduino serial monitor, or MobaXterm) and open a session on port COM10, the LED on the HC-06 stops blinking and is permanently on. That seems  to indicate that a "link" is somehow established via COM10.

But, I cannot see any data flooding in with the Arduino serial monitor, plotter or any other terminal program?

Regards
Roman
« Last Edit: June 08, 2019, 09:38:50 AM by RK_aus_S »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Bluetooth logger
« Reply #4 on: June 08, 2019, 10:32:17 AM »
As you can see in the firmware, the CR sends an AT and expect back an OK.
It then assumes there's a serial module of some kind attached and just streams the data.

So this sounds like a question specific to your particular HC-06, as far as "how to use it".
There are several types ("brands"?) out there.
How does yours look like? Do you have a link where you sourced it or a photo?
Mine is generic and it just works.
If the PC doesn't work try opening it on your smart phone with a serial terminal app.


RK_aus_S

  • NewMember
  • *
  • Posts: 7
Re: Bluetooth logger
« Reply #5 on: June 09, 2019, 02:52:52 AM »
It's this HC-06:

https://www.amazon.de/gp/product/B00PJXG9NA/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

If I feed an "AT" without CR+LF via an USB-to-TTL-Adapter to my HC-06, I definitely get an "OK" (also without CR+LF) back. So the HC-06 seems to work via RX and TX pin.

If I edit your sketch and set the variable in line 110 to true:

Code: [Select]
byte BT_found=true;
then, it works.


If I alter the conditional branch only to

Code: [Select]
if (Serial.available()==0)
then it works too.


And - very interesting - if I only connect my little logic analizer to TX, RX and GND, then it works too!


So it seems that there are no incoming bytes available for the sketch. But it is sure that the BT adapter does return an "OK".


Anyway; shouldn't I see any logging output on the Arduino Serial Monitor (connected via USB cable to the CurrentRanger) when I start up the CurrentRanger? Then I could at least see the logging from your sketch to see what's going on? And I could support You because then I could alter the sketch and give out some own debug messages.

But I only see something at all on the Serial Monitor if I reprogram your code. As soon as I restart the CurrentRanger, the Serial Monitor remains empty...
« Last Edit: June 09, 2019, 09:09:47 AM by RK_aus_S »

RK_aus_S

  • NewMember
  • *
  • Posts: 7
Re: Bluetooth logger
« Reply #6 on: June 09, 2019, 10:38:56 AM »
It's not worth the time; it's obviousely that my HC-06 is somehow different as that one You show in your Video:

I've now ordered an other one, with the label "ZS-040" on the back too...

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Bluetooth logger
« Reply #7 on: June 10, 2019, 07:26:13 PM »
The CR doesn't really know you got an HC06 hooked up. It assumes you do, if it gets an OK, and then it just streams data. If you hardcode the BT_found=TRUE then you should see that regardless.
You could use another adapter to see that serial data, mind not having 2 earth GND devices hooked to it at once.

RK_aus_S

  • NewMember
  • *
  • Posts: 7
Re: Bluetooth logger
« Reply #8 on: July 05, 2019, 04:20:39 AM »
I finally ordered a HC-06 in China, with the strong requirement that "ZS-040" must be labeled on the back side of the PCB.
The vendor confirmed that, sent me the HC-06 - and it works:)

The only issue was, that this time, I got it with Firmware 3.0, and this needs another procedure to change the baud rate to 230400...   ???

Regards
Roman

By the way: In the sketch, I see a refresh rate of the Display/Bluetooth Logger of 200 mSec. I wonder how much can this value be decreased (accelerated) until it's no more reliable?
« Last Edit: July 05, 2019, 04:26:35 AM by RK_aus_S »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Bluetooth logger
« Reply #9 on: July 08, 2019, 09:54:39 AM »
You can increase that to as much as you'd like, but the loop is probably hit every dozen milliseconds or so (I'd have to check).
There is a bunch of oversampling and averaging done in hardware which takes some time, so the loop will ultimately depend on that.
If the BT limit is set to lower than that loop time, then it will always output.