One Component Tutorial: How to Create a Lazy Susan with a DC Motor (2023)

Welcome to the robotic world of culinary comfort and superior convenience! Tired of straining your hands to move the dishes around the table? Are you tired of having your delicious food taken away to add bagels? Have you ever dreamed of a rotating device to do this job?

By the end of this tutorial, you'll learn how to connect the motor and motor controller to the Raspberry Pi, installroute serveron your Raspberry Pi and how to set up your robot in the Viam app to create your own Lazy Susan for your desktop.

You'll also learn how to take your creation a step further and adjust the controls of your Lazy Susan usingPython Engine API Method.



This project requires the following hardware:


You will also need the following tools:

  • philips screwdriver
  • Double-sided tape (optional but recommended)
  • wire cutters/scissors

hardware configuration

A brushed DC motor is a motor that converts electrical current into mechanical energy. In a brushed DC motor, the rotor rotates 180 degrees when an electrical current is applied. To travel beyond the initial 180 degrees, the poles of the electromagnet must be reversed. The carbon brushes come into contact with the stator as the rotor rotates, reversing the magnetic field and allowing the rotor to continuously rotate 360 ​​degrees. The brushed motor we use has high starting torque, which means it can get up to speed quickly, at low cost, and can handle a higher load - perfect for Lazy Susans!

A motor controller is a device that takes signals from your board and sends power to the motor based on those signals. Engine start programs allow you to start and stop the engine, select clockwise or counterclockwise rotation, and speed up or slow down.

Ajuntait is the hardware that sends digital signals to control your robot. Your board allows you to send a PWM (Pulse Width Modulation) signal to the motor controller to control the speed of the motor. PWM controls the speed of the motor by sending electrical current in pulses: the more often the pulses are sent in a given period of time, the faster the motor will move. The board sends PWM signals to the motor controller via GPIO (General Purpose Input/Output) pins, which are digital pins provided by the board to allow you flexible communication with various devices.

You will also use the board to implement the code, runroute serverand connect your robot to the Internet and the cloud.

Use the following diagram to connect the hardware. Make sure your board is turned off and unplugged before plugging it in!

One Component Tutorial: How to Create a Lazy Susan with a DC Motor (1)


The Raspberry Pi and the 12V power supply share the same GND on the L298N motor driver. The Raspberry Pi is powered by its own 5V power cable.

Power on the board when you are done with the wiring.

software installation

If you haven't already, follow usRaspberry Pi Setup Guideto prepare your Pi to connect your robot to the Viam app. Once your Pi is ready,sshon it from your computer.

In your web browser, go tothe viam appand create a new instance of the robot. Name your bot whatever you want and get goingTo placeOn your Pi, follow the steps there to download the Viam setup and download and install itroute server.Wait a moment for your robot to connect to the Viam app.

configure your robot

  • UI Builder
  • Raw JSON
  1. configure the board

    set yours up firstjuntacomponent. ContinueSettingon his robot page onthrough the app.Add a new component with the following attributes:

    • Do:local- you can name this whatever you want - remember that you will mention it later in your code.
    • Advice:junta
    • Model:Pi

    One Component Tutorial: How to Create a Lazy Susan with a DC Motor (2)

  2. configure the engine

    Then add a new engine component:

    • Do:dc motor
    • Advice:motor
    • Model:gpio

    One Component Tutorial: How to Create a Lazy Susan with a DC Motor (3)

    After creating the engine component, fill inrequired attributes for the gpio engine:

    • Forjunta, click the dropdown box and select local (or whatever name you gave your board!).

      One Component Tutorial: How to Create a Lazy Susan with a DC Motor (4)

    • Formax revolutions per minute, a nurse100.RPM stands for Revolutions Per Minute: It's roughly a measure of how fast a machine is running at any given time.100so that the motor moves at a moderate speed. You can adjust this later in our custom code.

    • Move the slider toa 1/a 2type of motor. The particular controller you are using expects this pinout.

      One Component Tutorial: How to Create a Lazy Susan with a DC Motor (5)

    • During the wiring, you connected the pins of the Pi to two ports called IN1 and IN2, and the third pin to ENA. when you turn ona 1/a 2engine type, the user interface opens three dropdown fields below. Use these to determine the pins on the board to which each motor driver pin connects:

      • A/En1: uso 16 GPIO 23
      • B/pulg2: uso 18 GPIO 24
      • PWM: use 22 GPIO 25 – This is the pin you connected the PWM (Pulse Width Modulation) jumper wire to. In the motor controller we used, it is labeled asThis.

      One Component Tutorial: How to Create a Lazy Susan with a DC Motor (6)

    • ForDepends onchooselocal. This ensures that the board is initialized before the engine.

      (Video) Make a MOTORIZED Spinning DISPLAY STAND

      One Component Tutorial: How to Create a Lazy Susan with a DC Motor (7)

