Speedier DrawBot Drawings

When using my DrawBot to draw pixelated drawings (versus TSP or vectors)1 I don’t really notice a pause from the machine between each pixel.  It takes a few seconds to shade each pixel, then it moves to the next spot and starts over again.  However, when trying to draw TSP art I discovered that the time spent shading a picture obscured the amount of lag time that occurred between each drawing point!  As I tried to draw a TSP portrait of my family I found it was taking about 3 seconds between each little point – which translated to a VERY VERY long time for a VERY small drawing.

When I asked Sandy about this, he suggested that this lag would be eliminated by drawing from an SD card.

Sandy’s current setup, which allows for computer free printing, consists of an Arduino Mega 2560 R32 , a MicroSD card breakout board3 , and an Adafruit Motor Shield4 .  Thus, the electronics setup would cost about $100 if you were starting from scratch, or another $80 if you have been following along at home and have a similar setup to mine.  Apparently the problem is you can’t just shove a MicroSD card into an Arduino.  If you try to add one to an Arduino, then the card shield will end up taking up the pins necessary to use the Motor Shield.  Since the Arduino Mega has a lot of extra pins, some of those can be used towards accessing the MicroSD card.

However, I thought I had seen an Arduino that had a MicroSD slot on board. 5  When I searched around Adafruit, I found this Ethernet Shield R3 with MicroSD connector6 .  Not only does this little shield fit my existing Arduino Uno, have a MicroSD slot, and have an Ethernet port, but it also has input pins so that it can be stacked!  This makes me then wonder…  Could I just pop this $45 board between my Arduino Uno and Motor Shield, add some software and get cooking?  I have to admit, the idea of spending $45 more, rather than $80 more for a Mega and MicroSD breakout board appeals to me.  I suppose there’s the added benefit that I might be able to run a REALLY long ethernet cable to the ‘bot if I so desired since it would have a built-in ethernet port on the Ethernet Shield.

Now, I’m the first to admit that I know next to nothing at all about programming Arduinos or fiddling with such things.  I’m just a fair hand at slavishly following some other person’s excellent directions.  Please do me a favor and let me know whether you think adding this Ethernet shield between my Uno and the Motor Shield will or will not work.

Posts in the DrawBot Adventure Series
  1. Wanna make a DrawBot?
  2. DrawBot Resources and Links
  3. DrawBot, the Adventure Begins
  4. DrawBots for the slow learner
  5. DrawBot - Parts Ordered!!!
  6. DrawBot - The Breakdown
  7. DrawBot - Parts Shipped!!!
  8. DrawBot - What would you draw?
  9. DrawBot - The Plan!
  10. DrawBot - The Hacks
  11. DrawBot - The Delivery?
  12. DrawBot - The Delivery, Part II
  13. DrawBot – The Delivery, Part III
  14. DrawBot – The Assembly, Part I
  15. DrawBot – The Delivery, Part IV
  16. DrawBot – The Assembly, Part II
  17. DrawBot – The Assembly, Part III
  18. DrawBot – The Assembly, Part IV
  19. DrawBot – Halp!!! No - seriously, a little help?
  20. DrawBot – The Delivery, Part V
  21. DrawBot – The Silver Lining of Failure
  22. DrawBot – The Delivery, Part VI
  23. DrawBot – The Assembly, Part V
  24. DrawBot – The Assembly, Part VI
  25. DrawBot – Printed Parts
  26. DrawBot – The Assembly, Part VII
  27. DrawBot – The Operation, Part I
  28. DrawBot – The Breakdown, Part II
  29. DrawBot – Printing!
  30. DrawBot – Printing, Part II
  31. DrawBot – Why are you crying?
  32. DrawBot – Calibration
  33. DrawBot – Pen Selection
  34. DrawBot – How to Recover from a Stalled Print!
  35. DrawBot – Drawing Success(ish)!!!
  36. DrawBot – Pen Selection, Part II
  37. DrawBot – Onwards and Upwards!
  38. DrawBot – Another Successful(ish) Drawing!, and an Update
  39. Restarting a Stalled DrawBot Drawing
  40. TSP FTW!
  41. Speedier DrawBot Drawings
  42. Two new DrawBot links! And an update!
  43. Excellent DrawBot Slides
  44. Another Drawing Robot!!!
  45. DrawBot Practice Tip: A Watched Pot
  46. The biggest inkjet printer ever
  47. Why do DrawBots draw on walls?
  48. Maze Code + Polargraph?
  49. Ideas for improving my DrawBot
  50. DrawBot Aesthetic Re-Design Ideas
  51. The Eagle Has Landed
  52. Every Body Needs a Skull
  53. This project is not going to overengineer itself
  54. Overengineered Spools
  55. Overengineered Bolt Endcaps, Case Holder
  56. Sourcing DrawBot Parts
  57. DrawBot - A Tour!
  58. DrawBot - A Preview
  59. Arduino Powered Drawing Robot Poll
  60. Building an Arduino Drawing Robot - On The Cheap
  61. DrawBot - Printed Parts Tour
  62. Unidentified Foam Object
  63. Arduino Powered Drawing Robot - Take 2 (Or 3)
  64. DrawBot, now ACTUALLY wall mounted!
  65. A Study of Drawing Robot Pen Holders and Design Considerations
  66. Drawing Robot Pen Holders, Calligraphy Pens, and Thought Experiments
  67. Ideal Qualities in a Drawing Robot Pen Holder
  68. Enough talk! Finally a pen holder!
  69. DrawBot Pen Holder Post Mortem
  70. To Maker Faire!!!
  71. Skipping! How could I forget the skipping?!
  72. PlotterBot at Maker Faire Bay Area 2013!
  73. PlotterBot.com - a new site dedicated to drawing robots
  1. Actually, the TSP drawings ARE vector graphics… []
  2. $65 at Adafruit []
  3. $15 at Adafruit []
  4. $20 at Adafruit []
  5. Spoiler alert: I was wrong []
  6. $45 at Adafruit []

