Over the last couple of weeks I’ve made some progress wiring the clock hostboard and building the plate that supports the motors. I thought I’d test these together.
Before I powered on the circuit or plugged in the Arduino Micro I made sure that the wiring of my hostboard was correct by looking for short-circuits and open-circuits using a multimeter.
I repeated this when I wired the opto-sensor.
I then ran the microcontroller with a simple program to test the opto-sensor. I was at this point I spotted my first error. I’d forgotten to attach the 10K resistors to +Vcc. Whilst reading the Arduino site I realised that it is possible to work around this issue by setting the correct pin mode.
A pin may also be configured as an INPUT with pinMode, and subsequently made HIGH with digitalWrite, this will set the internal 20K pullup resistors, which will steer the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works as well
I will likely simplify my board and remove the extra resistors.
My next test was to wire up one of the motors with the objective of writing the stepper motor code. The idea is to have the opto-sensor and motor handled by the same class. I did find a issue in that I could not get the serial output to work with the AccelStepper library, it might be that it’s either using the serial or one of it’s pre-requisites internally.
When I ran this my motor was behaving strangely in that it ran correctly in one direction but not the other. I checked my wiring and pin allocations in the code and it was all ok. I swapped to the other driverboard and second set of pins and that worked fine. I checked the driverboards and there was nothing wrong with the wiring for those.
I wrote a pin testing programme that toggled each of the pins in turn. This would flash the LEDs on the driver boards. This highlighted my problem in that pins 8 and 9 flashed at the same time. I checked my hostboard and that was fine but when I checked the Arduino Micro there was the short. By this point it was late in the evening to be desoldering such as small board so I called it a day but I’ll desolder those two header pins to see if the problem is with my soldering or with the board. I can also use the other driverboard to develop my code.