element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Experimenting with Vibration Sensors
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Vibration Sensors
  • More
  • Cancel
Experimenting with Vibration Sensors
Blog Experimenting with Vibration Sensors Part 2: The Journey
  • Blog
  • Forum
  • Documents
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: charlieo21
  • Date Created: 27 Jan 2021 4:40 PM Date Created
  • Views 199 views
  • Likes 2 likes
  • Comments 0 comments
  • vibration sensors
  • kemet
  • experimenting with vibration sensors
Related
Recommended

Experimenting with Vibration Sensors Part 2: The Journey

charlieo21
charlieo21
27 Jan 2021

Difficult times

Yes, everyone know this, but this doesn´t have to be a stopper. I'm facing with problems to access to the laboratory with the autonomous vehicles.

So, I'm going to show my progress and in the future I'll make another blog with the rest of the experiments.

 

Car test

The first real test in the field it was in my personal car, I attached the sensor to and ECU that is under the steering wheel. The sensor Z axis was in alignment with the earth's gravity.

 

In the picture above we can see three sections, the first one is on a stone paved road, there's a lot of vibration with high acceleration, with a peak of   29.19ms2 and     −32.56ms2

Then I made an stop when the vehicle almost reached the noise floor of the sensor. After that, I was driving on an asphalt road, in this section we can see that there's less acceleration. But in certain moment, I hit a pothole and we can see it with a initial peak of     18.28ms2   and the another peak of     19.72ms2 , I guess the first peak was when the tire enter in the pothole and the second one when it leaves the pothole.

 

Autonomous vehicle test

Before the lab was closed due to covid, I was able to save a log. In the next picture we can see the results. The sensor was attached to one of the ECUs that I designed. In this case, the sensor Z axis was in alignment with the earth's gravity too, but the ECU components are in the X axis, so, is required to do more measurements in this axis. I adjusted the Y axis of the chart to have the same that the first chart, in this way we can see that in this test we have a much less acceleration, with similar values as the ones from the asphalt road, but with smaller frequency.

With this initial results, we can say that the vibration is less in the autonomous vehicle (smaller acceleration and smaller frequency). But this data is not enough to conclude that the ECUs will survive in this environment.

 

The Code

I used STM32Cubeide to coding and STM32Cubemonitor to log the data. So, it was really easy to configure the ADC using this tools.

This is the part where the conversation is done, it is inside an infinite loop.

/*## Start the conversion process #######################################*/
   if (HAL_ADC_Start(&AdcHandle) != HAL_OK)
   {
     /* Start Conversation Error */
     Error_Handler();
   }


   /*## Wait for the end of conversion #####################################*/
   /*  For simplicity reasons, this example is just waiting till the end of the
       conversion, but application may perform other tasks while conversion
       operation is ongoing. */
   if (HAL_ADC_PollForConversion(&AdcHandle, 10) != HAL_OK)
   {
     /* End Of Conversion flag not set on time */
     Error_Handler();
   }
   else
   {
     /*## Get the converted value of regular channel  ########################*/
     uhADCxConvertedValue = HAL_ADC_GetValue(&AdcHandle);
     res = (float)(uhADCxConvertedValue);
     res = res * 3.3 / 65536;
     res = ((res*1000)-1650)/20;
     Vibration = res;




     if(Vibration >= 3000 || Vibration <= 1000){
    BSP_LED_On(LED1);
     }else {
    BSP_LED_Off(LED1);
}
   }

The result of the conversation it was converted to volts using this formula     ADC·3.3V65536 , then I converted the voltage to acceleration using this formula
   ((Volts·1000)−1650)20mVms2

This gives us the result of the measurement in     ms2

 

The log

STM32Cubemonitor can show us the variable result in a nice chart, but we can log this data in our computer, we only have to enable the log option

