|
Atmega328 |
x 1 | |
|
button |
x 1 | |
|
crystal 16mhz SMD |
x 1 | |
|
22pf capacitor |
x 2 | |
|
100nf capacitor |
x 2 | |
|
100uf capacitor |
x 1 | |
|
RJ12 lego connector |
x 1 | |
|
1x4 header |
x 1 |
Lego sensor adapter - Use Lego EV3 sensors with Arduino
Intro:
For quite some time I was working on an educational robot. Thanks to Leaf Award I started working on Robot Cing (https://hackaday.io/project/93532-robot-cing-educational-robot-for-everyone). Unfortunately, it is still not done because I keep finding things that can be improved and I am writing manual where programming would be explained as well as basic hardware functions. In the meantime, I created this adapter board which currently allows you to connect Lego EV3 color sensor as well as a button to Arduino using I2C. The address of every sensor can be set without flashing a new program into the board. In the future, I want to add a Lego EV3 ultrasonic sensor and IR sensor support. Also, NXT sensors should be possible to implement but I do not have them so currently, I am unable to develop code for them. I used 2 Arduino nano board which I had at home.
My story:
During many years which I am learning robotics I used multiple platforms. I started using Lego NXT later upgraded to Lego EV3 and finally switched to Arduino and Raspberry pi. Many people think that switching from Lego to Arduino is easy and when they try to do it they fail miserably due to lack of understanding of hardware as well as new programming language (typically C/C++). Worst thing is that they buy expensive hardware like motors and sensors even though they already have them and used them in the past(I am talking about Lego sensors and motors). Using this hardware has many advantages for beginner over buying something else. Firstly it is much cheaper because you do not have to buy everything. Secondly it is easy to build on (everybody can build a robot from lego but not everybody knows how to use CNC router or lathe or 3D printer to create parts that can be assembled). And last but not least Lego most lego sensors are pretty good at job they are supposed to do ( I would say only exception is Gyro which isn't as good as MPU6050 :D ). Only problem was that nobody that I could find was able to connect them to Arduino and write some code to read them. So one day I decided to hack them using logic analyzer and research from internet. I had sensors at home and logic analyser as well so only question that remained was how long would it take. It turned out that about ten to fifteen hours was enough to determine their pinout, interfaces used (I2C and UART) and figure out their protocol. I used them in my robots for some time but there was a problem. You have to send them an acknowledgement bit every 300ms which is hard to do if you are a beginner, so I decided to build board with atmega328 which would handle data reading and would act as sensor over I2C. Its address would be changeable by user in order to connect more then 1 sensor only. Currently I did not publish PCB design because I wanted to test it but here are two links which helped me the most (https://www.dexterindustries.com/wp-content/uploads/2014/05/Breadboard-Adapter-Sensor.gif, https://www.wayneandlayne.com/bricktronics/design-and-theory/).
Current stage:
Currently I am still waiting for PCBs from china so demo videos are made using two Arduino nano boards. First Arduino nano handles communication with sensor and sends acknowledgment bit every 300ms. In final product this would be handled by Lego sensor adapter board. Second Arduino can read data in anytime using I2C and it can also set multiple sensor modes if sensor supports it. I2C address of every sensor module can be set without flashing new program using jumper Addr and second Arduino. Library for this sensor is already created by me and approved by Arduino IDE (https://github.com/StanislavJochman/LegoSensorAdapter).
Future:
In the future I would like to create similar board which would use I2C to control EV3 motors with encoder feedback. I would like to opensource this project when it is done as well as create tindie store for it where beginners could buy preassembled PCB for Lego sensor and motor adapter. I would like to create video manuals as well as paper manuals for these boards.
Updates:
I will update this post when I will assemble PCBs.
Video:
https://youtu.be/leZQ1gBrtHU
Lego sensor adapter - Use Lego EV3 sensors with Arduino
- Comments(0)
- Likes(4)
- Engineer Jul 14,2023
- Engineer May 22,2022
- Alexander Ehle Feb 07,2021
- Michael Klein Jul 29,2020
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Stanislav Jochman
- Lego sensor adapter - Use Lego EV3 sensors with Arduino Intro:For quite some time I was working on an educational robot. Thanks to Leaf Award I started work...
- I2C Ultrasonic sensor with compensation Why did I make it?I needed a sensor which can be put on an I2C bus and handle distance measuring on ...
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
154 1 1 -
-