Running Mouse

by RonSoldeert in Circuits > Arduino

777 Views, 6 Favorites, 0 Comments

Running Mouse

signal-2023-05-21-131013.jpeg
kut instructables.gif
schets 2.png
schets 1.png
signal-2023-05-18-150649_002.jpg

This project was undertaken as part of a school assignment where I had to design an Arduino project within a 10-week timeframe, with the objective of creating a device that encompassed both input and output functionality. The result was the "Running Mouse," an innovative concept that powers its wheels and scurries away whenever you click the mouse all powered by two 9 volt battery's. Originally, I envisioned a teacup holder that would drive away when the cup got too cold, but due to the impracticality of constantly waiting for the cup to cool down for testing, I transformed the idea into a running computer mouse. Through this project, I gained valuable insights into power management, soldering techniques, and how to 3D print.

Downloads

Supplies

needs.png

Components:

  • 1x Arduino Uno
  • 1x L293D DC Motor Driver Shield (Make sure your shield is compatible with Arduino Uno and designed for motor control)
  • 1x Mini Soldering Board
  • 3x Non-hardcore Wires (1x Green wire, 1x Red wire, 1x Black wire)
  • (Alternatively, you can use male-to-male wires and strip off the tips)
  • 1x 10kΩ Resistor (Useful resource: https://resistorcolorcodecalc.com/)
  • 1x Push Button
  • 2x 9V battery connectors
  • 2x 9V batteries
  • 2x DAGU Robot DG02S MINI DC GearBox
  • 2x Car Wheels
  • 1x Swivel castor PUR 35mm (Can be almost any swivel castor)
  • A computer mouse (to be used as the housing)
  • Standard PLA plastic for 3D printing

Tools:

  • 3D Printer
  • Glue Gun
  • Soldering Kit (including soldering iron, soldering acid, soldering wire)
  • Mini Drill (or alternative tool for creating holes, can also use soldering iron)
  • Screwdriver
  • Wire Cutters
  • File
  • Portable USB adapter for a micro SD card (or a computer with a built-in micro SD card slot)

The Circuit

running mouse_bb.png
running mouse_schem.png
signal-2023-05-18-154819_002.jpg
signal-2023-05-18-150649_029.jpg
signal-2023-05-18-150649_028.jpg
signal-2023-05-18-151604_003.jpg
signal-2023-05-18-152914_002.jpg
signal-2023-05-18-154819_004.jpg
signal-2023-05-18-154819_003.jpg

Wiring all the wires to the shield:

  1. Place the Arduino Uno on a flat surface.
  2. Carefully align the shield on top of the Arduino Uno, ensuring that the pins on the shield align with the corresponding holes on the Arduino. Gently press the shield into place.
  3. Take one of the 9V adapters and insert the red wire into the +M slot of the shield. Insert the black wire into the GND slot of the shield.
  4. Insert the green wire into the 2-pin slot on the shield. Strip the end of the green wire and insert it into the slot on the underside of the shield.
  5. Apply a small amount of soldering acid to the connection point and use soldering wire to secure the wire in place.
  6. Solder a red wire to the 5V slot and a black wire to the ground slot next to the 5V slot.
  7. Take the second 9V adapter. Solder the black wire of the adapter to the right ground slot on the shield. Solder the red wire of the adapter to the 9V slot next to the right ground slot.
  8. The wiring order is as follows:
  • 5V slot: Red Wire
  • Ground Left slot: Black Wire
  • Ground Right slot: Black wire of the 9V adapter
  • 9V slot: Red wire of the 9V adapter

Wiring the Button Board:

  1. Cut the soldering board to a size of 5 holes in width and 9 holes in length. (The smaller the better).
  2. Place the button on the soldering board, positioning it on the 3rd hole from the first hole in length and the 3rd hole from the first hole in width. Refer to the pictures for better understanding.
  3. Take the red wire from the 5V slot and solder it to the right underpin of the button.
  4. Take the black wire from the left slot and solder it to the board, just below the left side of the button. Do not solder it to the button itself.
  5. Take the 10k ohm resistor and solder it from the black wire to the button. You can solder the resistor in the width to save space, but if you prefer, soldering it in the length is also acceptable.
  6. Lastly, take the green wire connected to pin 2 and solder it to the back side of where the black pin is connected to the button. It should resemble the connection shown in this diagram: https://docs.arduino.cc/built-in-examples/digital/Button.
  7. Refer to the pictures for further clarification

That's it! You have successfully wired the Arduino Shield and Button Board. You can now proceed with the next steps of this project.

3D Printing Your Parts

Model in 3d.PNG
Prepare slice.PNG
Prepare slice2.PNG
Prepare slice3.PNG
signal-2023-05-19-151830_002.jpg
signal-2023-05-19-152411_004.jpg
signal-2023-05-19-152411_003.jpg
signal-2023-05-19-152411_002.jpg
signal-2023-05-19-153129_002.jpeg

3D Printing the bottom part:

  1. Download the .stl file provided in this thread. I modeled the part myself using Blender and the MeasureIt add-on.
  2. Open the .stl file in a slicer program. I recommend using Cura, which you can download from this link: [Cura Download Link: Download Link Cura. Make sure you have the latest version of Cura installed if you choose to use it.
  3. In the slicer program, go to the "Prepare" tab and select your specific 3D printer model in the left corner. Also, choose the appropriate nozzle size and material type. For example, my printer is the Creality Ender 3 with a 0.4mm nozzle, and I used standard PLA material. It's essential to check and set these parameters because different materials have different heating/melting points, and the printer needs to be properly configured.
  4. Still in the "Prepare" tab on the right side, click on the settings to adjust support strength and other 3D printing parameters according to your preferences.
  5. Click the "Slice" button to start the slicing process. Allow the program to run and slice the model. You will be able to see the estimated print time and the amount of printing material required. In the "Preview" tab, you can visualize how the print will look. If necessary, you can go back to the previous step and adjust the print settings to reduce the printing time. Remember to slice again after making changes.
  6. After slicing, prepare a portable USB adapter for a micro SD card. If your computer has a built-in micro SD card slot, you can use that instead. Connect the adapter or insert the micro SD card into your computer.
  7. Save the sliced model as a .gcode file on the micro SD card by clicking "Save to Removable Drive" or a similar option in your slicer program.
  8. Safely eject the USB adapter or micro SD card from your computer and take it to your 3D printer.
  9. Turn on your 3D printer and select the option to print from the micro SD card.
  10. Locate and select the specific .gcode file you saved earlier, such as "CERERV2_RunningMouse.gcode."
  11. Begin the printing process and let it run for approximately 10 hours.
  12. Once the printing is complete, carefully remove any support structures that were printed along with the part.
  13. Make shure you download: "RunningMouse.stl", "RunningMouseCover.stl" and "RunningMouseBand.stl" and print these 3.

That's it! You've successfully printed the bottom part using your 3D printer and assembled the necessary components.

Glueing and Skrewing Bottom Part

signal-2023-05-19-161114_002.jpeg
signal-2023-05-18-150649_005.jpeg
signal-2023-05-18-150649_006.jpeg
signal-2023-05-18-150649_003.jpeg
signal-2023-05-18-150649_004.jpeg
signal-2023-05-19-163829_006.jpeg
signal-2023-05-19-163829_004.jpeg
signal-2023-05-19-163829_003.jpeg

Glueing parts and skrewing it togheter:

  1. Grab your 3D print and the glue gun. Apply glue to the underside of the swivel castor and press it firmly against the block-shaped underside of the 3D print.
  2. Glue the two car motors onto the higher part of the underside of the 3D print. Make sure they are positioned in the tiny blocks provided. Attach the wheels to the car motors.
  3. Using a soldering iron or a tiny drill, create two small holes on the underside of your 3D print. These holes will allow the wires from the two motors to pass through. Note: It is not recommended to use a soldering iron for this step, as it may melt the plastic. Alternatively, use a tiny drill for creating the holes.
  4. Take the wires from the motors and pass them through the holes created in the previous step.
  5. Get the Arduino and shield that you prepared in Step 1. Unscrew the holes labeled M1 and M3 on the shield. These correspond to motor 3 and motor 1. There are four motor slots in total, but these slots are the most suitable for this configuration.
  6. Connect the wires from the motors to the respective holes on the Arduino shield. Ensure that the screws are tightened securely to avoid any loose connections while driving the Running Mouse.
  7. Check if the Arduino fits properly into place, ensuring all the connections are intact.
  8. The large hole on the side is used to insert the two 9V batteries.
  9. Note: Refer to Step 1 for the full schematic of this circuit.


Code

code.PNG
signal-2023-05-19-180158_003.jpg
signal-2023-05-19-180158_002.jpeg

Getting the code on the arduino Uno:

  1. Begin by downloading the Arduino IDE from the official Arduino website. Visit their website at https://www.arduino.cc/en/software and follow the instructions to download the Arduino IDE for your operating system.
  2. Connect your Arduino Uno board to your computer using a USB cable. Ensure that the board is properly connected and powered.
  3. Launch the Arduino IDE on your computer once the installation is complete. The IDE provides an integrated development environment for programming and uploading code to your Arduino board.
  4. In the Arduino IDE, click on "File" and then select "Open". Search for the downloaded "RunningMouse.ino" file, which is downloadable in this thread. Open the file in the Arduino IDE.
  5. To enable the required functionality, you'll need to install the "Adafruit Motor Shield Library v1" from the library manager. Locate the library icon in the left sidebar of the Arduino IDE and click on it. In the library manager, search for "Adafruit Motor Shield Library v1" (not v2). Once found, click on the library and select the "Install" button. Wait for the library to finish installing.
  6. Now it's time to upload the code to your Arduino Uno board. Click on the blue arrow icon in the top-left corner of the Arduino IDE to compile and upload the code. The Arduino IDE will initiate the upload process and transfer the code to your board. Allow some time for the upload to complete.
  7. If you wish to customize the code, you have a couple of options. You can adjust the motor speed by locating the lines of code that define the speed, such as "M1.setSpeed(200);" and "M3.setSpeed(200);". Modify the numeric value to increase or decrease the speed as desired. Additionally, you can change the motor slot assignments by modifying lines like "AF_DCMotor M1(1);" and "AF_DCMotor M3(3);". Update the slot numbers based on your specific setup.
  8. Finally, it's important to understand how the code functions. The provided code reads input from a button and determines whether it was previously pressed. It then sets a corresponding value to indicate its state (on/off). This creates a switch-like behavior that allows you to turn the wheels on or off.

Congratulations! You have successfully completed the steps to download the Arduino IDE, connect your Arduino Uno board, and upload the provided code. You can now control motors using the Adafruit Motor Shield Library, and if desired, make customizations to suit your needs.

Downloads

Top and Finish

FIDX11RLHW03CZF.jpg
FSDNUUJLHW03DE6.jpg
FRYTEDFLHW03FNI.jpg
F22GY6QLHW03DSB.jpg
FXG8MCRLHW03FBC.jpg
FH4IVN1LHW03FKR.jpg
FNNGP9PLHW03FCO.jpg
FB76YMSLHW03G8Y.jpg
F1YU42MLHW03GAE.jpg
F17TB0LLHW03HWJ.jpg

Glueing Top Part

  1. Begin by unscrewing your computer mouse and removing all the electronics. Cut off any loose wires. Take note of the original position of the mouse button as you will need it later.
  2. Use your 3D printer to print the top part of the RunningMouse.
  3. Apply glue to the bottom part of the mouse and attach the 3D-printed top part to it.
  4. Take the electronic button part that you soldered earlier and insert it through the corresponding hole in the bottom part of the RunningMouse. Adjust its position to match where the button originally was. You can use double-sided tape if necessary but I would recommend glue to keep it in place.
  5. If needed, trim any excess material or file down rough edges to make the button fit properly. Once you are satisfied with the alignment of the top part, glue the button part onto the bottom part of the mouse.
  6. Now, print the final part, which is a small bar.
  7. Apply glue to the holes on the small bar and attach it to the clicking mechanism of your mouse.
  8. Carefully put the mouse cover back on, ensuring that all the components are aligned correctly.
  9. Look at the pictures for a better explanation.
  10. Congratulations! You have successfully glued the top part of your mouse. Your "RunningMouse" is now ready for use!
  11. Open the top part hook up the 9v battery's and try holding the mouse button down to activate. Have fun!