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

First of all, thank you so much for helping me. My target from this project is to learn and improve my work; as you know, additional skills can increase the offers in the future.


I connected the Wheatstone bridge to R1= 30k Ohms, R2= 30 k Ohms, R3= 30 k Ohms, R4= 30 k Ohms, so the unknown resistance is also 30k Ohms
The ESP32 is reading the accurate value of resistance.

Belalv5 (2).aia (1.9 MB)

I see inconsistency between your Arduino code and your output stream.

Your Arduino code stops at just one reading per line:


It omits the first and second input parameters.
It looks like your source code was cut short.

Your terminal output shows 3 readings per line, separated by semicolons (';').
image

Be sure to split at ';' if building a table line by line from your input.

The clearest block images are those generated using the AI2 Helper mass download browser extension at

1 Like

Thanks, the photo with green numbers was before I changed the code to only unknown resistance; please check my app chart, and you will find that I only receive the resistance.

You know the difference between .TextColor and .Text?

Check the tool tips.


Same deal here.

1 Like

Sorry, Yes I know the difference
Thanks


What magician's hat did you pull Rair and RG (not Rg) out of?
The rising readings extraction process is supposed to be based on the just calculated R0.Text and Rg.Text values.

Also, R(any suffix) is supposed to be a resistance value in your naming scheme, right?

Then why do you call a time difference a name starting in R, and overlapping with the maximal resistance value of the graph?

1 Like

Sorry here, during designing I confused the textbox and label text; I will modify them.

A word about naming things in programs.

Unlike math, where you are constantly making diagrams on blackboards or precious scraps of paper, where space is limitted and your target audience is capable of remembering, for example, that V is for Voltage, and they don't have the patience to listen to you spell out the full name, computer code has a different set of priorities.

Computer code requires readability, redundancy, and self evidency in its variable and component names. There's lots of room on the screen for full names that include type (Label/Textbox/List/...), Unit Of Measure (Volts/Ohms/Seconds/...), context (First/Maximum/Total/Input/Output...), and semantics (Name/Address/PhoneNumber/...).

You only need to set a name once , in the Designer of Blocks Editor' global or local variable init blocks. From then on, the full name is available through pallettes and pulldowns, and via typeblocking.

That makes the code much less ambiguous and less error prone, exposing errors as common sense violations.

It makes code easier to read and to visually debug.

1 Like

I apologize for this; I have only been using the MIT app for about a week or 10 days, and prior to that, I had no experience with it. I will follow your advice. Thanks.

http://www.appinventor.org/book2

1 Like

Please I have one more question after tried many times

Now I can adjust the min and max of the axes, but I need to make the x-axis as time to count by seconds to have resistance vs time, but it is the same. Also, I got R from ESP32, but I need the normal clock to count the time in seconds or milliseconds.

I showed you these blocks before.

You must keep a global variable startMS with the value of Clock1.SystemTime for when you started taking readings.

The current number of seconds from start is the round of (Clock1.SystemTime - startMS) / 1000.

In the email copy of your post, there were blocks that don't appear in your board post, where you use the Clock Seconds(Instant) block. That's the wrong block to use, becuase it just shows the digital clock Seconds (00-59) of the current Instant.

Further block help would require a current aia export.


Thanks for your kind reply.
I removed it, but it's still the same, and also the stop button is not working to start analyzing the graph, so should I set it to disconnect the BLE?

Post your new aia export.

Belalv6_2.aia (1.1 MB)
Thanks.
Please, screen 4 is working on ai companion, but when I download the APK file, it crashes; this is only for screen 4.
For the header of the gauge, I followed the advice, but it has the same issue as it is going to another position, including the project you mentioned before about the gauge, as it has the same problem.
https://groups.google.com/g/mitappinventortest/c/k20NEzXSBy8/m/XzQis0IBBwAJ

I am unable to download your aia file onto my desktop PC, because Windows Defender identifies it as having

Trojan:Script/Wacatac.B!ml

Upload the aia file to code.appinventor.mit.edu with an anonymous login, and send me the reentry code.

Looking at the block image you posted, you used /n where you should have used \n.

image

What is the point of setting a setting to its current value?

I can't see from your blocks what file name you are writing to in the Clock Timer.

That might be a problem at run time.

Also, you are writing the start time in column 1 of your CSV table output, instead of the relative time in seconds from the start of the run, which you are adding to the local table properly.

Why did you not copy the already working expression ?
image

That's from 2019.

Stuff goes bad over time.

You don't need a fancy gauge.

Just Draw fat colored bars on a Canvas, proportional to your range percentages.

Or change the background color of a Label.

1 Like