How to Interface a DC Motor with PictoBlox

Controlling DC Motor in PictoBlox
About This Tutorial
This tutorial discusses what are DC motors, how to control them, and how to interface them with PictoBlox using evive.
Tutorial Info

Components Required

ImageComponentQuantityAvailable in Kit
USB A-B Cable1
Dual Shaft BO Motor1


A Direct current (DC) motor, as the name suggests, takes in direct current from one end and uses it to rotate the axle/rod at its other end; we can then connect some other machine to the axle/rod that works when it rotates.

We can control a DC motor in terms of its:

  1. Direction: We can control the direction of rotation of the motor by reversing the direction of current that flows into it.
  2. Speed: We can control the voltage of the motor by varying the supply voltage.

evive has two inbuilt motor control units with which you can control motors with the current limit of 1A each. It uses a SN754410NE Quad H-Bridge IC to control two DC Motors.

evive motor channel


If you look at the SN754410NE chip, you will notice a u-shaped notch at one end.  This helps you identify pin 1.

Pin diagram of SN754410NE IC

Pin 4, 5, 12, 13 are connected to ground.

Pin 16 is connected to 5V and pin 8 is connected to power voltage which can vary from 4.5V to 30V.

1A and 2A are connected to Arduino Mega Digital pin 28 and 29 respectively and 3A and 4A to digital pin 30 and 31. You can determine the state of the motor by looking at the states of the pins:

Pin 30Pin 31State
LOWLOWMotor is free
LOWHIGHMotor rotates in one direction
HIGHLOWMotor rotates in another direction
Motor is stalled

Interfacing a DC Motor with PictoBlox

For interfacing the DC motor with PictoBlox, you must first connect the motor to one of evive’s motor channels as shown in the figure below:

DC Motor Control Fritzing Cirrcuit Diagram

You can control the motor using evive in two ways:

  • By using evive’s inbuilt menu
  • By writing a script in PictoBlox

You can control a DC motor in PictoBloxwith the help of the following blocks:

  • run motor () in direction () with speed ()%: This block controls the speed of the specified motor in the specified direction.Run motor
  • () motor (): This block allows you to halt/lock or free the motor.Free or lock motor

You can find these blocks in the Actuators palette.

Activity: Controlling a DC Motor’s Direction Using Slide Switch

evive Notes Icon
When working with evive on PictoBlox for the very first time, or if you’ve previously uploaded another code to evive, you must upload the firmware in order to upload new code to it. You can find the procedure for the same HERE.

Follow the steps below to write the script:

  1. Connect evive to your computer and open PictoBlox; if already open and working on a project, save that project. Then, click on New.
  2. Go to the toolbar and click on the Board menu. Then select evive as your board. Pictoblox Board Selection
  3. Next, click on the Connect menu and from the fly-out menu, select the Port to which evive is connected e.g. COMXX or ttyXX.Once you select the port, the icon beside the Connect tab will become connected.Connect-Disconnect Icon
  4. Go to the Events palette and drag and drop the when flag clicked block.
  5. Next, go to the Controls palette and drag and attach the forever block below the when flag clicked block.
  6. From the same palette, drag and drop the if-else block inside the forever block.
  7. Go to the evive palette and drag and drop the slide switch () is in state () block inside the diamond-shaped space of the if-else block; slide switch 1 and the UP state are set as default.Slide Switch Drag and Drop
  8. Next, drag and drop the run motor () in direction () with speed ()% block from Actuators palette below the if arm of the if-else block; set motor as 1, direction as forward, and speed as 100% from their respective drop-down menus.
  9. Below the else arm, drag and drop another if-else block from the Control palette.
  10. Repeat step 6, but this time, set DOWN as the state.Slide Switch Reverse Direction
  11. Repeat step 7, but this time, set direction as reverse.
  12. Drag and drop the () motor () block below the else arm of the second if-else block; select lock from the first drop-down menu and set the motor as 1.

Below is the complete script:

Controlling DC Motor in PictoBlox

Click on the green flag to run the script. 

Click on the red octagon, next to the green flag to stop the script.


It this tutorial, you learned how to interface a DC motor with PictoBlox.

Hope you had fun! 🙂

Share this Tutorial
Share on facebook
Share on twitter
Share on google
Share on pinterest
Share on reddit
Share on print
Related Projects & Tutorials
evive – Plug and Play: Part 1
In this tutorial, we are going to give you a hands-on experience of evive’s plug and play interface through activities for controlling a DC motor, a servo motor, understanding the inbuilt touch sensors of evive.
PictoBlox – Stage Mode
In this tutorial, you learned about PictoBlox's Stage mode and how to control hardware in real-time using a USB cable or over Bluetooth. 
PictoBlox – Upload Mode
In this tutorial, you'll see what is PictoBlox's Upload mode and how to use it to control our hardware wirelessly, i.e. without being connected to computer.
All articles loaded
No more articles to load
Featured Projects
IR sensor Tutorial
What is an IR (Infrared) Sensor?
This tutorial discusses what are DC motors, how to control them, and how to interface them with PictoBlox using evive.
All articles loaded
No more articles to load

Leave a Reply

Close Menu


Get an extra 10% OFF + FREE shipping worldwide on orders above $100.