Introduction: Movie Reccommender

Picture of Movie Reccommender

Lights! Camera! Action!

We will explore Internet Queries using the Intel® Edison and the Arduino breakout board.

Using a set of dials, set a decade and a movie genre. Pressing the button will activate the Movie Recommender and the search begins. After the magic is done, the curtain will open to reveal the movie that fits the criteria.

So get this project done, make some popcorn, dim the lights, and get ready to watch a sci-fi movie from 1988... “My Stepmother is an Alien”?!

Thanks to The Open Movie Database (OMDB) for providing the search API.

Here is a video of the completed project.

This tutorial was originally published on Intel Communities here.

Step 1: Needed Components

Picture of Needed Components
  1. Intel® Edison with the Arduino breakout board
  2. Edison power supply
  3. Arduino Protoshield
  4. 4 mm MDF components - lasercut according to drawing
  5. Fabric component - lasercut according to drawing
  6. Decorative printout - printed in color
  7. 2 10k Ohm potentiometer
  8. 2 Knob covers
  9. 1 push button
  10. 1 standard servo
  11. 1 16*2 LCD screen
  12. 4 M8 bolts
  13. String
  14. Nuts and bolts
  15. Spray glue

Step 2: Sort the Lasercut Pieces for Easier Construction

Picture of Sort the Lasercut Pieces for Easier Construction

Sort all the pieces according to the image

Step 3: Solder the Electronics

Picture of Solder the Electronics

Use the schematic to solder the electronic components together

Step 4: Optional: Attach Decorative Printout (Part C1) to Part A1 to Using Spray Adhesive

Picture of Optional: Attach Decorative Printout (Part C1) to Part A1 to Using Spray Adhesive

Step 5: Make Movie Curtain

Picture of Make Movie Curtain

  1. Attach Part A11 and Part A12 along the long edges of Part D1
  2. Cut string (approx. 30 cm) and tie to Part A11

Step 6: Mount Intel® Edison to Base and Attach Electronics

Picture of Mount Intel® Edison to Base and Attach Electronics

  1. Attach Intel® Edison to Part A10 using Parts B4 as spacers in between
  2. Attach Part A10 to Part A5
  3. Attach Protoshield
  4. Attach screen
  5. Place the LCD into Part A5
  6. Insert Part A5 into Part A10
  7. Attach curtain, side panel, and dials/button
  8. Place the potentiometers and button through the slit on Part A10
  9. Attach Part A2 to Part A4
  10. Slide the curtain into the appropriate slots
  11. Attach Part A6 to assembly
  12. Attach the potentiometers and button to Part A1 and secure
  13. Place dial covers on potentiometer
  14. Attach front panel and weigh down and secure curtain
  15. Attach Part A1 to assembly
  16. Place two M8 bolts on each side of Part A12
  17. Place Part B2 into the slots on Part A11
  18. Attach servo and assemble wheel
  19. Insert the servo into Part A3 and secure from behind using Part B3
  20. Attach Part A3 to assembly

Step 7: Assemble and Attach Wheel

Picture of Assemble and Attach Wheel

  1. Attach Part A7, Part A8, and Part A9 together in that order
  2. Insert the servo arm and secure
  3. Attach to the servo
  4. Attach string to curtain mechanism
  5. Pull the string through Part A3 and place Parts B1 into Part A2 to act as a guide for the string
  6. Turn the wheel counter clockwise as far as possible and then back a little
  7. Slide string through the slot and wrap around multiple times to secure

Step 8: Scp the Python Script to the Intel® Edison and Upload Sketch


  1. Find out the ip address of Intel® Edison. Type “ifconfig” in the serial terminal, you can see the ip in wifi network under section “wlan0”
  2. Open a terminal in your computer. Copy the python script over by typing “scp /path/to/MovieRecommender.py root@EdisonIP:/home/root/”
  3. Upload the sketch

Step 9: Behind the Scenes

LiquidCrystal Display

The basic LCD screen is a simple and low tech way of adding a display to your project. Follow the example to connect the LCD to Intel® Edison

The “system()” command

When running Arduino sketches on the Intel® Edison, you can use the “system()” command to execute any Linux system commands. This makes it much easier for people familiar with Arduino to access advanced functionalities in the Linux system.

In this typical use case, complicated logics and features like string manipulation and internet query are realized by other languages like python or javascript. The Arduino sketch is used for interfacing between the hardware and scripts.

However the system() command only accepts char array as argument. In order to execute dynamically created commands, it would be much easier if the command string can be assembled dynamically, e.g., Char path=”~/myFolder”; String cmd=“ls “+path;

Using char array would be too rigid to be convenient. To convert String to char array, you can use the String.buffer property. So from the example above, just carry it out by calling system(cmd.buffer);

Research

The actual movie finding is handled by the python script. It is activated in Arduino sketch by calling the “system()” command.

Despite the dials labels, the OMDB API actually doesn’t allow search by genre or decade. So instead, a list of frequently appearing title words are used for keyword searching. Science fiction, for instance, may have “space”, “ufo”, “alien”, “laser”, “star”, etc.

Once set and the button is pushed, the Intel® Edison will send a randomized year within the decade and a random associated word - e.g. “1988” and “alien”. OMDB will then send back a list of movies from 1988 that contain “alien” in its title.

After the list is retrieved, the Intel® Edisonuses the first movie and sends another request to OMDB for its genre. If it doesn’t match the science fiction genre, it will continue to send requests of the other movie titles until it finds one that does. If none are found, it will repeat the process using a different associated word until successful.

Comments

austinwebdesign (author)2016-04-27

It is crazy what people come up with. Wow!