Interactive Electronic Toy of Jack-O-lantern & Horse

by rgomezpunt in Circuits > Gadgets

1641 Views, 10 Favorites, 0 Comments

Interactive Electronic Toy of Jack-O-lantern & Horse

Screenshot_14.png

The initial inspiration was a few years ago when I saw the LEGO Mario Bross toy.

Having a toy that can have interactivity and sounds motivated me to work on the possibilities in the technological-educational field. My first version was a Scratch Cat to celebrate the 50th anniversary of the ScratchEd meetups in Barcelona, Spain.

This year around Halloween I decided to make a toy according to the event. Various skills and techniques are worked on in the process:

  • 3D modeling
  • 3D printing
  • Electronics and PCBs
  • Programming an interactive toy narrative


Here begins the creation of the Jack-O-lantern and his horse.

Supplies

Screenshot_15.png

In the following images we see the necessary material to make the entire project successfully.

In all cases, we have looked for components that are easy to weld and easy to buy at local electronics stores.

Even so, some components are not easy to find and it is better patiently to order them in the Chinese market.


The list of necessary components is:

... and some typical discrete components

Final Result

Jack O lantern w Horse - TinyToys

This video shows the final result.

3D Modeling


The design is made entirely in TinkerCAD. Tinkercad is a free 3D modeling tool, but it also has excellent features for 3D printing.

I have used two models from other users. They are the basis for the final model.

The original pumpkin is from: https://www.printables.com/es/model/242023-pumpkin

The original horse is from https://www.thingiverse.com/thing:795097


I also attach the 3D Tinkercad model of the entire character. On this model we work to cut into parts, and empty them to contain the electronics.

3D Printing

Screenshot_2.png

These are all the STL files needed for 3D printing. The material used is PLA and the resolution of the 3D printer is 0.2.

Electronics Design

Sin título.png

This is the schematic of the electronics used by the project. The heart of the electronics is an ESP32 module, which is programmed via microUSB.

To the ESP32 we connect a 1.8-inch TFT RGB screen, and a miniDF MP3 player module. The power system consists of a 3.7V 900mA LiPo battery that is managed with a 5V DCDC. It also acts as a LiPo charger via microUSB.


PCB Layout

Screenshot_34.png
Screenshot_35.png

Due to the number of components and their size, we migrate from the prototype in a universal PCB, to create a custom PCB.

We have uploaded the design of the PCB to PCBWay to share it with the community, and those makers who want to assemble one.

We also attach the Gerber files for greater flexibility.

Google Drive download Gerber

Soldering the PCB - Part 1

Screenshot_36.png
Screenshot_37.png

First we solder the two SMD resistors.

Second we solder the pin strips on the PCB motherboard, be careful to leave them as flat as possible...

Soldering the PCB - Part 2

Screenshot_38.png

We can now solder the LCD, we leave the pins flat and we put tape to protect the contacts with the other elements.

Soldering the PCB - Part 3

Screenshot_39.png
Screenshot_40.png
Screenshot_41.png

We solder the ESP32 module. The pins that come out a lot have been cut flatter.

And now we can solder the LiPo power control module. Before we notice that we protect the pins below so that they do not make false contacts. We solder this module at an angle, that is, the final part that does not have pins is touching the motherboard PCB. pay attention!

Soldering the PCB - Part 4

Screenshot_43.png
Screenshot_42.png

Finally we solder the MP3 module. We protect this module with tape previously. Notice that it goes above the power supply module. It is soldered between the module and the PCB board as seen in the image.

Assembly - Part 1

Screenshot_16.png

We make the connectors that go on the feet of the toy. They allow us to connect the electronics to the horse.

Assembly - Part 2

Screenshot_20.png
Screenshot_17.png
Screenshot_18.png
Screenshot_19.png

The head inside houses three elements:

  • The mini-speaker. Fits into a small receptacle.
  • The rotary encoder. We will fix it with a dot of glue.
  • The LiPo battery. Previously we fit it in its container box

