Plane with Arduino — Lesson 2

This course presents a step-by-step summary of using the Arduino SCADE library and Python wrapper with the Ansys SCADE Suite application and how to integrate the generated code on an Arduino board. This course is designed to help you build a system with the Ansys SCADE Suite application and Arduino.

 

Overview of the example

Let us look at the final circuit we want to build at the end of the course:

Image 3

The behavior we expect from our Arduino board is the following:

  • The joystick will interact with LEDs to simulate the direction of the plane: moving the joystick to the right will light up the right LED and to the left will light up the left LED.
  • The joystick will also interact with the digital screen to simulate the height of the plane: moving the joystick up or down will increase or decrease the altitude displayed on it.
  • The buttons will interact with the DC Motor. If we press the button on the left the DC Motor will start running. If the Motor is running, we can increase or decrease the speed with the left and right buttons. Also, the DC Motor will interact with the digital screen since we can’t increase or decrease the height if the Motor isn’t running.

To implement this, in our Ansys SCADE application model, we will have two operators.

First, an Architecture operator, which has no value in the eyes of Ansys SCADE application, but which defines the devices we will use in our circuit. This operator has no value because no code will be generated from it. It will just be used by the Arduino wrapper to know which devices are used. Ansys SCADE application is nonetheless very useful on this architecture, as it can be used to check whether all variable types are respected and whether we've forgotten any connections.

Next, we'll have an operator called Controller. This operator allows us to define the behavior of our model and the interactions of the devices on the Arduino board. For example, press a button, and an LED light up. The controller is very important because it allows us to simulate the behavior of our circuit directly in the Ansys SCADE application. So don't hesitate to use the simulation tools offered by the Ansys SCADE application before uploading the code to the Arduino board.

 

Prerequisite

Tool in focus

Ansys SCADE Suite application (Version 2023 R1)

Tools

Hardware in use

  • Target:
    • Arduino UNO

Components/Hardware needed

  • Arduino UNO
  • Devices:
    • 1x joystick shield with 3x Buttons
    • 2x Leds
    • 1x DC Motor
    • 1x H bridge
    • 1x Seven Segment Display
    • Cables
    • Resistors