Hello everybody!
I think we all agree Annex has given us a lot and one way we can back is to improve it be even more awesome by supporting more peripherals. So here is an initiative from my side: We can pick peripherals we think are useful and write "drivers" to help integrate them into Annex.
I'll start with something like this:
https://www.aliexpress.com/item/4000070604981.html
This is a GPS tracker that Annex doesn't support. Imagine if I were to buy this, how could I integrate it to Annex if I got all the data sheets, specs, documentation..etc? And after I'm done, how can I submit my code to Francesco to possibly integrate into Annex (or better still, make into a library?)
Having coded in Visual Basic (4 to 6) too, I like the idea of a "checklist" of the peripherals we want to have included in the flashed version of Annex when we flash. The most common components would be included in the kernel, but other more demanding components can be ticked on or off to offer the best optimisation possible.
Waiting for your feedback Francesco, sei il mio eroe!
Community love for Annex - writing Drivers for peripherals
-
- Posts: 192
- Joined: Mon Feb 08, 2021 10:10 pm
- Location: Scotland
- Has thanked: 91 times
- Been thanked: 76 times
Re: Community love for Annex - writing Drivers for peripherals
A brief look at that web page showed me zero information about driving the module so you will have to track down the chip/whotsit used. The only visible pins useful seem to be TX and RX. As it is a gps then you could expect NMEA serial comms. So with Annex it is just a matter of using a second serial port and talking with the right baud rate etc.
The new editor facilities allow you to put all the chip routines in a separate group of subs in a single library module which you include in any main programs requiring the gps.
Simpler than Arduino library compiling each time.
I have written using other chips (e.g. the INA219 power supply monitor) which I can now separate from each main program - which makes changes consisten between programs.
With any new chip - ask in here first in case it has already been worked on.
Otherwise - data sheets, arduino library porting or google search for /simple/ use - some chips have loads of modes that you might not need so an enormous library is not necessary.
The new editor facilities allow you to put all the chip routines in a separate group of subs in a single library module which you include in any main programs requiring the gps.
Simpler than Arduino library compiling each time.
I have written using other chips (e.g. the INA219 power supply monitor) which I can now separate from each main program - which makes changes consisten between programs.
With any new chip - ask in here first in case it has already been worked on.
Otherwise - data sheets, arduino library porting or google search for /simple/ use - some chips have loads of modes that you might not need so an enormous library is not necessary.
- Rating: 3.85%
- cicciocb
- Site Admin
- Posts: 3233
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 645 times
- Been thanked: 2276 times
- Contact:
Re: Community love for Annex - writing Drivers for peripherals
Probably what you are looking for is already here : [Local Link Removed for Guests].[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Wed Jul 31, 2024 8:55 am Hello everybody!
I think we all agree Annex has given us a lot and one way we can back is to improve it be even more awesome by supporting more peripherals. So here is an initiative from my side: We can pick peripherals we think are useful and write "drivers" to help integrate them into Annex.
I'll start with something like this:
https://www.aliexpress.com/item/4000070604981.html
This is a GPS tracker that Annex doesn't support. Imagine if I were to buy this, how could I integrate it to Annex if I got all the data sheets, specs, documentation..etc? And after I'm done, how can I submit my code to Francesco to possibly integrate into Annex (or better still, make into a library?)
Having coded in Visual Basic (4 to 6) too, I like the idea of a "checklist" of the peripherals we want to have included in the flashed version of Annex when we flash. The most common components would be included in the kernel, but other more demanding components can be ticked on or off to offer the best optimisation possible.
Waiting for your feedback Francesco, sei il mio eroe!
Apparently your link points to a module based on the same NEO-6 GPS so it will work with this code.
- Rating: 3.85%
- PeterN
- Posts: 805
- Joined: Mon Feb 08, 2021 7:56 pm
- Location: Krefeld, Germany
- Has thanked: 387 times
- Been thanked: 447 times
- Contact:
Re: Community love for Annex - writing Drivers for peripherals
There are already a lot of code snippets in the forum that could be called drivers.
Many use I2C, SPI, serial etc. to perform communication that is not critical in terms of the required signal timing. This often makes it unnecessary to develop or adapt a driver built into the ANNEX interpreter.
I admit that as the number of posts increases, it becomes more difficult to find such gems in a text-based forum.
I will try to pay more attention in future posts to include some meaningful keywords that might help to find the post in a simple forum search.
Many use I2C, SPI, serial etc. to perform communication that is not critical in terms of the required signal timing. This often makes it unnecessary to develop or adapt a driver built into the ANNEX interpreter.
I admit that as the number of posts increases, it becomes more difficult to find such gems in a text-based forum.
I will try to pay more attention in future posts to include some meaningful keywords that might help to find the post in a simple forum search.
- Basicboy
- Posts: 193
- Joined: Sat Jul 20, 2024 11:42 am
- Location: Australia
- Has thanked: 58 times
- Been thanked: 14 times
Re: Community love for Annex - writing Drivers for peripherals
That's awesome. Thanks for the feedback bugs, Ciccio and Peter.
It's great that Annex can already run this chip. But my question is, what if it didn't? Is there a way to automatically convert arduino library into Annex? or how does one write a program to accommodate a new peripheral?
I think bugs answered this, although not in much detail
It's great that Annex can already run this chip. But my question is, what if it didn't? Is there a way to automatically convert arduino library into Annex? or how does one write a program to accommodate a new peripheral?
I think bugs answered this, although not in much detail
I am honestly starting to understand that this is probably way beyond my skills, but maybe with a bit of explanation others can help(?)Otherwise - data sheets, arduino library porting or google search for /simple/ use - some chips have loads of modes that you might not need so an enormous library is not necessary.
I love this community!
- PeterN
- Posts: 805
- Joined: Mon Feb 08, 2021 7:56 pm
- Location: Krefeld, Germany
- Has thanked: 387 times
- Been thanked: 447 times
- Contact:
Re: Community love for Annex - writing Drivers for peripherals
Maybe this is a strange post about writing drivers ...
but I was very surprised that my question to PERPLEXITY got a reasonable answer:
https://www.perplexity.ai/search/can-yo ... pBaNSbCz6A
Can you write ANNEX32 BASIC code to comminicate to a HLK-LD2410B?
Here's a sample ANNEX32 BASIC code to communicate with a HLK-LD2410B human presence radar sensor:
```basic
RX_pin = 21 'Serial RX pin connected to LD2410B TX
TX_pin = 25 'Serial TX pin connected to LD2410B RX
'Initialize serial communication
serial2.mode 256000, RX_pin, TX_pin
'Enable configuration mode
Enable_config$ = "fdfcfbfa0400ff00010004030201"
IObuff.FromHex(1, Enable_config$)
SERIAL2.WRITE_IOBUFF(1)
pause 100
'Enable engineering mode for more detailed data
Enable_engineering$ = "fdfcfbfa0200620004030201"
IObuff.FromHex(1, Enable_engineering$)
SERIAL2.WRITE_IOBUFF(1)
pause 100
'Main loop
while 1
if SERIAL2.AVAILABLE > 0 then
RADAR$ = IObuff.ToHex$(0)
'Parse radar data
if left$(RADAR$, 8) = "fdfcfbfa" then
TState = val("&H" + mid$(RADAR$, 17, 2))
MTDis = val("&H" + mid$(RADAR$, 19, 4)) / 100 'Moving target distance
STDis = val("&H" + mid$(RADAR$, 27, 4)) / 100 'Static target distance
print "Target State: "; TState
print "Moving Target Distance: "; MTDis; " m"
print "Static Target Distance: "; STDis; " m"
endif
endif
pause 100
wend
```
This code initializes serial communication with the LD2410B sensor, enables configuration and engineering modes, then continuously reads and parses the radar data[1][2][3]. It extracts the target state, moving target distance, and static target distance from the sensor output.
The code uses Serial2 for communication, sets the baud rate to 256000, and specifies the RX and TX pins. It sends the necessary commands to enable configuration and engineering modes. In the main loop, it reads available data, converts it to hexadecimal, and parses the relevant information when a valid data frame is detected[1][2].
You may need to adjust the pin numbers and add error handling as needed for your specific setup. This code provides a basic framework for interfacing with the HLK-LD2410B sensor using ANNEX32 BASIC.
Quellen
[1] LD2410 Human presence radar sensor - Annex RDS forum [Local Link Removed for Guests]
[2] LD2410 Human presence radar sensor https://peterneufeld.wordpress.com/2023 ... ar-sensor/
[3] Human Presence Detection - Elektor Magazine https://www.elektormagazine.com/labs/hu ... -detection
[4] Annex32 WIFI RDS Help Version 1.43 - Annex RDS [Local Link Removed for Guests]
[5] Annex32 WIFI RDS Help Version 1.53.2 - Annex RDS [Local Link Removed for Guests]
but I was very surprised that my question to PERPLEXITY got a reasonable answer:
https://www.perplexity.ai/search/can-yo ... pBaNSbCz6A
Can you write ANNEX32 BASIC code to comminicate to a HLK-LD2410B?
Here's a sample ANNEX32 BASIC code to communicate with a HLK-LD2410B human presence radar sensor:
```basic
RX_pin = 21 'Serial RX pin connected to LD2410B TX
TX_pin = 25 'Serial TX pin connected to LD2410B RX
'Initialize serial communication
serial2.mode 256000, RX_pin, TX_pin
'Enable configuration mode
Enable_config$ = "fdfcfbfa0400ff00010004030201"
IObuff.FromHex(1, Enable_config$)
SERIAL2.WRITE_IOBUFF(1)
pause 100
'Enable engineering mode for more detailed data
Enable_engineering$ = "fdfcfbfa0200620004030201"
IObuff.FromHex(1, Enable_engineering$)
SERIAL2.WRITE_IOBUFF(1)
pause 100
'Main loop
while 1
if SERIAL2.AVAILABLE > 0 then
RADAR$ = IObuff.ToHex$(0)
'Parse radar data
if left$(RADAR$, 8) = "fdfcfbfa" then
TState = val("&H" + mid$(RADAR$, 17, 2))
MTDis = val("&H" + mid$(RADAR$, 19, 4)) / 100 'Moving target distance
STDis = val("&H" + mid$(RADAR$, 27, 4)) / 100 'Static target distance
print "Target State: "; TState
print "Moving Target Distance: "; MTDis; " m"
print "Static Target Distance: "; STDis; " m"
endif
endif
pause 100
wend
```
This code initializes serial communication with the LD2410B sensor, enables configuration and engineering modes, then continuously reads and parses the radar data[1][2][3]. It extracts the target state, moving target distance, and static target distance from the sensor output.
The code uses Serial2 for communication, sets the baud rate to 256000, and specifies the RX and TX pins. It sends the necessary commands to enable configuration and engineering modes. In the main loop, it reads available data, converts it to hexadecimal, and parses the relevant information when a valid data frame is detected[1][2].
You may need to adjust the pin numbers and add error handling as needed for your specific setup. This code provides a basic framework for interfacing with the HLK-LD2410B sensor using ANNEX32 BASIC.
Quellen
[1] LD2410 Human presence radar sensor - Annex RDS forum [Local Link Removed for Guests]
[2] LD2410 Human presence radar sensor https://peterneufeld.wordpress.com/2023 ... ar-sensor/
[3] Human Presence Detection - Elektor Magazine https://www.elektormagazine.com/labs/hu ... -detection
[4] Annex32 WIFI RDS Help Version 1.43 - Annex RDS [Local Link Removed for Guests]
[5] Annex32 WIFI RDS Help Version 1.53.2 - Annex RDS [Local Link Removed for Guests]
- cicciocb
- Site Admin
- Posts: 3233
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 645 times
- Been thanked: 2276 times
- Contact:
Re: Community love for Annex - writing Drivers for peripherals
Interesting.
I already tried some time ago to share the Annex documentation with some of the most popular AI available.
Can we consider this as an initial positive sign?
I already tried some time ago to share the Annex documentation with some of the most popular AI available.
Can we consider this as an initial positive sign?
- Rating: 3.85%
- Basicboy
- Posts: 193
- Joined: Sat Jul 20, 2024 11:42 am
- Location: Australia
- Has thanked: 58 times
- Been thanked: 14 times
Re: Community love for Annex - writing Drivers for peripherals
These code snippets are too darn cool to be lost in the middle of my blah blah.
What do you think of opening a new forum where only Ciccio can post to act as a "gallery" for codes? Whenever we have an awesome snippet of code like this, we ask Ciccio to post it there with a description for future use for everybody.
Oh, and while you're at it, maybe open a new "Social" forum where we can socialise on a personal level(?)
What do you think of opening a new forum where only Ciccio can post to act as a "gallery" for codes? Whenever we have an awesome snippet of code like this, we ask Ciccio to post it there with a description for future use for everybody.
Oh, and while you're at it, maybe open a new "Social" forum where we can socialise on a personal level(?)
- Rating: 3.85%
I love this community!
- PeterN
- Posts: 805
- Joined: Mon Feb 08, 2021 7:56 pm
- Location: Krefeld, Germany
- Has thanked: 387 times
- Been thanked: 447 times
- Contact:
Re: Community love for Annex - writing Drivers for peripherals
You do not have the required permissions to view the files attached to this post.
-
- Posts: 586
- Joined: Tue Jun 21, 2022 2:17 pm
- Location: South coast UK
- Has thanked: 341 times
- Been thanked: 189 times
Re: Community love for Annex - writing Drivers for peripherals
I too think an "off-topic" section might be fun.
Anyone else?
Anyone else?