Introduction: Smart Violin Case

About: 19 years old ~ Student MCT at Howest (Kortrijk Belgium)

Music is an important part of my life. I have been playing the violin for 10 years, but there is 1 problem. I never know how long I practiced for. In my project I will keep track of the temperature, humidity and practise time. It's a stand alone project, but I also build a website that will show the temperature, humidity and practice time. In this instructables I will show you how I made the violin case.

So to summarize everything:

  • temperature and humidity are being tracked
  • the practiced time is being tracked
  • IP address is shown

I made this project with a Raspberry Pi, I programmed everything in Visual Studio Code. The case is also selfmade. I wrote a PDF with all the information. You can download it here.

Step 1: What Elektronics Do You Need?

first, what electronics do you need to make this yourself?

Basics:

  • Raspberry Pi 4
  • Raspberry Pi USB-C 3A
  • Micro SD-card (+/- 16GB)
  • Breadboard (2)
  • Breadboard power supply 9V
  • T-cobbler
  • 40 pin extension board adapter

Sensors:

  • DHT11
  • Push button (x3)

Actuator:

  • Electromagnet ZYE1-P20/15

Other:

  • LCD display 1602A
  • Resistor 220 Ohm (x3)
  • Male-to-male cables
  • Male-to-female cables

Step 2: Fritzing Scheme

I made two frizting schemes. The first scheme is how I switched it and the second one is the layout on the breadboard. You can download the PDFs to zoom in.

I soldered all the buttons. Do not forget to place a 220 Ohm resistor with each button. This is for safety reasons if you switch it wrong. I attached the LCD display to the breadboard with male-to-female and male-to-male cables. The potentiometer is switched on the breadboard.

Step 3: What Tools Do You Need?

I used a lot of different tools to build the case. I have listed them all for you.

  • Screwdriver
  • Drill
  • Milling machine
  • Wood glue
  • Square tool
  • Hammer
  • Screw clamp
  • Cyllinder dirll
  • Jigsaw

Of course you can't use tools if you have nothing to attach your case with. That's why I have listed all components.

  • Screws
  • Ducktape
  • Tape
  • Piano hinge (100 cm)
  • Wood (dimensions step 4)
  • Gas spring 50N/5kg 250mm
  • Fastener toggle latch (2x)

Step 4: Product Development

You need a couple of different sizes of wood. The thickness of the wood is 1.8 cm.

Outside of the case

  • Back face = 98,6 x 16,0 x 1, 8 cm
  • Front face = 98,6 x 16, 0 x 1,5 cm
  • Down face = 95,0 x 34,0 x 1,8
  • Up face = 98,6 x 37,8 x 1,8
  • Left Face = 16,0 x 34,0 x 1,8 cm
  • Right face = 16,0 x 34,0 x 1,8 cm

Inside of the case

  • Up face = 20,0 x 34,0 cm
  • Left face = 11,0 x 34,0 cm
  • Grid = 34,0 x 2.5 cm
  • magnet wood = 8,0 x 4,. cm
  • Support blocks = 8,0 x 4,0 cm

I also cut out the shape of my violin from isomo so that it stays in place in the box.

  • Isomo = 71,0 x 34,0 cm
  • wood = 71,0 x 34,0 cm

I will explain step by step how I put the case together.

Step 1

Connect the front and back face with the down face. I used 13 screws and wood glue. Then I attached the sides with 4 screws and wood glue. Drill a hole for wiring the electronics in the left side.

Step 2

The back is 98.6 cm long. I also cutthe piano hinge that long; so I can attach it full length at the back inside. First I attached it to top of the back face. To attach it to the lid, it's best to ask someone for help. You proceed in the same way as the previous one.

Step 3

Attach the fastener toggle latches. Choose where you place them. I placed them 20 cm from the edge. Both left and right. They should be easy to attach. Then the outside of the suitcase is finished.

Step 4

I had to be able to put the electronics somewhere. I signed off everything on the top plank. Then I milled everything out. It's a precise job, but it gives the best result. The magnet was a problem, but I solved it by placing an extra wooden block where the magnet should be. With a cylinder drill of 20 you can make a hole in the wooden block. The magnet will fit exactly.

Attach the side and top by screwing them together and don't forget to put wood glue in between. The component plank will not fit because the gas spring is in the way. Somehow I needed ventilation. I attached a grid of 34,0 x 2,5 cm on the left to the top plank.I still had to reach my RPi for another project, so I didn't screw it down to the outside of the case. I made two support blocks on which the inner shelves can lie.

Hang the two support blocks where the font face starts. So the side closest to the bottom. At the top is a photo to make it clearer. Now you can put the elektronics and the compartment in there.

Step 5

Now the violin case is almost finished. A place has yet to be made for the violin. Place your violin on the wooden plank and draw it over. I did not copy the piece for the neck. This way the violin gets some support. Once you have drawn it, you can now cut out the shape with a jigsaw.

After I cut it out, Iplaced the wood on the isomo and trace the shape. THen I cut out the violin shape with a utility knife. If you want, you can paint the wooden plank. I worked with black graffiti. Be careful not to use this on the isomo, it will absorb the paint! When its dry, you can put everything in de case.

Step 5: Normalized Database Structure

I made my normalized database in MySQL Workbench.

tblDevice:

  • deviceId
  • topic
  • unit
  • type

tblMeting:

  • number
  • code
  • deviceId
  • startDate
  • endDate
  • measuredValue
  • practiseTime

blActie:

  • code
  • description

Step 6: Setting Up Raspberry Pi

In the pdf version of this instructable I wrote step by step how to set the RPi. There are links to all the programs you need. The correct commands for the RPi are also included.

When you have completed all the steps, you should be able to establish an SSH connection to your RPi.

Step 7: Code on Github

In the previous step you created a workspace with a folder for the frontend and a folder for the backend. They come in handy now. I wrote my backend code with python and my frontend consists of html, CSS and Javascript.

Link to the code on Github: https://github.com/DeMeyerHanne/SmartViolin

Backend

config.py

I start with the config.py file. This contains the information of your database. The hostname and password are the same as your login on MySQL. At database you put the name of your database.

projectDataRepository

In projectDataRepository I can perform all CRUD actions. CRUD stands for Create, Read, Update and Delete. I retrieve data from the database, I can update it or add new data. If necessary I can also do a delete, but I don't use that in this project. I request data for the graphs and the last measurement. I also have 3 inserts to add the data coming from the sensors.

app.py

In this file I put the code to get data to my database, my electronics code and also the code to get things to my frontend or to receive things from the frontend.

At the bottom of the code I do everything. If you get errors from GPIO, take a look at the pins you used for your buttons, LCD ...

Frontend

app.js

The graphs for the site are created here. Connections are made to the backend, but things also come from the backend to the frontend.

index.html

This file contains all information for the website. Also links to the Javascript file.

screen.css

This is where the layout of the website is done.