Assembly - Part 3

Screenshot_22.png
Screenshot_21.png

In the 3D part, which are the legs, we have to connect three groups of cables:

  • on/off button cable
  • microUSB connector cable to charge the LiPo battery
  • the cables coming from the feet, which connect to the HORSE

Assembly - Part 4

Screenshot_23.png
Screenshot_24.png

Now we are going to assemble the electronics, which we have previously soldered, in the 3D part which corresponds to the face.

Assembly - Part 5

Screenshot_25.png

Now we have to join the part of the face with the part of the body. We have both mounted before and there are ready.

And we have to connect the cables that join both parts:

  • the button
  • the microUSB for charging
  • the wires coming from the legs

Assembly - Part 6

Screenshot_26.png

And finally we've to assemble this part with the head.

Before we fit and close these parts, we need to connect the wires from the head with the wires from the PCB board:

  • LiPo power cable
  • Rotary encoder cable
  • Mini-speaker cable

This is the most careful part. We will use tweezers to tidy the wires inside the toy. And slowly we'll close the head with the body.

Assembly - Part 7

Screenshot_27.png

Finally we only have one artistic detail left for our toy character. Design a cape.

First we draw it in Inkscape... Print it with a printer... Cut out the outline to use as a template... Draw the template on an orange felt and cut it out... finally put the cape on the neck.

Assembly - Part 8

Screenshot_28.png
Screenshot_29.png
Screenshot_30.png

Now we go with the assembly of the horse.

For each eye we will place a 5mm Red LED and connect two thin wires for each LED.

In the horse's mouth we put a 3mm Blue LED and connect two more cables.

So, at the base of the horse we have a total of 6 cables.


Assembly - Part 9

Screenshot_31.png
Screenshot_32.png
Screenshot_33.png

Now we prepare the male connectors that will join the horse to the toy character... and we will place them on the base, in the holes for that purpose

Finally we will join the 6 cables from before to these two connectors.

Programming

The final idea is that we can draw different faces for the toy character.

Some faces refer to some horror character. When this face appears we activate an MP3 sound that identifies the character and/or movie.

The examples I've tried are:

  • Psycho's face is associated with the famous music of the movie, when the girl is in the bathroom.
  • Jason's face from Friday the 13th has the music from the movie.
  • A special face that activates the horse with sounds and the LEDs light up.


The programming environment that I have chosen is Python for ESP32. It's a bit difficult to prepare the firmware and add the display module. But once it's configured, programming in Python is simple.


I recommend the following steps:

To be able to use Python in ESP32 I recommend this guide:

https://learn.adafruit.com/circuitpython-with-esp32-quick-start

To be able to use the TFT screen it is necessary to add the special module to CicuitPython, the link with the info is

https://github.com/adafruit/Adafruit_CircuitPython_ST7735

And to use the MP3 player we use the following library:

https://github.com/bablokb/circuitpython-dfplayer

To use the rotary encoder read:

https://learn.adafruit.com/rotary-encoder/circuitpython


This is the basic code to display the faces based on the rotary encoder :

import board
import rotaryio
import displayio
from adafruit_st7735 import ST7735

encoder = rotaryio.IncrementalEncoder(board.D10, board.D9)
last_position = None

# firmware TFT_SDA on TCK & TFT_SCK on TMS
spi = board.SPI()

displayio.release_displays()
display_bus = displayio.FourWire(spi, command=board.D23, chip_select=board.D19, reset=board.D18)

display = ST7735(display_bus, width=160, height=128)

bitmap = displayio.OnDiskBitmap("/face01.bmp")
tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
group = displayio.Group()
group.append(tile_grid)

display.show(group)

while True:
  position = encoder.position
  if last_position is None or position != last_position:
    print(position)
  last_position = position


Next ...

Jack O lantern - TinyToys

Now is the time to let your creativity run wild.

We can create a new toy character. Or we can also program other functionalities.