The MR-B3AM bonus project for ev3 is a project which lets you measure the colour and length of Lego technic beams. These are fed end on into the “machine” which uses the colour sensor to detect the colour, and with the aid of the motor sensor to mearuse rotation is able to calculate the length of the beam as well.
The original project requires you to push the enter key to initiate each new “run” of the process, and I found this a bit tedious. I decided to add the infra-red sensor to the project to detect whenever a new beam was inserted and thus automate the process a bit more.
The original project displayed the results on the screen, indicating the colour and length of the inserted beam. It also used sound to say “Detected” when a new beam was inserted in the machine. I created some further sounds, and altered to project say both the colour name and the beam length on detection. I also made one small mechanical modicfication to the original project.
The drive from the medium motor used is transferred to a vertical shadft by means of two gears at the top of the shaft. I found that one of these tended to move downwards and disengage wqhen the machine was operating. There was a space below the gear which fitted a half height friction bush. I added this at step 54 of the build instructions.
ADDING THE IR SENSOR
To modify the original model, build it as specified as far as step 61, but do NOT insert the pieces shown there. Instead carry out the building instructions for adding the IR sensor shown here. Then continue from step 62 onwards of the original build. The IR sensor should be connected to input port 1 using a 35cm connection lead.
build instructions are shown here
The finished addition looks like thisNote the motor show is the motor already incorporated in the project…not an additional motor. It is shown as a separate motor purely for convenience.
The IR sensor should be connected to input port 1 via a 35cm cable
To accommodate the IR sensor two simple changes are made to the MR-BEAM program.
The original is altered to the second version below
The text in the display block is changed from Press enter… to Insert Beam…
The wait block is changed from waiting for a press on the enter  key to waiting for the IR sensor proximity to be less than 4
Note it is set to port 1 (top right)
These small changes will enable the IR sensor to work with the model
Operation is as follows. When the program is run the motor starts straight away and the first beam can be fed into the machine for processing. When the first beam is elect4ed, the machine waits until a new beam is placed at the entrance slot. (IN fact the ir detector will detect your fingers below the sensor rather than the beam, but this will start the motor to process the beam automatically.
I thought it would be nice if the model said aloud the detected colour and the beam length found. I recorded extra sound clips to say 5 beam, 7 beam….13 beam. The colour names are already included in the EV3 files. To add the sound files, I modified the print results MyBlock and produced a second version PrintSayReslt (you are restricted in the name length)
Basically this inserted sound clips at the appropriate places in the switch which generates the colour name and beam name (5L, 7L….) which is printed on the screen.
Included with this note is MR-B3AMrbn.ev3 the modified project containing the new program if you don’t want to do the modifications yourself.
TIP to produce the sound files I recorded a single file separately from the Lego program saying 5 beam…7 beam….9 beam….13 beam
I used the program audiology to add speech compression to produce a file with a uniform quite high volume and saved this as an mp3 file
I then opened the file in the Lego sound editor tool and used the start and end markers to extract and save separate internal sound files for each required sound naming them beam5 beam7 beam9 etc
finally, you can see a video of the modified project here