Lego — Data Logging

Data Collection and the EV3 — Episode # 10

J3
KidsTronics
7 min readMay 27, 2019

--

Data logging is the process of acquiring and recording data.

Collecting data by hand can be tedious and error-prone.

Let’s use the Lego computer to do this monotonous task for us; Be Welcome :)

Jump to videos? to see my Lego’s youtube playlist— click here;

Data Logging can help you learn the world around you by streaming and collecting sensory information about your surroundings :)

With Data Logging you can:   - create the data file; 
- collecting sensor data;
- writing the data to the file with a timestamp;
- and even controlling the rate of the data collection...

And Here is the video:

Here is our LogBot v1 program!

Code

The Tribot rotates on its own axis and slows down its speed until it stops. The code takes 100 readings and stores the information in a file called CurrentPowerTestData; When opening the file use Tools> Memory Browser and rename the .rbt to .csv. So done open it in google spreadsheet.

Watch the video for more information, please;)

I tested the code with the Tribot on the table and suspended in the hand and see the difference in the graphs below:

Graph I

I lifted the robot so that the wheels would run without load:

Graph II

Now the robot rotates with load:

Results

The blue line is the motor power. My battery is brand new.

As the battery goes unloading certainty the maximum values of rotation will be decreasing.

See that the motor (blue line) reacts almost linearly with the power demanding (red line).

For Graph I the max power is 96 (without load).

For Graph II the max power is 90 (with load).

Now you have a way of knowing if your plant is being efficient or not; what is the charge level of your battery? My mechanical designs are efficient? Is the gearbox releasing all the power of the motor?

Now you have a data log! Congratulations!

Keep reading for more information about data logging…

Download All The Files For This Project

My Block

The LogBot v1 program uses a Text block to join the Power parameter and Current Power reading values in a file.

This method can quickly become cumbersome as the number of variables increases:/

To solve this problem we present version 2:

Meet LogBot_v2 in the format of My Block named LogData:

Correction in the video below: Do not forget the last data wire from Text Block to File Block. Oops sorry:/☝️☝️

LogData makes the process of displaying on the screen numbers in text format a breeze (up to 1 timestamp and 4 readings);

To learn how do My Block, watch this video:) ☝️ Correction in the video below: Do not forget the last data wire from Text Block to File Block☝️

Testing My Block

Now let’s use the SteeringTestData2 file to test my block DataLog:

This program will make the Tribot traces a spiral line similar to a snail shell. It is very interesting.

While Motor B maintains the speed of 50, the Motor C will slow down the rotation until zeroing, then begins to turn backward. All this movement is recorded in the file SteeringTestData2 and the graphic below describes the movement.

Here is the resulting graph:(https://docs.google.com/spreadsheets/d/1HAJsQT0U_IEzeSizSLKVT9YokYcONA3lbj3umdzD_JY/edit?usp=sharing):

When the Steering parameter is 0, both motors have a Current Power reading of 50;

When the Steering parameter is 50, Current Power of the Motor C is 0, which means it’s not moving at all.

When the Steering parameter at 100, Motor C has a Current Power of -50, so it moves just as fast as Motor B but in the opposite direction.

A Steering parameter between 50 and 100 causes the robot to spins around.

brainstorming

Imagine that you are the Automation Solution Providers (ASP) for the Fast Delivery Company above.

The first information for your data logger will be the Time Receps of Gods and the Number of each Pallet; this is the timestamp in which each good is received in the warehouse (see below). Read an RFID tag that cames sticker on top of each pallet.

Here is how your reading workflow:

Realize that the forklift is smart too; it does the reading of the pallets that it carries. These data are retrieved to your data logging too.

The Clerk who collects the goods for the boxes uses a portable device to read the RFID tags. This data will compose your datalogger as well:)

Ok you’ve got the idea, right? Now it’s up to you! Make your own data recorder!

That’s all for now, folks.

See you soon!

Bye o/

Download All The Files For This Project

Related Posts:

01º Lego Episode — Our Startup’s Journey — Invaders and Invasions?

02º Lego Episode — Timmyton Lego-Learning-By-Playing — L2BP Series

04º Lego Episode — Lego MotionsTribot v 1.0Seeing Your Creation Move — Move Steering Block

05º Lego Episode — Lego Motions Move Tribot Around — And Backward…Five Programs Files

06º Lego Episode — Lego SensorsTouch N Color — Two out of five human senses — Touch N Sight

07º Lego Episode — Lego Sensor LineFollower — Line Follower Tribot v1.0

08º Lego Episode — Maze Solving Robot v1 — Lego Solution Right-Wall-Follower-Robot

09° Lego Episode — Gettle_&_Sound_Bots — How gentle can a robot be? What is the audible range of the human ear? How deep can we dive?

10° Lego Episode — Data Logging — Data Collection and the EV3

11º Lego Episode — Binning the LineFollower Code — Binning: Arithmetic To Map Sensor Reading

12º Lego Episode — A Proportional LineFollower Robot — Advanced Math To Improve Your Robot’s Steering

13º LEGO Theory — Theory of Multitasking — A very Useful Programming Technique

14º LEGO formula — Normalizing Data — Converting Data to Use The Same Range

15º Lego Episode — PID — The Ultimate Line Follower — Algorithm for your EV3 PID Line Follower Robot

16° Lego Meets Pixy Episode — How to Connect Your Inexpensive Camera Module to Lego

18° Lego Episode — GEARS & WORMS — Geartrains & Worm & Clutch Gears

23° Lego Episode — Differential Explained — How Differential Works?

24° Lego Episode — PitBot — A Star Is Born — Working at The First Structure in Our Sparring Robot

25° Lego Episode — PitBot Is Agressive? Well, No Worries! — Making PitBot bite!

26° Lego Episode — Dancing Good w/ PitBot — All The Secret for Replicate This Awesome Robot

27 ° LEGO Episode — Sumo Arena is Ready! — Here is the playing arena for Arduino x Lego

28 ° LEGO Episode — Pick Pitbot Up! — Our Robot Are Leaving Body & Paint Shop

28 ° LEGO — B — Episode — Pitbot Battery & Sensor Setup — Preparing The infrastructure for running Arduino code

29 ° LEGO Episode — Bridging All Sensors Together — Pitbot — Collecting All Codes for the Final Act of Giving Behaviors to Robot

Credits & References

Book: The Art of Lego Mindstorms EV3 Programming by Terry Griffin

EV3 Large and NXT Motors — The Differences Explained

Building Instructions & Program Descriptions

LEGO® 9V Technic Motors compared characteristics

Robotics for Children (& Parents (& Grandparents))

Tribot v 1.0 .pdf File

Introducing LEGO Digital Designer

A data logger (also datalogger or data recorder) is an electronic device that records data over time or in relation to location either with a built in instrument or sensor or via external instruments and sensors. Increasingly, but not entirely, they are based on a digital processor (or computer). Data logger — Wikipedia

--

--

J3
KidsTronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!