Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:44 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : BT Serial Port Profile for PicomiteWeb

Author Message
aFox
Regular Member

Joined: 28/02/2023
Location: Germany
Posts: 76
Posted: 11:11pm 04 May 2023
Copy link to clipboard 
Print this post

If we use WLAN we have a latency up to five seconds and we need a WLAN access point or router.
Why not using Bluetooth?
Peter said he will definitely not implement Bluetooth.

But an additional Bluetooth card doubles the price, space and increases the power consumption.

So with this post I ask again for Bluetooth but only for the Serial Port Profile (SPP).
I think it covers most of our needs.
If I am right we have to include "pico/cyw43_arch.h" and call cyw43_arch init() also for the WLAN implementation, thus the additional memory consumption should be still in an acceptable range.

I am also willing to give up one or two program memory slots for this.

If have found this small, smart and simple example with source code.
https://www.youtube.com/watch?v=ko_IgcIizaU

As an Android counterpart and example how to implement here a description of of OliBasic’s BT commands.

Bluetooth and OliBasic3.00+.pdf


The current version of OliBasic can be found at
https://www.tapatalk.com/groups/rfobasic/olibasic-3-0-preview-t6292-s40.html#p48903

I consider BLE to be too unreliable for a bidirectional connection and require too much effort to implement.

Happy coding
Gregor
Edited 2023-05-05 09:19 by aFox
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6800
Posted: 06:52am 05 May 2023
Copy link to clipboard 
Print this post

I don't the problem lies in *how* to do it, it's more to do with having enough memory and other resources to be able to do it.

The flash slots are going down rapidly (there are now only 3 if you use the Library) and there is no other method to CHAIN programs.
RAM is full - there's no space left for buffers etc.

I don't know if it's still the case but until very recently BT on the Pico W was still in beta anyway. TBH I don't blame Peter in the least, he doesn't want to risk breaking MMBasic because of something like that.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2077
Posted: 07:52am 05 May 2023
Copy link to clipboard 
Print this post

The expense argument doesn't work - everyones pet project will have arbitrary expenses and it is not sensible to think the firmware could be tweaked (affecting everyone) simply to aid our own particular whims.

using HC-06 or HC-05 modules ($5), bluetooth is laughably easy to implement and possibly one of the most useful things you can do for so little outlay - it just presents as a serial stream you feed into a comms port. It really isn't worth having it specially implemented in the firmware (for me, GPS falls into this category as well, but I'll let it slide coz of the initial satellite sync-up) and is quite arbitrary so it would either be very rigid (so as to have a stable system) or stupidly complex (to keep everyone happy).

below is an example - from my garage controller - the HC-06 is connected to COM1 and even this includes a load of specific stuff... really all you need are the first three lines  suitably tweaked to your expected message format (and even they could be better), any parsing that follows is down to you - want that in the firmware too?  


'have we got something from the bluetooth module
If Loc(#2)<>0 Then
Pause 20'wait for a whole string to arrive - 16mS ish
b$=b$+Input$(Min(16,Loc(#2)),#2) ' grab the data from bluetooth
If Len(b$)>=16 Then' perform basic validation
If Left$(b$,1)<>"$" Or Mid$(b$,16,1)<>"!" Then FlushIO:Goto BadFrame'commands look like $X1505054337041!


'build the real time from the bluetooth message (JIT)
dt$=HumanTime(Val(Mid$(b$,3,10)))
'set date$ & time$
On Error Skip 1:Date$=Left$(dt$,10)
On Error Skip 1:Time$=Right$(dt$,8)
'process the bluetooth command token
Select Case Mid$(b$,2,1)
Case "X"'stop
...
Case "D"'door down
...
Case "U"'door up
...
etc. etc.


as an aside, I see a lot of requests for specifics to be added to the firmware - what happened to our sense of adventure and the joy of building something from the ground up from the available bricks? My ideal system would have stacks of RAM & program space and a comprehensive set of really good primitives - oh, wait a second!
.
Edited 2023-05-05 18:07 by CaptainBoing
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3805
Posted: 08:47am 05 May 2023
Copy link to clipboard 
Print this post

Ideas:

1. how much is a Pico (RP2040) chip? (Very cheap.)

Add another and dedicate it to BT. Use the RPi code on it, tweaked enough to chat to the PicoMite.

(I think the PicoPear might be a good choice if you don't want to make your own board.)

Or,

2. Change Peter's code just for your own use & add the BT stuff.

John
 
aFox
Regular Member

Joined: 28/02/2023
Location: Germany
Posts: 76
Posted: 01:11pm 09 May 2023
Copy link to clipboard 
Print this post

Hi

@Mick
The example from Sonnny I suggested was so simple that I got the conclusion that could be a simple task. I have learned that it is not.
Maybe the consequence is a BlueMite aka PicoMiteBlue.
The bluekitchen-btstack is also used in combination with ESP32 devices, so we will not have many surprises.

@CaptainBoing
Many thanks for your example.
It is a possible solution for first tries.
But in my view is a wearable BT classic application.

@ John
Your idea 1:
I found also Earle’s Arduino-Pico version.
In any case for all Pico developers a good source:
https://arduino-pico.readthedocs.io/_/downloads/en/latest/pdf/
The project is on GitHub under:
http://github.com/earlephilhower/arduino-pico
BTSerialUppercase.ino

It seems, that is possible to connect a Pico (PicoMite) and a PicoW(Arduino-Pico or in future a BlueMite) as a sandwich.
The serial communication between these two devices could be done also by CaptainBoing's code and crossed wires.

Your idea 2:
I try it.
I am able to compile separately “spp_counter.c” as BT classic in conjunction with the “standalone” directory under Windows.
But in case of the examples a true artist of CmakeLists.txt files has done his work.

@Peter Respect!
I tried installing the VSC IDE for C/C++ Pico development on Windows 11. Oh my!
After testing four suggested solutions I found one which works more or less.

I can understand that you are fed up with BT on the Pico.
In opposite to the WiFi examples are the BT examples hidden in the BtStack libs.
Horrible if you want to get in touch with it.

I have asked for a simpler standalone example.

https://github.com/bluekitchen/btstack/issues/474

I hope we get a useful one.

Gregor
Edited 2023-05-10 00:06 by aFox
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024