Hi, y'all, I'm working on a project which is essentially converting a rotary phone into a smart home device. I've got the dialer and hook circuits up and working with my Uno Wifi Rev 2, but I'm running into some real issues with the ringer. I've been referring to this tutorial and this one for the most part, but they're kinda sparse as far as fine details on how they got their ringers to work. I've created an electromagnet using magnet wire, and I can ring the bell by just connecting the the electromagnet to an 9v battery.
I've tried using an l298n driver to turn the magnet on and off, which is what the person in the first tutorial did, but this doesn't seem to do anything (code below). I've also tried (very naively) to use a relay module I had lying around to simply turn power on and off to the magnet, but that doesn't do anything either, it's very likely relays don't work the way I think they do. I'm using a Keyestudio brand module that I got with a sensor kit, and I've got the +9v of the battery plugged into the middle port and the magnet plugged into the right port. The other wire of the magnet and the battery's GND are plugged into GND on my breadboard.
A couple pieces of information that may be helpful, I've seen other phones which have two electromagnets which pull the mallet back and forth. My phone had one electromagnet (which required too much power, so I made a homemade one) and one regular magnet. The regular one keeps the mallet in place until the electromagnet is turned on, at which point it will smack one bell. Then when the magnet is turned off, the mallet returns to its original position and smacks the other bell. At least this is how I think it works. I don't think I need to reverse polarity on the magnet, but I could be wrong. Also, I've connected my 9v battery and the magnet to a breadboard, expecting the mallet to stand attention, but I had to mess with the magnet's wires a bit to get it to turn on. Maybe the 28 AWG magnet wire is too thin for my driver and relay, and it's not making a good connection? Finally, it's only allowing me to have two links in this post, so I'll comment with some more links.
I'm a complete novice, so I'm at my wit's end at this point. Can y'all think of anything I could try? Thanks in advance.
#include "Arduino.h"
void setup(void) {
Serial.begin(9600);
Serial.println("START");
pinMode(6, OUTPUT); // Input 1
pinMode(7, OUTPUT); // Input 2
}
void loop(void) {
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
Serial.println("ON");
delay(1000);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
Serial.println("OFF");
delay(1000);
}