Discussion about Cancelling Alert message temporarily/permanently and about using sensors to detect sudden increase in speed after short term rest or less movement?

Just track Simple Steps in a Clock Timer.

1 Like

How can we do that?

I must confess that I have not yet used the pedometer component, and am working from the docs.

So here's an assignment for you.

Show all the pedometer attributes in Labels and walk around.

Report back on what you see.

1 Like

I created something like this. I don't know what I did ie, my brain went into complete confusion.
Can you give me some clarity after seeing these block image. If there are errors please help me to solve.

I used this approach in this project Why these blocks are not working? Hi, I wish to play music3 when music1 and music2 are playing - #13 by S.V_Arul_Shiju

My confusion is mainly because of using clock. I don't know to use clock or tinyDB.

Purpose:

  1. Check if user is 'walking or not' using pedometer. If pedometer walksteps are too low for a given time then user is not walking. If pedometer distance is too less for a given time, then user is not walking.

  2. Check if user is 'driving or not' using accelerometer. If accelerometer speed is >10km/hr then user started driving. But, confirm this only if user is not walking.

  3. Check if user is walking. If pedometer walksteps and distance are as expected then user is walking. If accelerometer speed is less as expected then user is walking.

  4. Once the driving speed went above 10 km/hr, then do two things.

4.a) Say 'You started Driving'.
4.b) Check if the speed comes down at around 0 km/ hr for atleast 30 seconds. Then, confirm that the vehicle is stopped once. Only, this happen then repeat the above steps to know if he is driving again to give the voice again as 'You started driving'.

I wish to finish this project today, so somebody please help me.


Am I applying clock in a correct way?

Are these all your blocks? I did not see Clock.Timer event.

Okay, If it is necessary programming rule to include timer, then I shall include. I am adding few more blocks as well. Will share to clear more doubts.

Setting the Interval and Enabled is for trigger the Timer event.

But from your blocks, there is no relationship between your app and Clock.

1 Like

@Kevinkun ,

I need to set interval.

  1. I want to run pedometer sensor for few seconds (eg. 30 seconds or 10 seconds) repetitively and check if a person walked in that gap. I want to check this for every 30 seconds.

  2. I want to run accelerometer sensor forever if the app is ON and I want to know the interval whenever the accelerometer sensor detects less movement or no movement. This is again to know if a person is not driving.

I expect to run all the blocks repetitively or in loop.

I am including blocks like this even more to find intervals like this. Guide me.

@Kevinkun have you seen the explanation? Can you give more clarity?

How can I create repetitive (loop) tasks/code-blocks using clock/timer? ie, to check some readings regularly and whenever that reading reaches expected value, an alert has to be triggered.

I guess, finally I reached the result. I used only accelerometer sensor to give a message to the driver that 'You Started Driving'. For that I did two things. 1) Check if a person was not driving before he begins to drive. ie, 1.a) Confirm first that the driver was not driving 1.b) Confirm second that driver is driving. Now play an audio message as 'You started Driving'. (Numerical values set in this example are only for experimental purpose).

If there is any unnoticed error or if there is better idea, please share here.

NOTE: Only Player 3 audio has volume and all other players are muted. And, Player 1 audio file length is very short, may be around or less than a second. Short audio file in player 1 is given , so that the player 1 will be completed quickly to proceed further tasks.

I am surprised that you did not use the Location Sensor (GPS) to determine if you are driving.

If you were to run your phone's Acceleration Sensor and played jump rope, would it report you as driving?

1 Like

I tried location sensor by being inside home. It is taking time to update the value. My plan for these blocks is to give immediate message to the driver that 'You started to drive' as quickly as possible.

Because of the delay in location sensor, I ignored it temporarily because the purpose is to give quick message.

Yes, we have to check distance as well to differentiate Jump Rope and driving. I will work on it.

If you want a "quicker response" you might try this:

1 Like

Okay, how can I measure the movement and distance using this extension?

Okay, Let me try.

I guess, if we check the stability of the speed then we can differentiate if a person 'started to drive' from his/her 'other actions'. This can be done by using accelerometer sensor itself, I guess.

And, I found an error, there are x axis, y axis and z axis values for accelerometer. In this example, I set the x axis value. That is Forward movement of phone. But, while driving people may keep their phone in different position. So, I am going to create blocks to detect speed in any direction and then say 'You Started to Drive'. Yes, there will be the disadvantage that you mentioned.