HELP - Accelerometer sensor (the actual measurements on the chart), do not know what's wrong

Hello guys,

At the beggining, the project looks like this:
I connected the ESP32 with via usb to the computer and then connected the ADXL345 sensor to it.

I want to create a phone application with MIT APP INVENTOR in such a way that the movements of the X, Y, Z axes are recorded in the form of a graph that records the actual sensor vibrations.

I have already created code blocks in MIT APP INVENTOR and code in "Arduino" but then the application I am downloading is not working properly and is not reading any sensor data.

In the photos attached I present the blocks from the MIT APP INVENTOR and the code from "Arduino". Additionally, I add a photo of the readings from the serial port monitor.

Any ideas?

I notice in your Clock Timer routine you clear the canvas after receiving each x,y,z value.

That would make for a short graph, right?

Also, you only process incoming data after you have passed the end of the x axis?

For good measure, add each incoming complete message to a list and show it in a List Picker Elements, as a log.

If you are getting no data at all, check your BlueTooth Client Delimiter value in the Designer.
It should be 10, to allow automatic recognition of Line Feeds.

If that does not help, 9600 bps is a more common standard for serial traffic.

Oh yeah, right, I clear the canvas after receiving each x, y, z value, so is it wrong?

"For good measure, add each incoming complete message to a list and show it in a List Picker Elements, as a log."

I'm quite new in MIT APP INVENTOR, could you show what you excatly mean by all you wrote above? I mean by screens or whatever. I do not want to change anything what you didn't suggest.

I have Delimiter Byte on 10, so it was good.
If nothing help i will change to 9600 bps.

The project is about to be simply a vibration recorder in the X, Y, Z axes and that's it.

@ABG, could you show what I have to change to make it posssible to work?

Export your .aia file and upload it here.

NOWY.aia (12.6 KB)

There you go! :smiley:

Here are blocks you should change:

PlottingIntervalClock ClearLabelClock

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

You never started your Clocks.
I started the plotting clock at connection time for you.
Your if/then in the plot clock was blocking the input capture under an irrelevant test.

1 Like

Yea, sure, good to know.

I understand, I changed everything as you added in the screenshots above, but still something is wrong. At this point, after connecting bluetooth with ESP32, the entire application screen does not work (i.e. wherever I click, nothing changes - back button, checkboxes, whatever).

What else are we missing? What do you think?

I changed the "PlottingIntervalClock" blocks and added two blocks to the "ListPicker". @ABG

Export your .aia file and upload it here.

Newone.aia (13.2 KB)

Maybe the problem is with the code in "Arduino".
I have no idea. :confused:

The >= allows empty text into the input stream.
You don't want that.

Use > 0 instead, like in my blocks.

Sorry for late reply, but it was the weekend.

I have changed the sign as you wrote above, but there is still something wrong and an error pops up after connecting to bluetooth to ESP32.
In the link above, I am sending you a recording from the phone.

Export your .aia file and upload it here.

APP.aia (13.2 KB)

Hmm, hope you find something.

Maybe the problem is that i have two Clocks or didin"t "initialize global CurrentAccel". Hmmmm

You sent a pieve of text into a socket expecting a label component, 3 times
See attached correction.

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

Okey, I changed as in your attached pictures but unfortunately the same error still occurs as I posted above.

The application turns on, bluetooth is connected to ESP32 and it looks like the error was somewhere when turning on the readings, because without the checkboxes enabled, the error does not pop up, but after turning on any checkbox, the error shows again.

I try different possibilities myself, but I still can't figure out what else to change and I back to your recent suggestions for the app.

In the attachment I am adding the file "aia" after the last changes.

Sorry for the further spam, but I really want to finish the project.

Acce.aia (13.3 KB)

Since your error is in list processing against a split of the input, you were in need of extra code to check if the splits worked before doing list selects.

Add a Notifier1 to your Design screen, and pull in this enhanced procedure.
Upload the error message here if it is not obvious.

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

Hello again :smiley: ,

I did what you suggested. There are my all blocks and screenshots from my phone.
I don't know what i have to change :confused: