The PenduLight, a journey form inception to artifact.
The PenduLight, a journey form inception to artifact. For those who have not read my previous posts about design and early fabrication I will post a quick review here.
For the TL;DR scroll top the bottom.
The full text is available below.
The initial idea behind the PenduLight was to capture the movement of a the plumb of the pendulum equipped with an RGB LED allowing the path to be recorded in a long exposer. I wanted to be able to influence the the movements of the plumb to do this I attached the the suspension cable to a lever-arm which in turn was attached to a stepper motor. I used a toggle to change direction and a rotary potentiometer to change the speed.
I think overall the project was a success. There were some issues along the way, most were solved by making small adjustment, however, there are a few changes that I would like to make.
- I need a more powerful motor, I didn’t think about the amount of torque required to change the direction of the motor with the lever-arm attached. I also think a larger diameter spindle would help with some binding problems. The current circuitry will allow me to use a 24V 2A motor without changing anything except for the battery.
- The housing for the motor worked but could have been better, the initial idea to create an 80/20 frame for the PenduLight would be best, it would allow for small adjustments and a very rigid attachment point.
- Use barrel clasp to attach the separate halves of the suspension cable, this would make changing the length or material type a less time consuming change.
- Use a heat insert at the top of the plumb, again this would make installation of the plumb to the suspension cable much easier.
- Use a four strand wire instead of forgetting to buy and then have to construct one hahaha.
I’m sure there are a few other changes I would like to make and there are some new features I would like to incorporate into the overall design as well.
It took a little bit of time to get the code for the stepper to work well. This code was adapted from the moto-knob code available with the Arduino IDE.
/* Code adapted from MotorKnob A stepper motor follows the turns of a potentiometer (or other sensor) on analog input 0. http://www.arduino.cc/en/Reference/Stepper This example code is in the public domain. */ #include <Stepper.h> const int stepsFull = 200; //Stepper pedulumstepper(stepsFull, 2, 3, 5, 6); Stepper pedulumstepper(stepsFull, 3, 5, 6, 9); //int dirControl = 9; int dirControl = 10; void setup() { } void loop() { int sensorReading = analogRead(A0); int stepperSpeed = map(sensorReading, 0, 1023, 0, 100); if (stepperSpeed > 0) { delay(1); if (digitalRead(dirControl) == LOW) { pedulumstepper.setSpeed(stepperSpeed); pedulumstepper.step(stepsFull / 50); } else { pedulumstepper.setSpeed(stepperSpeed); pedulumstepper.step(-stepsFull / 50); } } }
To cycle the RGB LED the code wasn’t that bad, I adapted it from James Harton, and can be found here https://gist.github.com/jimsynz/766994
const int redPin = 3; const int greenPin = 5; const int bluePin = 6; void setup() { // Start off with the LED off. setColourRgb(0,0,0); } void loop() { unsigned int rgbColour[3]; // Start off with red. rgbColour[0] = 255; rgbColour[1] = 0; rgbColour[2] = 0; // Choose the colours to increment and decrement. for (int decColour = 0; decColour < 3; decColour += 1) { int incColour = decColour == 2 ? 0 : decColour + 1; // cross-fade the two colours. for(int i = 0; i < 255; i += 1) { rgbColour[decColour] -= 1; rgbColour[incColour] += 1; //quick and ugly invert // setColourRgb(255-rgbColour[0], 255-rgbColour[1], 255-rgbColour[2]); setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]); delay(50); } } } void setColourRgb(unsigned int red, unsigned int green, unsigned int blue) { analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue); }
I used a Two different boards in the construction of the PenduLight. Originally I was going to use two Arduino Nano Every which is a very cost effective board and has just enough digital pins to accomplish the tasks at hand. I ended up using one Nano Every and one Nano 33 IoT.
I used the Nano 33 IoT with the stepper. I had some issues with the motor driver. I started with a SparkFun dual H-bridge that used a TB6612FNG, it was being very sporadic in the operation of the stepper. I read in the data sheet that it doesn’t handle low-voltage steppers very well. So I ordered a Pololu DRV8834 low-voltage stepper motor driver. This board has the advantage of a small potentiometer that allows you to set a current limit. HOWEVER after a full day of troubleshooting the code and wiring I abandoned the board and went back to the TB6612FNG and to my surprise it worked flawlessly. I still don’t know why it worked out the way it did, I would like to do more research into why.
I decided to use a proto-board and solder everything to reduce the since of the controller box. This is where I ended up change from the original Nano Every to the Nano 33 IoT. In the end I didn’t actually have to do this. After I finished soldering to the proto-board nothing worked, I checked my wiring but didn’t see anything wrong. So I pulled the Nano Every off, which was a royal pain. I connected it to the USB and it worked. I was stumped. So I switched to the Nano 33 IoT, soldered it up and… it didn’t work! I knew at this point it had to be a wiring issue. I checked for solder bridges or crossed wires and finally found the culprit. The VCC in was attached to ground, Had I spent a few extra minutes checking the wiring first I wouldn’t have had pull the Nano Every off, we live, we learn.
The RGB LED was much simpler on the wiring side. I used the Nano Every and a diffuse cathode RGB LED.
I used 9V batteries for both the LED and the motor. In hindsight and after doing some more calculations the 9V choice for the motor isn’t the best option. In the future I will use a different motor with more torque which will need a different battery.