IM Star Constellation database

Concept

I have always been wondering about the name behind The Big Dipper and The Little Dipper and why we still use these names even after thousands of years. Given the infinite number of stars in the sky, we should be able to make infinite star constellations. So I was interested in seeing how many different constellations people would draw in 2 hours in the same set of  120 stars. The number of stars was chosen based on the aesthetics of the “sky” design and the chance of two stars clashing with each other. Overall, I obtained 43 different star constellations from 43 different people.

Google Drive folder with all constellations (for confidentiality purposes, the image names are in ascending order and does not reveal person’s netID. Two constellations have been deleted upon request from the authors): here

For this, I used 2 screens and two sketches. One showed the loop of previously made star constellations that would automatically add the new constellations, so that the showcase visitors would be able to see the status of the database and get inspired for their own constellation. The other screen was used to draw a new constellation to be added to database. So both sketches were running simultaneously.

I also made a controller, which was a laser-cut 15x10x5 cm acrylic box with a joystick (to be used as a mouse with 4 directions) and three buttons (SELECT, START, FINISH). The image is available below. The controller resembled a simplified version of a PlayStation controller, which I noticed as people found it to be more convenient to hold in hands than keep on the table.

Materials

For the box, I wanted to have black acrylic because the screens were dark blue or black, and I did not want to distract the audience from the project with a random acrylic color.

I used the so-called thumb joystick, because the box was relatively small and lightweight, and a bigger joystick did not make sense for this project. I chose momentary pushbuttons rather than maintained switches because I wanted them to work as the buttons audience would be used to. I considered using a toggle switch to start and finish the game, but decided that it might confuse the audience and they would have thought it would switch the controller on or off.

I might have instead chosen a different layout of the buttons on the controller, based on the reviews during the showcase. One person suggested that the Select button could have been on the right-side bottom and Start and Finish buttons on right-side top. Some people actually liked the layout and said that after getting used to it, it was very easy to use.

To improve the joystick function, I would add the diagonal directions as well, where both X and Y values of the cursor changed. However, this was a minor issue and only one person expressed their concern about it, others seemed to accept it and navigate well with only 4 directions.

Learning for the project

  1. Classes – I did not fully understand classes, arrays and objects until I worked on my final project, where both, Stars and Lines were classes, but their functions were a little different. While there were 120 stars from the very beginning and were not supposed to change, lines as objects were added to the array only when the two stars were selected. Initially, I had drawn invisible lines between each star with each star (so a fractal of the stars on the screen), which would then appear if the two stars were selected. This worked fine when I had up to 40 stars, but when I tried to increase the number to 120 stars, the program was so slow that I realized that something was wrong and there must be a better way to go about it. Fortunately, James patiently went over the idea behind arrays and objects until it made sense to me and I could implement it into my code.
  2. Creating the database and the difference between save() and saveFrame(): 
    to save the stars in the database with the person’s netID and also show them on the screen, I saved each constellation in two files: one under the data folder for the second sketch (which looped through existing images), and one under the sketch folder to save each person’s netID. For the names of images under second sketch, I used the same principle as the example of moving images used in class. 
  3. Start screen without restarting the program: the main idea was to maintain the same set of stars in the same position, but I had to add a Start screen with instructions for the next user. So figuring out the code took me a while to ensure that it would save the image (without the cursor, but with the stars and lines) when the person is finished, then deleting the array of lines and showing them the Start screen again. This was mainly done through trial and error and previous experience with making the ping pong game.
  4. INPUT_PULLUP: since the buttons I used only had two wires, I didn’t need a resistor, but had to learn the logic behind Input Pullup Serial. For this, I used the official tutorial on Arduino website. The idea is that the button sends a HIGH value, when it is not pressed, so I had to change the code to writing a value in the string, when the button’s value was LOW.
  5. Using the joystick: this was a great learning tool, because I had to solder (something I was scared to do for the whole semester), drill, and learn how to use the tutorial code to adapt it to my project.

Software

Once my code was done, I realized that it actually covers most of the topics we covered in class about Processing and Arduino. I use drawing shapes, random function, classes, arrays, images (loading and saving), communication between Arduino and Processing, this time putting it all together and polishing my knowledge.

The codes are attached below, at the end of the post for two Processing sketches and Arduino.

Hardware

As mentioned before, I used a wireless keyboard, 2 screens and a controller with a joystick and 3 buttons. The screens and keyboard were attached to a Macbook Pro computer that ran the Processing, but for the purposes of the project, the audience only saw the screens and the keyboard to avoid distraction.

The schematic of the Arduino controller is attached below.

3 most difficult parts

  1. Figuring out how to use ArrayList() for storing the lines. Initially, the program connected all the stars with each other and then, as two stars were selected, the line would appear. Unfortunately, when another two stars were selected, the previous line would disappear. I initially set the background only in the setup, so it seemed to work, but the problems arose when I added the cursor because it would show the previous positions of the cursor too. So then I had to learn about arrays and change the logic behind the Lines and add them manually. As mentioned before, this change also increased the speed of the program.
  2. I know a lot people love soldering, but for me it was one of the most difficult parts and I spent a long time working on soldering the buttons and joystick. On the bright side, I now feel much more confident in it.
  3. The logistics of the start and finish of the game, together with restart. The start screen hid the stars and lines, and showed the instructions and text box. The lines had to disappear when the game was started, instead of finished, but when it was finished, the cursor had to disappear and lines and stars had to remain on the screen. This logic seemed very easy at first, but I realised that making it work in Processing was not so intuitive. Fortunately, Miha and Nick from another class convinced me to keep the Restart option, because it saved some participants in the Showcase when the constellation didn’t work out the way they wanted, so they could start again. To make it all work in the right order, it required a lot of trial and error and double checking that it all works.

What would I do differently?

I would improve controller and make it more intuitive or move it back to just computer and Processing, without the Arduino. In the start screen, I would have added a gif that shows how to navigate the spaceship cursor with the joystick and make the lines, rather than just the instructions, because people don’t really have time to read through instructions at a showcase (though I tried to keep them as short as possible).

As mentioned above, I would have added cursor directions in diagonals (up-right, up-left, down-right, down-left) to improve the navigation around the screen.

A potential improvement for a similar project in the future, I would like to use an actual set of stars seen in the sky, rather than a random set of stars and make it look more realistic. Then again, even with the current code, I achieved the goal of this project – to show the different constellations people can draw in the same sky.

Processing code

Stars:

 

Database:

Arduino:

Cursor image:

Leave a Reply

Your email address will not be published. Required fields are marked *