FINAL CODE

 This page is part of my Model Remodel series of articles.

DISCLAIMER: If you choose to attempt any of these modifications, you assume all risks thereof. I just wanted to share my experiences here. Neither Fanhome, nor myself, are responsible for any damages that may occur. Also, due to the multiple ways these sketches can be implemented, I am not able to provide support to other builders if they do not work on your model.


This is it! After more than two years of planning, coding, testing, troubleshooting, and testing some more, I feel I have reached the point in writing the Arduino sketches where we can call them done. I thought I was done a few months ago, then got the wild idea that I would ‘animate’ the demo sequence to turn on the lights in time with the theme music. If I don’t install/release it now, I’m afraid I will just keep tinkering with it.

I am not a professional programmer, but I did what I could to make it clean, small, and well documented. Since we have reached the point where we need to close up our Battle Section in Stage 102, it is simply time to get it out there so we can finish the model.

NOTE: I share this code freely and give my permission to others who would like to improve on it, add more functionality, whatever you think of. However, If you do modify and release it as a new sketch, I would appreciate a quick mention!

Saucer Section

The code (sketch) for the Saucer Section is fairly basic. It simply listens for commands via the HC-05 Bluetooth (BT) module and processes them. These commands are sent by the paired HC-05 in the Battle Section (see my Bluetooth page for details). It is also responsible for playing any of the audio files stored on the DFPlayer Mini SD Card and controlling the volume of these sounds.

Battle Section

The code (sketch) for the Battle Section does the majority of the work and is the ‘brain’ of the model. It contains the operational logic and listens for three inputs: a change in state of the magnetic reed ‘separation’ switch, commands received by the Infrared (IR) receiver, and commands received by the HM-10 Bluetooth Low Energy (BLE) module. I consider the BLE to be the primary input method controlled by my Mobile App. As a backup, I left the IR section in place just in case the app stops working, is no longer supported, or others cannot use it.

A whole pile of variables store various light states, event states, and timing values. These are needed to control the different functions and keep track of what the program is doing. It is also responsible for sending commands to the Saucer Section via the HC-05 module and sending a quick update message to the saucer every 1 second to keep everything in sync (even after a saucer separation).

In Conclusion

When I started my Model Remodel adventure, I never expected others would want to follow the same path. I am honored to see that there are many builders who share my love of the Enterprise D and want to try and make it the best model we can. I have attempted to document my journey here as best I could and share the knowledge I learned along the way. I appreciate every one of my visitors – the feedback I have received has helped to steer the direction of this build and all the modifications. I could not have done it without you all, thank you!

This page marks the completion of the Arduino section of my site.