Making a magic ball based on the Arduino Pro Mini

I watched some movie, one of the characters of which had a magic ball that answers questions. I then thought that it would be nice to do the same, but digital. I rummaged through my stock of electronic components and saw if I had what it took to assemble such a ball. In the days of the pandemic, I didn’t want to order something unless absolutely necessary. As a result, I found a three-axis accelerometer, a display for Nokia 5110, an Arduino Pro Mini board, and some other little things. That should have been enough for me and I set to work.

Making a magic ball based on the Arduino Pro Mini

Hardware part of the project

Here is a list of components that make up my project:

  • Arduino Pro Mini board.
  • Connector GX-12 (male).
  • Triaxial accelerometer MMA7660.
  • Display PCD8544 for Nokia 5110/3310.
  • Charger for lithium-polymer batteries TP4056.
  • Converter DD0505MD.
  • 14500 size lithium polymer battery.

Screen

The screen that I decided to use in this project has been with me for a long time. When I discovered it, I immediately wondered why I had not used it anywhere until now. I found a library to work with it, connected power to it. After that, I immediately found the answer to my question. The point was in its contrast and in the fact that additional components are needed for its operation. I found this library for working with the display and found out that a potentiometer can be connected to the analog pin. I decided to use the accelerometer to adjust the contrast of the display. Namely, if you go to the settings menu, then tilting the device to the left leads to a decrease in the corresponding value, and tilting to the right increases it. I added a button to the device, by clicking on which the current contrast settings are saved in EEPROM.

Accelerometer Controlled Menu

It seemed to me that navigating through the menu using the buttons is too boring. Therefore, I decided to try using a gyroscope to work with the menu. This scheme of interaction with the menu turned out to be very successful. For example, tilting the device to the left opens the contrast adjustment menu. As a result, this menu can be accessed even if the display contrast is very abnormal. I also used the accelerometer to select various applications I created. Here library that I used in this project.

Applications

At first I wanted to make something that could play the role of a magic ball. But then I decided that I could equip what I could with additional features provided by various applications. For example, I wrote a program that simulates a roll of a die that randomly generates a number from 1 to 6. Another program of mine was able to answer questions “Yes” and “No” to it. It helps to make decisions in difficult situations. Other applications can be added to my device.

Battery

The problem with my projects is that I always use non-removable lithium polymer batteries in them. And then, when these projects are forgotten for a while, something bad can happen to the batteries. This time I decided to do otherwise and make sure that the battery from the device, if necessary, could be removed. It, for example, can be useful in some new project. By that time, I had already designed the case for the battery, but I had to complete it by equipping it with a door. The first copies of the case turned out to be unreasonably complex and bulky. So I redesigned it. It may come in handy in my other projects as well.

Making a magic ball based on the Arduino Pro Mini
Battery case

I originally wanted to fix the case cover with a magnet, but I really don’t like to use all sorts of additional components where I can do without them. So I decided to make a lid on the latch. What I got at the beginning was not very well suited for XNUMXD printing. So I redid the lid. As a result, it managed to print well.

Making a magic ball based on the Arduino Pro Mini
Housing cover for battery

I was pleased with the result, but the use of such a battery compartment in my projects limits the possibilities for their design, since the compartment cover must be on the top of the device. I tried to embed the battery compartment into the body of the device so that the cover would come out on the side of the case, but nothing good came of it.

Making a magic ball based on the Arduino Pro Mini
Battery Case Printing

Making a magic ball based on the Arduino Pro Mini
The battery cover is located on the top of the device

Solving nutritional issues

I did not want to connect elements to the main board to power the device, as this would increase its size and increase the cost of the project. I thought that it would be ideal if I could integrate the TP4056 charger and DD0505MD converter that I already have into the project. So I wouldn't have to spend money on additional components.

Making a magic ball based on the Arduino Pro Mini
Resolving device power issues

I did it. The boards turned out to be where they should be, I connected them using soldering with short rigid wires, which made it possible to make the resulting design very compact. A similar design can be built into my other projects.

Making a magic ball based on the Arduino Pro Mini
The inner part of the case with a place for the elements that provide the device with power

Finalization of the project and the consequences of unsuccessful placement of components in the case

In the course of working on the project, one trouble happened to him. I, after everything was assembled, dropped the device on the floor. After that, the display stopped working. At first I thought it was the display. So I reconnected it, but that didn't fix anything. The problem with this project was poor component placement. Namely, I mounted the display above the Arduino to save space. In order to get to the Arduino, I had to unsolder the display. But soldering the display did not solve the problem. In this project, I used a new Arduino board. I have another board like this that I use to experiment with a breadboard. When I connected the screen to it, everything worked. I, since I used surface mount, had to unsolder the pins from this board. Pulling the pins out of the board, I made a short circuit by connecting the VCC and GND pins. The only thing left for me was to order a new board. But I didn't have time for that. Then I decided to take the chip from the board on which the short circuit happened, and rearrange it to the "dead" board. I solved this problem using a hot air soldering station. To my surprise, everything worked. I just needed to use the pin that resets the board.

Making a magic ball based on the Arduino Pro Mini
Chip removed board

Normally, I wouldn't go to such extremes. But my Arduino board was only a week old. That's why I went for this experiment. Perhaps the pandemic has made me more experimental and more inventive.

Lanyard attachment

I equip my projects with lace attachments. After all, you never know in advance about when and where you will use them.

Results


Here's what it looks like working with the resulting magic ball.

Here you can find files for 3D printing of the case. Here you can look to see the code.

Do you use Arduino Pro Mini in your projects?

Making a magic ball based on the Arduino Pro Mini

Making a magic ball based on the Arduino Pro Mini

Source: habr.com

Add a comment