Bright Paths (Teaching MST)

by JosiahP4 in Circuits > Arduino

588 Views, 1 Favorites, 0 Comments

Bright Paths (Teaching MST)

IMG_20190221_181129726.jpg

The purpose of Bright Paths is to teach students about Minimum Spanning Trees (MSTs). Node A is the source and all of the other nodes have a certain weight (cost) to get to them. This teaching aid shows that cost by dimming each node, depending on the cost to that node. I plan on talking about the nodes as if they are stores that need deliveries and depending on the path that is taken, the cost of light (weight) will be too great. The result of this is an LED that is either dim or off depending again on the weight. Overall, a great way to simplify this problem for students. This problem is also known as the Traveling Salesman Problem.

Tools and Supplies

IMG_3722.JPG

Supplies

Tools

  • Hot Glue Gun to hold the LEDs
  • Art Supplies to draw the MST
  • Computer for programming

Drawing and LEDs for the MST

IMG_3723.JPG
IMG_3731.JPG
IMG_3724.JPG
IMG_3726.JPG
IMG_3728.JPG
  1. I printed out one from an old textbook of mine and poked holes, through the nodes on the print, on the foam core.
  2. I drew the edges with their respective weights on the foamcore also labeling the nodes A-H.
  3. I pushed the LEDs through the board (on top of the nodes) keeping the long pin facing up so I knew what pin to send the signal to later. Also, pushing the pins down to hold them in place.
  4. Hot glue the LEDs in place.
  5. Put the female to male wires on the LED pins. I did lighter colored wires on our high pins, or the ones facing up.

Breadboard

IMG_3729.JPG
IMG_20190221_103419358.jpg
IMG_20190221_103455684.jpg

Sparkfun has a great guide for the shift register and you can follow this for all of the wiring. The only difference is that the LEDs are wired in by the long jumper cables, not directly to the board. For my code, pin 0-7 on the shift register line up with A-H on the MST.

Code

received_2135503946759673.jpeg
IMG_3732.JPG

The code's purpose is to change the brightness of the LEDs based on the weights of nodes. In the picture to the right, it shows the wgtA through wgtH. These are the values that you can change in order to show the amount of weight on a certain LED. The change in brightness is achieved by:

sr.set(ledA, 255/wgtA*1.1) 

This line sets the led to the max brightness divided by weight times an amount to keep light visible. The brightness can then go down as the weight increases and this is done for every LED.

Problems and Future

IMG_20190221_181656916.jpg

I started off this project with four blue LEDs and four green LEDs but I ran into a problem when trying to compare brightnesses. I fixed this by finding four more blue ones but just keep this in mind when picking LEDs. I also need have to carry the Arduino, breadboard, and laptop separately so making an enclosure to hold the Arduino and breadboard would be a great future improvement. It would also be cool to add animations to the LEDs to help visualize what path is being taken. Overall, a great way to show how MSTs work and I look forward to using it more.