Skip to content

Latest commit

 

History

History

TeachableMachineArduino

Steps:

  • Download Arduino IDE
  • Download p5 serial app
  • Upload Arduino code to the Arduino board (you can find it in the SoundClassifier/ ImageClassifier / PoseClassifier folder)
  • Open p5 serial app (if cannot open, change firewall settings)

Sound:

Sound with Servo Motor

  • Upload the Arduino Sketch to the Arduino board
  • Running this p5 sketch, remember to update the portName and mySoundModelURL, and update class names to your own classes.
  • Video Demo
  • Circuit
    • Connect D2,3,4 to 3 LEDs
    • Connect servo signal pin to D9. More about how to use servo motor with arduino.

sound_servo

Image:

  • Running this p5 sketch on p5 web editor, remember to update the portName and myImageModelURL, and update class names to your own classes.
  • Demo
  • Circuit
    • Connect Ground to the 2 LEDs Ground pin
    • Connect Pin 2, 3(or 12, 13) to the LED power pin An example circuit on Arduino Nano 33 BLE sense:
    sound_servo

Pose:

  • Running this p5 sketch on p5 web editor, remember to update the portName and poseModelUrl, and update class names to your own classes.
  • Demo

Trouble shooting:

  • The models works in p5 web editor, but my LEDs are not lighted up
    1. Light up LEDs in the arduino code directly to test if there is anything wrong with the LEDs.
    2. Make sure p5 serial is working: There shouldn't be any error in the console. The p5 serial app should be open, but do NOT connect to the port inside of the p5 serial app, otherwise p5 serial app will be using the port, then p5 web editor cannot use the port.
    3. You can find your portname in the p5 serial app. But there is no need to connect to the port in the p5 serial app.
    4. When you are re-uploading Arduino sketch, you need to stop p5 sketch in the editor and close the p5 serial app.
  • Cannot download/open p5 serial app
    1. Cannot open p5 serial app: change the firewall settings, turn the firewall
    2. Cannot download p5 serial app in Chrome(p5.serialcontrol.zip is dangerous, so Chrome has blocked it): try download it in other browers, like Safari, Firefox