Remote Harisen Control by Linking Two obnizes

Make things

Make a system by linking two obnizes that if you turn a dial (Potentiometer), you can control the harisen remotely. You can link two obnizes by one program easily.

Materials

How to make

Hardware connection

  • the side of the remote control

Connect a Potentiometer to an obniz Board like the table and the image below by referring to Potentiometer Library. You can replace pin0 and pin2. (The potentiometer turns backward.)

obniz (the side of the remote control) Potentiometer
0 Vcc
1 signal (middle)
2 GND

  • the side of harisen

Connect a Servo Motor to an obniz Board like the table and the image below by referring to Servo Motor Library.

the side of harisen Servo Motor
0 signal
1 Vcc
2 GND

Body

  • the side of the remote control

Cover the Potentiometer with a dial to make control easier. Hook the wire so that when you turn the dial, the Potentiometer turns with it.

contents in the dial
the dial cover
  • the side of harisen

Put the harisen between the disposable chopsticks and fix it on the Servo Hone.

the whole of harisen
the connecting part of disposable chopsticks and Servo Horn

Software

The program links two obnizes. After waiting for connecting the obniz of the side of the remote control, make the obniz of the side of harisen connected in this part below.

Please read Two obniz integration | Startup Lessons for JavaScript | obniz for details.

let potentObniz = new Obniz('OBNIZ_ID_HERE');
  potentObniz.onconnect = async () => {
    let motorObniz = new Obniz('OBNIZ_ID_HERE');
    motorObniz.onconnect = async () => {
    ...
    }
  }
}

Also, if detect changes of potentiometer value, the Servo Motor angle will change according to its value.

Please read Potentiometer Library for details.

meter.onchange = async (position) => {
  servo.angle(position * 180);
};

Program