This will save the log in a weird file ".stcm", basically this is a json file. So to be able to see the data we have to convert it using this flow.

  1. [{"id":"cc0c8ae8.c69f98","type":"tab","label":"Convert stcm","disabled":false,"info":"This flow is used to convert stcm file in csv file\n\nThe file name must be entered in the \"set file name\" node\n\nThe csv output format is variable Name, x, y\nNote : the data may be processed by group, so the x value may not be in time order. The csv file may be sorted on the x value to ensure order coherency. "},{"id":"a9caceb2.eb94d","type":"file in","z":"cc0c8ae8.c69f98","name":"Read file","filename":"","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":280,"y":360,"wires":[["99d027a1.b92d98"]]},{"id":"9350e2b8.9aa3e","type":"inject","z":"cc0c8ae8.c69f98","name":"Start","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":160,"wires":[["3371f5e6.b3b50a"]]},{"id":"99d027a1.b92d98","type":"json","z":"cc0c8ae8.c69f98","name":"Parse each line","property":"payload","action":"","pretty":false,"x":480,"y":360,"wires":[["badf8efa.bacee"]]},{"id":"badf8efa.bacee","type":"function","z":"cc0c8ae8.c69f98","name":"Format data","func":"let output=\"\";\nmsg.payload.variabledata.forEach (data=>output=output+ msg.payload.variablename+ \",\"+ data.x + \",\"+ data.y+\"\\n\");\nmsg.payload= output;\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":360,"wires":[["38fb106e.c00f"]]},{"id":"d2859af6.e93368","type":"file","z":"cc0c8ae8.c69f98","name":"Write csv","filename":"","appendNewline":false,"createDir":false,"overwriteFile":"false","encoding":"none","x":920,"y":580,"wires":[[]]},{"id":"3371f5e6.b3b50a","type":"change","z":"cc0c8ae8.c69f98","name":"Set file name","rules":[{"t":"set","p":"filename","pt":"msg","to":"C:\\GIT\\test\\test3.stcm","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":160,"wires":[["a9caceb2.eb94d","593d0b11.8d3654"]]},{"id":"f3d3a57a.c56e48","type":"comment","z":"cc0c8ae8.c69f98","name":"Enter your filename here","info":"","x":330,"y":120,"wires":[]},{"id":"38fb106e.c00f","type":"change","z":"cc0c8ae8.c69f98","name":"Set csv extension in filename","rules":[{"t":"change","p":"filename","pt":"msg","from":"stcm","fromt":"str","to":"csv","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":580,"wires":[["d2859af6.e93368"]]},{"id":"b1ba9fe.177b06","type":"file","z":"cc0c8ae8.c69f98","name":"Eraze csv","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":780,"y":160,"wires":[[]]},{"id":"593d0b11.8d3654","type":"change","z":"cc0c8ae8.c69f98","name":"Format csv header ","rules":[{"t":"change","p":"filename","pt":"msg","from":"stcm","fromt":"str","to":"csv","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Variable, x, y","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":160,"wires":[["b1ba9fe.177b06"]]},{"id":"796c6b18.2aab34","type":"comment","z":"cc0c8ae8.c69f98","name":"Process the stcm file","info":"","x":490,"y":320,"wires":[]},{"id":"c2ec88a.7368678","type":"comment","z":"cc0c8ae8.c69f98","name":"Write the csv file","info":"","x":820,"y":540,"wires":[]}]

I took this from this site.

To use it, go to menu import , copy paste the text, and select "new flow".

 

Then for each conversion :

1) in the box "Set file name", enter the name of file to convert (absolute path + extension : "C:\log\test1.stcm")

2) press start. The file will be processed and stored with the csv extension.

 

Conclusion

My first impression is that this sensor has a lot of potential. But I want more information in the datasheet and also characterization data. For example, some output curves at different temperatures.

I was able to do some measurements in two different environments and with the results I can say that the vibration in the autonomous vehicle is less in strength and less frequent. This gives us the impression that If we are design our ECUs as we're going to use it in a normal car, it will survive a less dangerous environment. But this is not the end, we can do a lot more measurements and have a better conclusion. Hopefully this covid madness ends soon and I can continue with this journey.

Thanks so much to Element14, Kemet and Randall for let me be part of this challenge.

Anonymous
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube