As online retailers take up more and more of the market, larger and larger warehouses are required to fulfill the ever-increasing demand of customers across the world. Robots are a convenient and powerful way to increase the efficiency of warehouses by automating the organization and processing of containers in a warehouse. Robots that can navigate a warehouse and carry containers to a specified location can increase the productivity and efficiency of shipping operations to satisfy a customer's demand. Whether through lowering error rates, increasing safety, or increasing speed, warehouse robots play significant role in enabling the two-day and same-day delivery of packages in today's age.
This project outlines the steps necessary to build, program, and control a LEGO EV3 Mindstorms robot using an Amazon Alexa device. The robot has a forklift and can navigate a space by following a map of lines on the ground beneath it. It is programmed in Python, using the ev3dev image and library to interface with the components of the EV3 kit. The robot uses two motors for tank-style movement, a small motor for picking up and dropping crates/pallets, a color sensor for following a line, and an infrared sensor for detecting the position of the lifter. The warehouse robot connects to a nearby Alexa device through Bluetooth, using the Alexa Gadgets Toolkit to communicate and receive commands from the Alexa Skill. The user can control the robot by various commands and queries outlined in the following sections and the demonstration.
I hope you enjoy this project and learn something new!
Build the Robot1) Put 6x AA batteries in the LEGO EV3 Brick so the device is ready for assembly.
2) Follow the instructions attached in the Schematics section to assemble the LEGO robot!
3) Use three cables to connect the lifter motor to Port C, the left-wheel motor to Port A, and the right-wheel motor to Port D. Use two more cables to connect the color sensor to Port 2, and the IR sensor to Port 1. (Ports A-D are on the top, Ports 1-4 are on the bottom).
Do not worry about programming the robot at this stage... That section is at the end of the project.
Construct the WarehouseFor this section, you do not need to create the same map layout, but the code is already setup to follow this layout for navigation. If you wish to change the layout, modify the transition and state arrays in the navigation code.
1) Tape three 20" by 30" foam boards together along their long sides to form the layout shown below.
2) Use a thick Sharpie marker to draw the path shown in red. Using two strokes should make the line around 1cm wide (a good thickness for the color sensor to detect).
I designed this layout as a prototype for the robot. You could make any path with reasonable spacing at 90 degree intersections that the robot can navigate.
The only requirements are that the line is roughly 1cm wide, the leadup to each pallet is roughly 5", and the navigation code has the correct transitions and states defined.
Now that we have a layout for the warehouse, we need containers!
3) 3D print the Pallet.stl model attached at the end of the project.
4) Cut out the following 5 pieces of foam from a sheet of foam board.
- 62mm by 60mm (2x)
- 87mm by 60mm (2x)
- 70mm by 87mm (1x)
5) Hot glue the two pairs of foam pieces vertically onto the 70mm by 87mm piece. These will form the walls for the container. (Note: the longer walls should be on the outside with the shorter walls pressed between them)
6) Hot glue the printed Pallet.stl model to the bottom of the completed foam box.
Repeat steps 3 through 6 to have as many containers as you want.
For this section, you will be setting up the Alexa Skill side of the project through the Amazon Alexa Developer Console.
1) Sign up or log in to your existing account on the Alexa Developer Console here.
2) Click Create Skill, then fill in the name field. Make sure the Custom model is selected, and Alexa-Hosted (Node.js) is selected for the backend resources.
3) Navigate to the Interfaces menu, and enable the Custom Interface Controller. This will allow the skill to communicate with connected devices over Bluetooth. (Make sure to press SaveInterfaces after)
4) Clone the GitHub repository using the following command in a terminal.
git clone https://github.com/jonmendenhall/ev3-warehousebot.git
5)In the developer console, navigate to JSON Editor and drag the model.json file from the skill folder of the repository into the space at the top of the page. Click Save Model, then Build Model. (Note: This part may take a little bit time.)
6) Navigate to the Code section, and create new files or modify the existing files where necessary to make sure index.js, util.js, common.js, package.json, and default_attributes.json are in the skill.
7) Click Save, then Deploy. The Alexa skill is now ready, and the last step is to program the robot!
1) Download and extract latest ev3dev image the ev3dev website.
2) Insert the micro-SD card into your computer, and flash the image to the card with a program like Etcher.
3) Insert the SD card into the side of the EV3 brick, and plug in the USB Wi-Fi dongle.
4) Log in to the Alexa voice service developer console here.
5) Click Create Product and fill in the required fields as shown below. Make sure to select Alexa Gadget as the product type, and No for commercial release and intended for users under 13.
6) After pressing finish, select the new product and copy the Amazon ID and Alexa Gadget Secret into the main.ini file in the code repository.
7) Press the center button on the EV3 brick to boot the robot up. (Note: I have found it useful to unplug the cables to the IR sensor and color sensor before booting as sometimes these interfere with the Bluetooth for some unknown reason. You can plug the cables back in after the device has fully booted)
8) Navigate to Wireless and Networks > Wi-Fi, then make sure the Powered box is selected by pressing the center button. Press the center button on Start Scan, then scroll down and connect to your local Wi-Fi network. When the robot is connected, there should be an IP shown in the top left corner of the screen.
9) Go back, then select Bluetooth, and make sure Powered is enabled. Your device should now be ready for development.
10) In VS Code open the downloaded repository, install the ev3dev-browser extension from the Extensions menu.
11) In the ev3dev-browser pane click to connect to a device, then select the device named something similar to ev3dev. Your device should now be connected and you can see the battery voltage, etc...
12) Click the small arrow button to Send workspace to the device.
13) Place the robot on the white foam board at the starting position.
14) Right click the device name, and select Open SSH Terminal. Run the following commands to navigate into the directory, and run the Python code. (Note: The default password for sudo is "maker")
cd ev3-warehousebot
sudo python3 main.py
15) On the first run, the terminal will display a message saying the device named "Gadget..." is in pairing mode. Open the Amazon Alexa app on your phone and choose Pair Alexa Gadget to connect your nearest Alexa device to the robot using Bluetooth.
1) Say "Alexa, open warehouse bot"
2) You can start issuing any of the following commands. The commands and questions should be intuitive, but some wording can make Alexa freak out... for specific invocations, look at the model.json file.
- Pickup from slot (1, 2, 3, 4, 5...)
- Deliver to slot (1, 2, 3, 4, 5...)
- Move to slot (1, 2, 3, 4, 5...)
- (While holding a container) This pallet has (bananas, etc...)
- Where is the pallet of (bananas, etc...)?
- What is in the pallet at slot (1, 2, 3, 4, 5...)?
- Reset
Comments