Click onSave settingsbutton.

OfRaw JSON card, replace the config with the following JSON config for your board and engine:

{ "components": [ { "name": "local", "type": "board", "model": "pi", "attributes": {}, "depends on": [] }, { "name " :"dcmotor", "type": "motor", "model": "gpio", "attributes": { "pins": { "a": "16", "b": "18", "pwm " : "22" }, "board": "lokalno", "max_rpm": 100 }, "depends_on": [ "lokalno" ] } ]}

ClickSave settingsin the lower left corner of the screen.

(Video) How To Make Motorized Turntable

Test the engine in the Viam app

Go doControltab and click on topdc motorcard to open engine controls.

You can change the direction of motor rotation by changingForwardiBackwardbutton.

You can also adjust the speed of the motor by adjusting itforce %slider

hit himRUNbutton when ready and make sure your engine is running.

Adjust your settings and test drive your motor to find the perfect settings to suit your Lazy Susan prototype.

When you have finished testing the motor, pressARRESTbutton in the upper right corner to stop the motor.

Use the Python SDK to manage the engine

nuggetis a package management system written in Python and used to install and manage software packages and their dependencies during deployment.

sshon your Pi or use an existing onesshsession to installnuggetpackaging manager. Run the following command and type "yes" when asked if you want to continue:

sudo apt instalar python3-pip

HeI think of the python sdkallows writing programs in the Python programming language to control robots using Viam. To install the Python SDK on your Raspberry Pi, run the following command in your existing accountsshsession to your Pi:

pip3 install viam-sdk

installation withnuggetMake sure you are using the latest versionput-sdkand makes it easy to update in the future.

Ofthrough the app, selectExample of codetoken, setPitonas language and change secret to on.

One Component Tutorial: How to Create a Lazy Susan with a DC Motor (8)

(Video) How To Make DIY Lazy Susan using DC Motor || DIY Rotating Display Stand

Copy the code:

One Component Tutorial: How to Create a Lazy Susan with a DC Motor (9)

Create a new python file namedlijenisusan.pyon the Raspberry Pi and paste the copied code into it:


Press CTRL-X to save and exit.Entergramto confirm, then press return to accept the same file name.

Then run the following command to check the connection and see if there are any errors:

python3 converts to

The output should display a list of resources:

One Component Tutorial: How to Create a Lazy Susan with a DC Motor (10)

If there are no errors, you have successfully connected to your bot and run some code!

Using Engine API Methods

Now let's start writing the code to adjust your motor control. It would be nice if lazy Susan would spin around slowly so people could grab some food. Go to Engine API inPython SDK documentation.

set powerAdjust the speed by adjusting the motor power. This may look familiar to you when you have tested the hardware in the Viam app and adjusted it.force %iForwardiBackwardchange. Instead of using a switch to set the direction of the motor, it now uses positive or negative numbers up to 100.

Reference toAn example of the SetPower API methodfor more information.

