Servo control. Servo control has been kicking my butt all week. On Thursday I kicked back.
Digisparks are great little boards. They're inexpensive, they can emulate a keyboard and mouse, they don't need a USB↔Serial adapter and they're tiny. But they are a stripped-down version of a full-fledged Arduino. While programming a few problems came out which I tried to remedy. The first problem was that the board did not support the pinMode INPUT_PULLUP which activates a built-in pullup resistor and the second problem was that it wouldn't support Arduino's servo library. Neither of these was detrimental. Physical pullup resistors were soldered in place but they had to be removable because one of the pins was needed for communicating with the computer. Merely annoying. Second change was to remove anything which used the servo library and replace it with code that would output the same thing as the servo code. This turned out to be difficult on a Digispark and I'm still not sure why.
After the Digispark failed to perform a larger Arduino Pro mini replaced it. The pullup resistors were removed from the board and replaced with software pinMode INPUT_PULLUP. Arduino Pro Minis also support serial debugging which the Digispark cannot do easily. I was expecting to need readings from through the serial port about the timers controlling the servos but the servos simply worked better on the Pro Mini which is a mystery to me. Programming for the Pro Mini was updated but still used the timing algorithms instead of the servo library. Timing algorithms are more versatile since they can cut or supply constant power to the signal pin which effectively disables it and reduces power consumption.
A timegamble resulted in the best news all week. Stock servo, unlike the ones previously modified for continuous rotation, could be convinced to rotate a full 180º by using PWM values outside the normal convention. In other words, by giving the servo signals longer or shorter than normal it would rotate more than normal. The solution worked so well that two servos could be held together while they spun without slipping off each other. Anyone copying this project won't have to modify their servos because I learned the hard way.
Powering the keyboard has involved opening the case and installing a 23A battery every time then opening it back up to take the battery out when I'm done. This is a pain even when I'm at my desk and there's a screwdriver within arm's reach. Connecting it to a computer is even more difficult since the USB port is inside the case and using it meant attaching directly to the fragile electronics while the top was off. A micro USB breakout board was attached to the side of the enclosure and extends the USB port to the outside. This connection can be used for power or keyboard or both.
Downloadable Files:
The rest of the weekly summaries have been arranged by date.
Digisparks are great little boards. They're inexpensive, they can emulate a keyboard and mouse, they don't need a USB↔Serial adapter and they're tiny. But they are a stripped-down version of a full-fledged Arduino. While programming a few problems came out which I tried to remedy. The first problem was that the board did not support the pinMode INPUT_PULLUP which activates a built-in pullup resistor and the second problem was that it wouldn't support Arduino's servo library. Neither of these was detrimental. Physical pullup resistors were soldered in place but they had to be removable because one of the pins was needed for communicating with the computer. Merely annoying. Second change was to remove anything which used the servo library and replace it with code that would output the same thing as the servo code. This turned out to be difficult on a Digispark and I'm still not sure why.
Pullup resistors on the terminal board
After the Digispark failed to perform a larger Arduino Pro mini replaced it. The pullup resistors were removed from the board and replaced with software pinMode INPUT_PULLUP. Arduino Pro Minis also support serial debugging which the Digispark cannot do easily. I was expecting to need readings from through the serial port about the timers controlling the servos but the servos simply worked better on the Pro Mini which is a mystery to me. Programming for the Pro Mini was updated but still used the timing algorithms instead of the servo library. Timing algorithms are more versatile since they can cut or supply constant power to the signal pin which effectively disables it and reduces power consumption.
Arduino Pro Mini replaced the Digispark
A timegamble resulted in the best news all week. Stock servo, unlike the ones previously modified for continuous rotation, could be convinced to rotate a full 180º by using PWM values outside the normal convention. In other words, by giving the servo signals longer or shorter than normal it would rotate more than normal. The solution worked so well that two servos could be held together while they spun without slipping off each other. Anyone copying this project won't have to modify their servos because I learned the hard way.
Servos cycling synchronously
Powering the keyboard has involved opening the case and installing a 23A battery every time then opening it back up to take the battery out when I'm done. This is a pain even when I'm at my desk and there's a screwdriver within arm's reach. Connecting it to a computer is even more difficult since the USB port is inside the case and using it meant attaching directly to the fragile electronics while the top was off. A micro USB breakout board was attached to the side of the enclosure and extends the USB port to the outside. This connection can be used for power or keyboard or both.
Keyboard with accessible USB port
- Common OpenSCAD files
- Servo footprints for OpenSCAD.
- Arduino Code for wired keyboard
- Spreadsheet for chords.
The rest of the weekly summaries have been arranged by date.
Disclaimer for http://24hourengineer.blogspot.com/
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All
information in this blog, or linked by this blog, are not to be taken
as advice or solicitation. Anyone attempting to replicate, in whole or
in part, is responsible for the outcome and procedure. Any loss of
functionality, money, property or similar, is the responsibility of
those involved in the replication.
All
digital communication regarding the email
address 24hourengineer@gmail.com becomes the intellectual property of
Brian McEvoy. Any information contained within these messages may be
distributed or retained at the discretion of Brian McEvoy. Any email
sent to this address, or any email account owned by Brian McEvoy, cannot
be used to claim property or assets.
Comments
to the blog may be utilized or erased at the discretion of the owner.
No one posting may claim claim property or assets based on their post.
This blog, including pictures and text, is copyright to Brian McEvoy.
Comments
Post a Comment