Flowcode 7 and DesignSpark Mechanical – electromechanical simulation made easyFollow article
Computer based simulation of microcontroller systems is a powerful tool; it offers users the ability to simulate designs before the implementation of hardware. This is a benefit both in the learning environment where cost of hardware can prohibit learning, and in rapid prototyping where speed of development is essential.
5 Reasons to use Flowcode 7.
Simulation of electronic components, such as LEDs and switches, has been a feature available in Flowcode for many years. However, performing simulations for electro-mechanical components and systems has been more difficult to achieve and was not well suited to a 2D design environment. Three years ago, when we launched Flowcode 6, we introduced a 3D design environment which offered the ability to simulate more complex electro-mechanical systems. The use of 3D allows the improved simulation of components such as stepper motors, servo motors, switches, linear actuators, solenoid valves and many more. When these components are grouped together, this allows complex 3D systems such as XY plotters, wind turbines or robotic arms to be simulated before the requirement of introducing hardware. Many simulators only allow for pre-determined simulation scenarios, where users are locked into what the developers make. With Flowcode we want engineers of all levels to be able to create their own designs at a systems level.
With the launch of Flowcode 7 we have now taken the handling and importing of 3D objects in the simulator to an enhanced level. When performing 3D mechanical design there are, broadly speaking, two major file types; parts and assemblies. A part is just that, a single entity designed in the 3D world. It will contain the mechanical dimensions of the object, alongside optional properties such as the material. An assembly is a collection of these individual parts, combined together to make a full system. In 3D drawing packages users implement specific tools to configure the placement of objects in relation to one another. In Flowcode 6 users had to manually import individual parts from the design package and manually move them around the simulation panel until they were aligned correctly. For complex systems this was a laborious task. In Flowcode 7 we have now introduced the ability to import assemblies. Users can now import a full 3D system which will retain the placement of objects in relation to one another. Once imported, users can then either combine multiple objects into a group, or move individual parts, depending on preference.
In this blog article we will introduce the importing of a basic switch assembly into Flowcode, and demonstrate making a 3D system from this switch. While Flowcode does include basic 3D drawing tools, it is advised that for complex systems dedicated 3D design packages are used. DesignSpark Mechanical is one such package, and one that is fully supported in Flowcode. With DesignSpark Mechanical, users have access to both free software, and over 80,000 3D models available from RS Components. This allows users to import premade electro-mechanical components into their designs.
For this article we will demonstrate the ability to import assemblies with a simple switch component. Although this is a small individual component, the principles can be scaled up to importing and characterising larger 3D systems, such as those previously mentioned. For a more detailed guide on importing 3D assemblies into Flowcode 7, click here.
The switch selected for this article is found on the RS website as part number; 103-6252. The CAD files were downloaded and opened in DesignSpark Mechanical as seen below. Here we can see that this particular assembly comprises six individual parts.
The next step is to save the assembly as a Flowcode compatible file type. Flowcode supports four file types;
4) STL (note; the STL file format does not natively support assemblies)
DesignSpark Mechanical supports .OBJ file types, so this is the file type we will use. Navigate to File->Save As and save the switch component as an OBJ file type. We are now ready to import the switch into Flowcode.
Note; in this case we actually manually renamed the six parts within DesignSpark Mechanical as they were called Unnamed01, 02 etc. We manually renamed them with meaningful names to simplify the process of characterisation after the Flowcode import.
Launch Flowcode and create a new project. Ensure the 3D System Panel is switched on so you can see the switch assembly once it is imported. Navigate to File-> Import Object and locate the .OBJ file for the switch. Flowcode will then open the following dialogue box. For this design we will simply keep the default options selected.
During the import process Flowcode will convert the .OBJ file into its native file format, a .MESH file, and as such will require a save location. If you are importing an assembly, as we are here, Flowcode will create six .MESH files. Once imported you will see the switch component in Flowcode, as seen below. You can select individual objects and move them around the system panel, if you wish. We wouldn’t recommend that just yet, as the switch parts are positioned correctly in relation to each other!
For our switch component we must now characterise our 3D system. For a simple switch, we want to be able to press the plunger and activate the switch. So, for this example the moving part is the plunger and the remaining five parts all stay stationary, relative to each other. When you import an assembly into Flowcode it is automatically grouped together. First, we ungroup these by selecting the switch and clicking the icon below;
Left - ungroup; Right - group.
We then created a new group, which included only the five stationary objects of the body. To create a group drag a box around the objects you want, and press the group icon (as seen above). Note, if you want to remove any objects that have been highlighted, hold the SHIFT key and left click on that object.
To make our 3D assembly into a functioning switch we must utilise a ‘Switch Template’ component within Flowcode. This allows us to create a working switch, from our imported assembly. The Switch Template component can be found from the Search toolbar, as seen in the image below, and is added to the simulation panel.
Once the Switch Template is added users should configure it as below. The main properties we are interested in are under the Simulation category, and are; Moving Part, Type, Operation, Axis and Movement. We have configured our switch as seen in these properties.
Finally, we can create a simple flowchart to allow us to test our switch operation. Below is seen a sample flowchart that allows us to do this. Here, we simply read the state of the switch, if it is pressed we illuminate the LED and vice versa.
And here we can see the simulation confirming that the plunger moves, and also the switch works as expected.
While this is only a simple example, in which we have created a switch, hopefully you can see how this can be scaled up to create more complex 3D electromechanical systems. Below is a selection of screenshots of what is possible in Flowcode. Click here to check out a guide on importing 3D assemblies in Flowcode 7.
If you have any questions please feel free to comment, or if you would like to try a free version of Flowcode 7 which works in simulation, click here. Flowcode 7 comes in standard and professional licence types and is available to purchase now from RS Online. Click here to find out more.