3 Responses to “Speedier DrawBot Drawings”

  1. Michael Cook says:

    I’ve been following your blog for a while, and I took a quick look at this. If you read the documentation for the SD reader you’ll find this:

    “Because SD cards require a lot of data transfer, they’re really only good when connected up to the hardware SPI pins on a microcontroller”

    The motor shield uses the SPI pins on the Arduino Uno (10, 11, and 12), so you couldn’t use the hardware SPI to access the SD card. This leaves you with two options (on the Uno). First, you could rewire the motor shield. If you switched which pins went where and modified the software appropriately, you would be able to use the SD card. It looks like the motor shield just uses the pins as generic digital pins (from a quick look).

    Option two would be to use different pins for the SD card. The motor shield leaves 2, 9, 10 and 13 free for your use. That’s enough to use the SD card. The problem here is that you have to use software SPI. It exists in the code for the SD reader, but it will use up more CPU time. I don’t know if it would be faster than USB though.

    I hope this helps. Email me if I can try to help further.

  2. Sandy Noble says:

    Yep, Michael describes the main issue exactly as I see it too. I _did_ get around this pin problem to a certain extent by doing the opposite of Michael’s suggestion – that is, I kept the SD card on the SPI pins on 10-13, and modified the Adafruit library so it used different pins (http://code.google.com/p/polargraph/source/browse/#svn%2FAFMotor%2Fbranches%2FAFMotorSPI). I moved pin D11 to pin D9, and pin D12 to pin D14 It needed a little bit of hardware pin-bending and re-patching (http://www.flickr.com/photos/euphy/6062195091/in/set-72157626497662024) but it seemed to work. Servo motor stopped working properly, because it is wired to use the PWM on pin 9 normally, but I think there’s probably a way around that – I never tried. My journey is http://forums.adafruit.com/viewtopic.php?f=31&t=22422.

    The second thing I ran into is that the code needed to access the sd card is pretty big, so I ran out of memory to use any libraries anyway. The SD library on it’s own (that can read an SD card as a FAT volume) is 12k or so, and the polargraph server code is bulky, so there’s only 3 or 4k leftover. Again, I partially solved it by abandoning the idea of having FAT formatted cards and just reading and writing raw bytes to the card. The last version of the server code with this stuff in is http://code.google.com/p/polargraph/source/browse/embedded/trunk/drawbot_server_big.pde?spec=svn11&r=11 but it’s rudimentary. It’s based on Didier Longueville’s code here: http://arduino.cc/playground/Code/SDCARD. And so I ran into the final issue of running out of SRAM space, and eventually decided that it wasn’t worth the stress of trying to maintain such a highly optimised codebase. I don’t know much about C so it’s a job for someone far smarter than I.

    In retrospect, Michael’s solution of using the softwareSPI is probably the more sensible route – even dead slow it will still be magically instantaneous compared to USB, but you will still need to figure out a way to do I/O to the card. I kinda gave up on the idea – but I would be dead keen to find a solution. Bear in mind that ada are not the only fruit though, there are other drivers (though none quite so affordable) that use other pins or work in a different way. I can see that a limited function machine could still work – it wouldn’t do anything fancy, just the bare minimum.

  3. […] Speedier DrawBot Drawings Blog this! Digg this post Recommend on Facebook Share on FriendFeed Share on Linkedin Share via MySpace Share on Orkut Share with Stumblers Share on technorati Tumblr it Subscribe to the comments on this post Bookmark in Browser Tell a friend Pin It […]

Leave a Reply

Your email address will not be published. Required fields are marked *