Go forallows you to control how fast the engine spins by letting you set the revolutions per minute (or RPM). This gives you more control over speed and how long the motor revs up. If you want your motor to spin in reverse, one of these parameters (not both) must be negative.

If you have a project that needs to be below a certain speed, you can setmax revolutions per minutein the Viam app like we did during setup. An extra "0" in your API method can mean that you are collecting sunflower seeds from all corners of the room at midnight.

For the purposes of this guide, let's start withset powerand suppose we need Lazy Susan to work indefinitely.

Open itturnusan.pyfile withnanoinside your terminal.


You can start by adding this call to theset_snagedryprincipal functionabove the line that closes the connection of the robot withrobot.close():

#Use the power set method before closing the code loop, wait for dc_motor.set_power(power = 0.2)

Enter CTRL+X to save and exit: Press y when prompted to accept the changes and return to accept the original filename.

(Video) How to Make a Motorized Lazy Susan. Perfect for Shooting Video!

Now run your code:

python3 converts to

Your Lazy Susan should now spin at the speed you specified. Since we haven't set any parameters for how long this will last, we'll have to stop it using the button in the Viam na app.Controlcard for now.

However, there is also an API method that you can useArrest¡motor!

Add the following import statement at the top of your code:

# import time to add a sleep function in addition to the import time of your code

Then add the following code below the code that sets the motor power:

# Wait 10 seconds for the motor to spin for 10 seconds time.sleep(10)# Stop motorwait dc_motor.stop()

If you want to have the same effect but use even less code, you can useGoFor API method.Delete or comment out the code you just added and add the following code in its place:

# esperar dc_motor.set_power(power = 0.2)# time.sleep(10)# esperar dc_motor.stop()# Okrenite motor za 7.2 okretaja pri 60 RPM.await dc_motor.go_for(rpm=60, revolutions=7.2)

Enter CTRL+X to save and exit. Press Y when prompted to accept the changes and return to accept the original file name.

You have now successfully completed the code for your Lazy Susan and learned how to start your motor using the Viam app and using the code using the Python SDK.

Now you can go ahead and assemble your rotating robot. Attach a tree to your engine and decorate it however you like to make your Lazy Susan a hit at your next party!

Next steps

Your Lazy Susan project doesn't have to end here; here are some ideas for adding more components to this project:

  • Andinput regulator componentso you can turn and stop Lazy Susan using the gamepad.
  • Acamera componentI amachine learning modelthat recognizes your friends' faces and stops the Lazy Susan right where they can get to their favorite food, or snaps a picture of them as it spins, so everyone can have heartfelt memories.
  • Asensor component, so your Lazy Susan only spins when it detects movement around it.

Or you can go to ours.tutorialsand try one of our other guides to continue building robots.

Tell us how you are and don't stop showing your project in ourscommunity discord!

Was this page helpful

I'm glad to hear that! If there is anything we can do better, please do so.create a problem.

We're sorry about that. If you want to talk to us for help, joincommunity discord. To make sure we know what's wrong with this page, you can alsoopen the topic.

(Video) How to make a simple Display rotating Turntable with motor for video shooting


1. DIY Turntable at home | How to make turn table Homemade lazy susan | simple Turntable setup
(WA Electronics)
2. Build cheap portable motorized 360 photography turntable out of old printer parts - repurposed diy
(The Humming Beard)
3. DIY Motorized Powered Turntable Build: spray painting & product display platform
(Eric Strebel)
4. Awesome Display Turntable with only 3 components!
5. How to Make a RC Motorized Lazy Susan. Perfect for Shooting Video [ Bangla Tutorial ]
(Sakib Hasan)
6. Make A Simple Rotating Table "Lazy Susan"
(Jake's Workshop)


Top Articles
Latest Posts
Article information

Author: Neely Ledner

Last Updated: 05/08/2023

Views: 5603

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.