Read data from sensor and transmit via Bluetooth

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Communication
Level 5
Level 5
100 replies posted First solution authored 250 sign-ins

I am learning how to read data from DHT11 sensor and soil moisture sensor, and then transmit the sensor information read via bluetooth. I'm looking for an example of that. I have tried doing it before but no success!
Thank you!

0 Likes
1 Solution
advait_kulkarni
Moderator
Moderator
Moderator
25 likes received 250 sign-ins 100 solutions authored

Hi @Communication ,

You can refer to the following code examples on our github page: https://github.com/Infineon/mtb-example-btstack-freertos-hello-sensor and https://github.com/Infineon/mtb-example-btsdk-ble-env-sensing-temp.

If you are a beginner, you can refer to our training manual and subsequent examples to get started: https://github.com/Infineon/training-modustoolbox-level3-bluetooth.

Also refer to this article on reading data over Bluetooth using its UUID: https://community.infineon.com/t5/Knowledge-Base-Articles/Read-Bluetooth-service-characteristic-usin...

Thanks and regards,

Advait Kulkarni

View solution in original post

3 Replies
advait_kulkarni
Moderator
Moderator
Moderator
25 likes received 250 sign-ins 100 solutions authored

Hi @Communication ,

You can refer to the following code examples on our github page: https://github.com/Infineon/mtb-example-btstack-freertos-hello-sensor and https://github.com/Infineon/mtb-example-btsdk-ble-env-sensing-temp.

If you are a beginner, you can refer to our training manual and subsequent examples to get started: https://github.com/Infineon/training-modustoolbox-level3-bluetooth.

Also refer to this article on reading data over Bluetooth using its UUID: https://community.infineon.com/t5/Knowledge-Base-Articles/Read-Bluetooth-service-characteristic-usin...

Thanks and regards,

Advait Kulkarni

I am having trouble changing the flashing led program to the sensor reading program in Source -> app_hw -> app_hw_device.h & app_hw_device.c. I don't know how to change it because there are too many errors in the repair process.
Thank you!

0 Likes
advait_kulkarni
Moderator
Moderator
Moderator
25 likes received 250 sign-ins 100 solutions authored

Hi @Communication ,

Don't do changes directly in the files in case, go to bluetooth configurator (will be available in the quick panel at bottom left)>gatt settings> click on server>add service>choose environmental sensing>click on the newly added service>add characteristics> you will get a list of many sensors, choose which ever you want>save and close.

This will auto-generate the code and structures for your sensors and you just have to use these generated parameters to store/read/write/etc. the data. You can also create a custom service in case your application requires some functionality that is not readily available from our side.

I believe you have just gotten started and will highly recommend you go through the modustoolbox trainings: https://github.com/Infineon/training-modustoolbox (these will introduce you to all the tools and configurators provided by us to make your coding easier) and also the bluetooth trainings shared by me earlier.

Lastly, kindly create new tickets for your further queries and we will be happy to help, this ticket shall be closed by me for now.

Thanks and regards,

Advait Kulkarni