element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs How I started programming Arduino with Simulink..
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: anujaapte
  • Date Created: 23 Nov 2013 3:45 PM Date Created
  • Views 353 views
  • Likes 0 likes
  • Comments 0 comments
  • robots
  • control
  • motor_drive_and_control
  • motor
  • arduino
  • simulink
Related
Recommended

How I started programming Arduino with Simulink..

anujaapte
anujaapte
23 Nov 2013

Over last few months I have had a lot of fun working on Arduino projects using Simulink. Honestly, I was a bit apprehensive when I started on my first Arduino project. An engineer turned marketer, I had not worked with hardware in over a decade. I have zero background in embedded programming. But I love MATLAB and Simulink, and wanted to see how far I can go with that knowledge. In this blog post, I want to share how within few days, I was able to program an Arduino using Simulink to drive an object-tracking camera mounted on a servo.

 

It took 3 simple steps:

1. Program Arduino Uno using a simple Simulink model to blink an LED

2. Build a Simulink model that can track a ball using a basic webcam and library blocks

3. Program Arduino Uno using Simulink to drive the servo that has the webcam mounted on it

 

Here's a video of the project

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

and here's how I got there...

Hello World! aka Blink an LED

Here's a short video of steps involved in Programming Arduino Uno with Simulink

Hardware: Arduino Uno, 220Ω resistor, an LED, connecting wires

Software: MATLAB & Simulink R2013b installed with the Simulink support package for Arduino

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Detect a ball using Simulink

The next step was to build a model in Simulink that detects a round object. I used the Blob Analysis block from Computer Vision System Toolbox to build a simple model. Using a basic webcam I tested the model in Simulink. There are several example models on the MATLAB Central File Exchange community website that you can download and tweak as you like.

 

Compute Servo Angle to track the ball

The blob detection model provides current coordinates of the ball in a given frame from the webcam. I wrote MATLAB code to compute the servo angle necessary to keep the ball in the center of the frame. This servo angle was then sent to the Arduino to control the servo.


What next?

Excited by my success in a short amount of time, I now intend to use Simulink models to program an Arduino-based line-following robot such as:

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube