How do you use a Wheatstone Bridge to calculate Resistance using Bluetooth?

Use the Companion and the Do It facility to trace your code.

Divide by blank happens when you have not yet supplied input data, maybe because of a Clock Timer jumping the gun.

Be sure to validate your input, and use the notifier blocks that force you to hit an ok button. Alert notifiers don't cut it.

Please, I have another question.


GaugeGenerator2_1.aia (73.8 KB)

This project I downloaded from the MIT App Community, and they said to use it to make a gauge the same as they did, but in their project the gauge heading is not in the middle when rotating.

Set the sprite origins to 0.5/0.5 in the designer

Thanks for this. I did it like you said, and it is working well.
image
Please, I have another question: how can I adjust the clock timer to catch the baseline resistance in air and also with gas resistance?
image
https://www.google.com/search?sca_esv=34891ab36b11c4e5&sxsrf=AE3TifP-14o6FV4RkCcIbyF1rywnQdZOwQ:1761064121124&udm=2&fbs=AIIjpHxU7SXXniUZfeShr2fp4giZ1Y6MJ25_tmWITc7uy4KIeioyp3OhN11EY0n5qfq-zEMZldv_eRjZ2XLYc5GnVnME7glWodDcaQwvGYJtospyF4hao4VocMoniUVvlzzwRcCLYvfsjPeiuln4CZ9mxRNzMJl71rp-WEM_b89yTboF0wE9FSbwRYrSVuB6YHexvLk_d7r_74zDurdYUrhSbdL5TbQGiA&q=gas+sensor+response&sa=X&ved=2ahUKEwil7vaK27WQAxVQulYBHc64BScQtKgLegQIGRAB&biw=1536&bih=729&dpr=1.25#vhid=JolvK0OKC14AdM&vssid=mosaic
source

Please provide the download link and credit the author of that project

Taifun

1 Like

Thanks for your information. I did do this; only I am using it to learn to build my app. Next time I will share the links like you said. Thanks.

Each and every if/then test here is wrong.

You would test
IF and((is a number(ntype)) , (ntype > 0)) then
...

You never apply an if/then test to a number or a text. They are not logical true/false values, which can only be gotten from applying comparison tests.

1 Like

Please for this question. Please, I have another question: how can I adjust the clock timer to catch the baseline resistance in air and also with gas resistance?

How is the app supposed to know if the resistance is in air versus in gas?

  • Just by its behavior over time, or
  • by some extra input?
1 Like

I will add an input of response and recovery time, and they will be the same time. For example, I need to get resistance every 60 seconds, or input time, which I can add in the app itself. I am using this app for my PhD work.
My app will be for gas sensing that can take the data from the ESP32 as voltage and convert it to resistance using a Wheatstone bridge. After that, convert the resistance to a sensor response using R/Rbaseline. What I also have to set is the response and recovery time in the app to calculate the R baseline and R for gas; then it can convert the detected sensor response to ppm using the calibration screen from the slope itself. Also, I need to make three layers for alarming green, yellow, and red by something like a gauge shown on the screen and also send an alarm to the user.
Belalv4.aia (1.9 MB)


Sorry, I don't understand these values.

Are they

  • observations ?
  • input parameters ?
  • statistical analyses of a time series?
1 Like

Input parameters by text boxes

Here's a sample app that calculates response time from the input stream.
(The test run has a negative time, before I switched the before and after readings in the blocks.)


resistance_baseline.aia (5.3 KB)
Sample run

1 Like

I will await a specific question about a specific piece of code.

I leave it to you to read your own code and any other code you may have dragged into your project. You should understand every block and screen of your project.

Here are some inconsistencies I see in your code:

  • Setting a paint color but not drawing anything
  • Testing if bytes are available from Bl;uetooth but not trying to receive anything from BlueTooth.
  • Setting a Web URL to something but not issuing a Web call (Get/Put) or adding an event to receive a web response.

Also, it is time you renamed all your procedures to describe their functions.
The blocks editor has in the past destroyed procedures that have been left in their default names for too long.

By the way, the AI2 Data Science Designer folder has a component with a block to do linear regression.
image
Good luck with your extension.
I don't support extensions.

1 Like

Thank you so much
Actually I will work on my code to link the functions together and also recieving data by Bluetooth and converting Voltage to resistance then to response and concentration in ppm, then degrees to rotate the arrow.
So tomorrow I will send my project to check
Thanks :pray::pray:

When you have no experience with connecting AI2 to a Bluetooth device, it is helpful to get a Bluetooth terminal app from the Play Store to see the data coming from the device, independent of your AI2 app.

Thanks
How can I utilize the resistance baseline project to read real-time data? It can then compute it and send me the voltage. Also, I want to know if I can get resistance directly from the Arduino.

To modify that project for real time data coming from a Bluetooth text stream, merge the Clock Timer with this code:

Here is a simple BlueTooth text receiver sample, for single value per line:
blocks
initialize global message to

...
This code assumes the resistances are send from the Arduino using the println(resistance) command, which converts the resistance to text and ends it with the mandatory \n character.

Instead of feeding the incoming message to a Label, capture the current Clock1.SystemTime and feed the time and message into the graph and readings list of the aforementioned graph project.

I have no idea how your Arduino setup works.
You would need to post the wiring diagram and the code, and hope for one of our hardware fans to chime in.

1 Like


Like this, you mean?

The Clock timer should log the message, not my test slider thumb.

I included the slider in my sample app to simulate input.
Delete the slider component, and use the global message variable value instead to feed the graph and the logging.