We’ll be continuing from where we left off in Part 2 in making interesting electronic crafts using Arduino. Last time, we went from assembling the circuits to conducting accelerometer tests, but this time we will be focusing on making hardware from start to finish. This unique electronic kit will be introduced by Makoto Hirahara, an artist whose body of work focuses on the theme of relationships. Mr. Hirahara, an associate professor at Osaka University of Arts, has produced a lot of media art using computers and electronic devices. In recent years, he’s been turning his attention to making 3D works using natural materials such as wood and stone. That said, please enjoy the second and last part of “Digital Rearing Box Powered by Solar Panels Using Arduino.”
Step Breakdown
First off, we’ll start by assembling the exterior and installing the electronic parts. The procedure is as follows:
Step 1:Cutting Materials With a Laser
The material here is cut out with a laser processing machine. The exterior is 3mm thick basswood plywood. From the left: LED surface, solar panel surface, two side surfaces and LED base. The LED-based sculpture is for alignment when pasting the LED.
Although it is hard to see it in the upper right-hand side of the photo below, there is a 1mm thick translucent acrylic. It is used to help diffuse the light from the full-color serial LED tape.
Please download and use the data for extraction from the link below. Cut the red line and engrave the black line. When it is actually working, make sure to adjust the settings according to the laser machine you are using.
>> CutData.ai
Step 2:Assembing the Body
Apply woodworking bonds onto the two side edges, and paste the four pieces together with the LED and solar panels. Immediately after bonding, clamp and fix it into position. If you are worried about the strength of the bond, you can attach a small piece of wood to the corners you have stuck together for reinforcement.
Step3:LED Wiring and Installation
Separate 5 full-color serial LED strips. The middle of the electrode can be cut with a pair of pliers. Leave the jumper wires attached to the temporary wiring.
Affix the separated full-color serial LED tape along the alignment mark onto the base. At this time, be careful that the jumper wire attached via temporary wiring comes up to the upper left hand and that the direction of the electrodes is connected with a single stroke.
The separated electrodes of the full-color serial LED tapes are connected with a hard jumper wire. The distance between the electrodes was about 11mm on the inside, about 17mm in the middle, and about 23mm on the outside. The upper left-hand LED with the jumper wire is number 0 and the number increases in the order of connection, so the lower right LED number is 24.
In this state, let’s stab the jumper wire on the breadboard and check if it is disconnected. Change the value of NUPIXELS in the LED sample program ([Adafruit NeoPixel]> [Simple]) from 16 to 25, then finish. If all of the LEDs are lit green, there is no problem.
#define NUMPIXELS 16
↓
#define NUMPIXELS 25
Step 4:Installing the LED Base and Breadboard
Overlay the items in order from basswood plywood (LED surface) and acrylic board to LED base, and fix them into place with four screws. The jumper wires attached to the full-color serial LED tape should be routed from between the boards to the inside. Use a non-conductive washer (M2) for the spacer. Since the light diffusion will get bigger when it becomes thicker, adjust it to your liking by about 0.5mm to 1mm.
Attach the breadboard to the center of the LED base. The back of the breadboard also has double-sided tape, so peel off the release paper and attach it. Note that if you try to remove the breadboard once installed, the pin inside will come off. Insert the jumper wire attached to the full-color serial LED strip into the power, GND and six pins of the breadboard.
Step 5:Make Mount Parts for Solar Panel on a 3D Printer
The mount parts for affixing the solar panels are output with a 3D printer. Download the STL file from the link below and output it according to your 3D printer. Lamination settings are rough and fine. Please output two identical shapes.
First, attach one to the inside of the top of the solar panel with screws. The mount part output on the 3D printer has a 2mm hole that is not cut. Affix it while cutting with M2 pan-head screws.
Next, affix the lower mount part with screws while inserting the solar panel into the upper mount part.
Step 6:Hardware Complete!
Insert the solar panel DC plug into the DC jack on the breadboard, and the hardware should be complete.
After this, in order to write a sketch on the Arduino Pro Mini 328, remove the lower mount part and remove the solar panel.
Complete Procedure
Next, I’ll detail the whole procedure for the sketch below.
Enter in Library
We’ll be using the Neo Pixel and accelerator-LIS3DH library provided by Adafruit. In addition, we’ll be using a designated function in regular intervals called [MsTimer2]. Select [Sketch]> [Include Library]> [Manage Library] from the Arduino IDE menu to open the Library Manager. Enter [MsTimer2] in the search field and select from the displayed candidates for installation.
Manage LEDs on a Matrix
LED tapes are numbered consecutively from 0 to 24, but in order to make it easier to express the position of plants and animals, they can be expressed in vertical and horizontal coordinates. LED numbers are stored in a two-dimensional array.
… | |
int ledMatrix[WIDTH][HEIGHT];//2D array to record LED layout and number | |
… | |
ledMatrix[0][0] = 0;// 0 is、x=0, y=0 | |
ledMatrix[1][0] = 9;// 9 is、x=1, y=0 | |
ledMatrix[2][0] = 10;// 10 is、 x=2, y=0 | |
ledMatrix[3][0] = 19;// 19 is、 x=3, y=0 | |
ledMatrix[4][0] = 20;// 10 is、 x=4, y=0 | |
… |
view rawledMatrix.ino hosted with ❤ by GitHub
Growing Grass
Create a 5 x 5 two-dimensional array that preserves the growth of the grass and grows grass in random locations with each frame.
… | |
int grassMatrix[WIDTH][HEIGHT];//2D array that keeps grass growing | |
… | |
int rndX = random(WIDTH); | |
int rndY = random(HEIGHT); | |
grassMatrix[rndX][rndY] += random(GRASS_GROWTH_POTENTIAL + 1); //Grows grass at random locations | |
… |
view rawgrassMatrix.ino hosted with ❤ by GitHub
Creating the Animals
Define a structure to handle and gather up the parameters to hold the animals. The animal information is managed through this array of animal structures. The animal structure has a life/death flag that moves and forages if it is not dead. Next, move one animal toward the thickest growing grass. When you enter the grassy section, forage and set the grass growth level to 0 and add that portion into your animals’ physical strength. At the same time, every frame consumes a certain amount of physical strength, meaning if the physical strength reaches 0, the animal will die.
Increasing the Number of Animals
There are two ways to increase the number of animals. One is when the body is knocked out and a certain level of vibration is detected. A new animal of random color will appear in the middle of the screen.
The other is when your animal eats grass and their physical strength reaches its limit. Reduce your animals’ physical strength by half and increase the number of animals with the same color.
Overall Sketch
Great work! You made it! If you point the solar panel in the direction of the sun, I believe the light point will start moving. It sure does look like a creature when you see it move in search of food. So how did you feel about creating your very own original ecosystem by rewriting conditions for how the grass grew and the animals’ movements?
That just about wraps it up for this series. Going over two parts, we learned how to make a digital rearing box powered by solar panels using Arduino. I hope everyone can use this knowledge to craft something truly unique.