Designer: Andres Garcia

Company: MetaMorph

Project File: Temperature Sensor

How I Used Layout Constraints to Line Up My LEDs

I'm using the Metamorphosys tools to design a temperature sensor circuit. The circuit should detect the ambient temperature, and light up different LEDs based on whether the temperature is below, near, or above room temperature. It was designed to light up all four LED’s when a warm hand is placed on the temperature sensor.

Using the tools, I modeled the circuit and ran SPICE simulations to verify that it behaved as I expected. Satisfied with the result, I used the PlaceAndRoute test bench to generate a PCB design.

Elephant in the Room

And that's where I first noticed the layout problem. The LEDs are shown with a bold black outline. I had intended the LEDs to be placed in a column where the lights would light up like a staircase with increasing temperature.

For most of the elements in my circuit, I don't really care where they are placed, as long as they are connected together correctly. So the test bench finds placements automatically for me. However, I want the LEDs to be in a specific order (blue, green, orange, and red), and lined up perfectly in a column so that as the temperature increases the LEDs will light up, no pun intended.

Teaching the Elephant New Tricks

To solve this problem, I used Layout Constraints.

I opened up my assembly and set my aspect view to PCB Layout. Then, I dragged in a RelativeLayoutConstraint icon and tried two different constraints. The Relative Layout Constraint works by setting one component as the “origin” and the other as the target. To set the origin, first select the component from which the relative constraint will be made, then connect it to the Relative Layout Constraint. Next, first select the Relative Layout Constraint and then connect it to the component on which the constraint will be applied. In the Object Inspector we can set both an X and Y offset.

First, I wanted to try my original plan of a column. So I set the distance between the LEDs in the object inspector, as can be seen below, and set up the same constraint for all four LEDs. This required a total of three constraints, one from the Blue to Green LEDs, then Green to orange LEDs, and finally the Orange to Red LEDs. Since I wanted to space them equally the same offset was used between all four LEDs.



Second, I wanted to try setting up the LEDs in a diamond pattern, mainly to experiment and pick between these two cases.  I used the same process as above to create the necessary constraints and then ran the PlaceAndRoute test bench to generate a PCB design for both cases.

Wrapping it Up

Below is an image for both layouts:

               Column Layout

               Column Layout

             Diamond Layout

             Diamond Layout

After looking at both layouts I chose to go with the column layout. Being able to try two different layouts quickly definitely made it an easy comparison.

Lessons Learned

  • As wonderful as Relative Layout Constraints are, if the board size is too small and the constraints are too rigid, the place and route test will fail due to a lack of a solution.

  • The Exact Layout Constraint can be used to provide even more control of the placement for individual components and rotation as well, something the Relative Layout Constraints do not support.

  • The place and route test will always fail if the board is too small therefore, I would recommend starting with a larger board size and shrinking after successful test benches.