The Smart Fish. Programmable Robot
by Kotheson in Circuits > Robots
8781 Views, 122 Favorites, 0 Comments
The Smart Fish. Programmable Robot
The Smart Fish is a programmable robot based on ATmega 328P microcontroller.
It is a fish with an exoskeleton that allows it to get out of the water. And the reason why is because we have polluted its environment.
I think it is a cute Robot to attract the little ones to the world of electronics, programming, and robotics. You can start with simple exercises such as working with LEDs, and push buttons and reach more complex projects with sensors, quadrupeds, and so on.
My goal with this project was to make a versatile robot in three ways.
- A robot with interchangeable parts. It can use wheels, legs, propellers...
- A robot for beginners and advanced.
- You can reuse old toys or add your own designs.
From Idea to Model
Just for the curious, I will say that I had the idea for this design 19 years ago, when unfortunately an oil tanker, "The Prestige", had an accident off the north coast of Spain.
Then I imagined thousands of Smart Fishes coming out of the water to help us clean up the mess. At that time I only designed a very rudimentary version of the character for 3D animations.
Recently, with the current state of the seas and oceans, I thought about the Smart Fish again, but this time I wanted it to be "real".
I started by recovering the initial designs and adapting them to the new concept.
Many hours later... ;)
I came up with a 3D design that met my expectations both aesthetically and technically. (Photo 1.2.3)
External View of the Robot
This exterior view and the description of the visible components will give us an idea of what the interior of the Robot will look like.
The Robot can be :
- Autonomous
- Bluetooth controlled
- IR Controlled
For the infrared control, I have used this transmitter Amazon, but not the receiver. For the receiver, I have used the TSOP 1838 receiver.
The Smart Fish Modular Robot
The Smart Fish exoskeleton can be connected to different modules. I have specifically designed 4 modules: TT Car, Biped, Oled, and the Tech Lab.
But in the next steps, you will see how through the Expander you will be able to connect the Smart Fish to any design.
Positioning of Components
In order to place the components properly and for the subsequent assembly, I separated the Robot into 7 parts.
- The shield.
- The head
- The cockpit.
- Two "upper-body" halves.
- The "lower body".
- The caudal fin.
(Photo 1)
All parts are 3D printed, but I got the shield by vacuum casting the 3D model. (Photo 4-5)
The head and the cockpit, due to details, are printed in resin, and the rest with filament.
I took the measurements of all the electronic components and modeled them in 3D. Also working with a 3d program I pre-positioned all the electronic components.(Video)
Cockpit.
- Ir Data receiver TSOP1838 eBay
- LDRs x2. (Light dependant resistors) Amazon
- Charger and boost Aliexpress
- DFMiniPlayer (mp3) Amazon
- Speaker. The speaker should not be larger than 3cm in diameter.
- 10k resistors x 2
Upper Body.
- PCB DropBox
- Arduino nano Amazon
- Mini USB Male 5 Pin Solder Socket Connector eBay
- HC-06 Bluetooth Module Amazon
- KY- 032 Distance Sensor Module x2 Amazon
- 3mm Led x2 Blue
- 220-ohm resistors x2
- Bluetooth switch Amazon
- Bluetooth power indicator 3mm led blue
- Reset button Amazon
- Touch sensor Amazon
- Pogo connectors x12 Amazon
- 18650 Battery Amazon
- Cubic Magnets x2 Amazon
- 3mm led trim Amazon
- 5mm led trim Amazon
Lower Body.
- Power 3mm led indicator x2 Red
- 220-ohm resistors x 2
- Mini USB DIP adaptor Amazon
- 3x5mm Cylindrical magnets x2 Amazon
- Power switch Amazon
Caudal fin.
- Cylindrical magnets: 3x5mm x1 5x5mm x1 magnets
Throughout the development process, we will need to measure the length of the wires between the 3 main parts. To work comfortably at the time of assembly let's separate the parts about 2 centimeters before measuring the wires. (Photo 3 )
Electronic Schematics
Overview of power supply circuits. (Photo 1)
Overview of PCB. (Photo 2-3)
It's a very simple PCB design but helps us wire the components. Gerber Files DropBox
You can make your own using a breadboard.
WARNING
An original Nano has a diode between 5V and the USB-supplied power. So you should be able to connect 5V to the 5V pin, and the USB connector to a PC for serial communication and not have an issue.
For a Nano clone, you'd need to investigate yourself. If you are not sure, switch off the power switcher before plugging the USB connector.
Note
We will connect the output VCC from the battery charger step up to the 5v pin of Arduino. (Photo 1)
Showing the schematic view of all components would be very cumbersome. In the following steps, I will show the schematics as we need them.
Electronic Schematics 2. Cockpit
LDRs
Connect the sensors at the front of the Cockpit and add the resistors at the rear of the Cockpit following the schematic in Photo 3.
TSOP 1838
The Tsop 1838 is an IR data receiver and is located on the top of the cockpit. Add a 10Kohms resistor between Signal and Vcc. (Photo 2 - 4)
DF PlayerMini
The DF PlayerMini is an Mp3 player and is located in the lower part of the cockpit. (Photo 2 - 5)
A micro SD card is connected to the DF PlayerMini. The order you copy the mp3 into the micro SD card will affect the order mp3 played, which means play(1) function will play the first mp3 copied into the micro SD card.
I have recorded mp3 files like
- Forward
- Backward
- Left
- Right
- Led on
- Led off
- Sounds
- ...add the sounds you want the Smart Fish to speak. (In fact, the voice is from my little nephew)
Connect a drive speaker less than 3W, no larger than 3cm in diameter.
Here is a link to the official website, libraries and examples DF Player Mini
But our module is connected to 12 and 3 Arduino pins.
Battery Charger and boost
Is located on the top of the cockpit. (Photo 2 - 6)
Electronic Schematics 3. Upper Body
Front LEDs
The LEDs include a bezel.
To mount the LEDs follow the instructions in Photos 1-2.
Connect Left led to A0 and Right led to A1 using 220 Ohm resistors. (Photo 3)
Yes! We can use analog arduino pins as digital outputs.
void setup () {pinMode(A0, OUTPUT); pinMode(A1, OUTPUT);}
void loop () {digitalWrite(A0, HIGH); digitalWrite(A1, HIGH);}
KY-032 Distance Sensor
- Fine-tune the potentiometers to achieve a distance of about 7cm. (Photo 4)
- Desolder the infrared receiver and transmitter. Measure the proper distance and re-solder using wires. (Photo 5)
- Connect Right KY-032 to A2 pin on Arduino. Connect left KY-032 to A3 pin on Arduino. (Photo 6)
The Ir Emitter of the distance sensor has also a bezel. As we have desoldered the IR Emitter Led, the legs of the LED are too short, so we will have to lengthen them. (Photo 7)
HC-06 Bluetooth Module
To connect the BlueTooth module follow the schematic in Photo 5. A switch for the module and an LED indicator are connected. (Photo 8)
Touch Sensor TTP 223
The touch sensor is located on the left halve of the upper body. (Photo 9-10)
18650 Battery
I recommend values between 2000 and 3500 mAh. Values above these are usually a fraud. (Photo 11)
Pogo pins assignment
In the belly of the exoskeleton, we find the pogo pins
There are 12 pins, six per halve.
- VCC
- GND
- 2 Analog pins A4 - A5
- 4 PWM pins 6 - 9 - 10 - 11
- 4 Digital pins 4 - 5 - 7 - 8
(Photo 12.)
Electronic Schematics 4. Lower Body
The power LEDs are located at the rear of the lower body, but they are inserted from the front. They are connected to GND and 3v3 pins of Arduino. (Photos 1 - 2 - 5)
The power switch is located at the bottom. (Photos 1 - 2 - 5)
Then we have to solder 4 wires between the DIP adapter and the Mini USB solder socket, which is connected to the Mini USB jack of Arduino. (Photos 3 - 4)
The USB connection is used to charge the battery, upload programs to the board, and control the Smart Fish from the computer via serial communication.
When placing the magnets pay attention to the polarity of the magnets. (Photo 6)
Caudal Fin
The caudal fin simply has two holes for the 3x5mm and the 5x5mm cylindrical magnets.
Magnets
HOLDER
To mount the Holder, simply glue the magnets with the Coupler and then with the base. (Photo 1)
The Holder will be very useful when uploading programs and while charging the battery. (Photo 3)
It is also good support when we interact with it and a good system to store it when we are not using it. (Photo 4)
Supplies
5x5x5mm magnet x 2
Female Pogo Pins
The female pogos pins receive the male pogo pins from the Upper Body. (Photo 1)
This will be applied to the different Smart Fish modules.
We will need 12 nails. (Photo 2)
The 12 Arduino Pins:
- GND - VCC
- 5 - 4
- 8 - 7
- 9 - 6
- 11 - 10
- A5 - A4
Pass the nails through the holes (Photo 3)
Nails should exceed about 6mm. So you have to cut the nails so that they have a length of about 1 cm. (Photo 4)
The wires can now be soldered to the nails. (Photo 5)
Always keep in mind the order of association to the Arduino pins. (Photo 6)
Smart Fish TT CAR
The TT car module is equipped with 4 driving wheels (4x4) controlled by a dual H-bridge.
In the front, we have an ultrasonic distance sensor (US-025) to detect and avoid obstacles.
NOTE
You will need the US-025 sensor and not the HC-SR04, the last one will not fit the 3d model.
Supplies
Distance sensor US-025 x 1 Web
Dual H-Bridge x 1 L293D Amazon
2 x Cubic magnets 5x5x5mm
4 x TT motors and wheels Amazon
4 x Motor Bracket Holder Mount Amazon
Smart Fish BIPED
This Biped module consists of 4 servos, 2 per leg, to walk, move, dance, and create expressions.
Supplies
4 x MG90S Micro servo 9G with horns Amazon
2 x Cubic magnets 5x5x5mm
Smart Fish OLED DISPLAY
This Oled module has an OLED display on the front, push buttons. Internally it has an RTC and on the back a Buzzer.
Simple Tip. (Photo 2)
- Cut four three-by-six-hole Prototype Pcb pieces. (A)
- Solder the pushbutton to the piece. (B)
- Solder the wires and glue it all to the 3d model. (C)
Connect the RTC module and the Oled Display as shown in Photo 3.
Assign push buttons and buzzer pins at your convenience to arduino.
With this module, we can visualize data. We can for example make an alarm clock, a light-sensitive alarm...
Supplies
- Oled display 0.96 Inch 128x64 Amazon
- RTC Amazon
- Push Buttons (6x6x11.5mm) with caps (6x6mm) Amazon .
You only will need 4 buttons so better look for a local store but the caps are necessary.
- Buzzer 0.46-inch diameter 0.35 inch long. The most common buzzer.
- 2 x Cubic magnets 5x5x5mm
Smart Fish TECH LAB
With this Tech Lab module we can experiment with electronics; from turning LEDs on and off, to using switches, potentiometers or creating more complex projects and experimenting with programming.
The GPIOs are exposed for connection to the Protoboard.
The rotating base works with a servo motor that we can control through programming.
This module allows you to access the electronic elements of the exoskeleton itself as the LEDs, sensors, from the breadboard or from the computer connected by serial communication. It also allows controlling external elements (sensors or actuators) from the exoskeleton itself.
Supplies
Protoboard 830 Amazon
6mm Bearings (balls) Amazon
MG90S Micro servo 9G Amazon
2x Cubic magnets 5x5mm Amazon
Dupont conectors 12 pins in two rows x2. Amazon
The Tech_Lab_Spacer.stl and the Tech_lab_Base.stl are so big, so some 3D printers would be not able to print them.
I recommend using the Tech_Lab_base.dxf file.
The Expander
The Expander is a piece that allows us to easily connect the Smart Fish to any electro-mechanical design.
To assemble it follow the indications in photo 3. Glue all the components.
IMPORTANT
The screws should not be inserted more than 5mm into the insert. Measure the thickness of the part to which you are going to attach it and add only 5mm more. Otherwise, the Dupont connector could be broken.
We will be able to recover broken toys, mount our Smart Fish on our designs or third-party designs.
Knowing the dimensions and measures of its components we will be able to create simple couplings to mount it on any design.
Supplies
- 5x5x5 cubic magnets x2
- M3 4x5mm inserts x4 (Photo 4) Amazon
- M3 screws x4
- Dupont Connectors 6 pins single row x2 Amazon
In the following steps, there are examples in which I have used the Expander.
The Smart Fish Mounted on a Quadruped Robot
As we have access to 8 digital pins through the Expander, we can control up to 8 servo motors and there are still 2 analog pins left for any purpose, which can also be used as digital outputs.
This is The mePed Quadruped Robot Thingiverse, but you can use any 8 servos quadruped.
The Smart Fish Mounted on a Omni-directional Smart Car Chassis
As we have access to 8 digital pins through the Expander, we can control up to 4 motors in both directions.
And there are still 2 analog pins left for any purpose, which can also be used as digital outputs.
Omni-directional smart car chassis Aliexpress
The Smart Fish Mounted on a Lego Chassis Car
I mounted the Smart Fish on a lego car through the Expander and two 3D parts I modeled, one to fit it to a standard Lego piece and the other to connect N20 gear motors. (Photo 2)
I have used a dual H-Bridge for the control.
CODES
SmartFish_IR_LDR_LEDS.ino Program that allows interacting with the IR, LDR sensors, and LEDs.
SmartFish_Car_Distance_Sensor.ino Obstacle-avoid for the TT Car Module.
SmarFish_Oled.ino Program that displays the state of the IR distance sensors Left and Right.
IR_Decode.ino Program that allows displaying on the serial monitor the code corresponding to the button pressed on the remote control. Requires the installation of the IRremote library. IRremote library
SmartFish_IR_Control.ino Program that controls the state of the frontal LEDs ON-OFF and keeps state while holding the button pressed
SmartFish_Biped.ino Program with several Biped animations. I have used the Otto library just reassigning the Arduino servo pins Otto library