SOLVED! I can’t upload Arduino sketch to Wemos D1 Mini ESP8266

ESP8266 Wemos D1 Mini pinout

ESP8266 Wemos D1 Mini pinout

My Wemos D1 Mini WiFi boards had arrived from China1 on Friday and I’ve been fiending to build… something with them.

Unfortunately, I couldn’t get the very basic “blink” sketch to upload.  Here were my symptoms:

  • When uploading, I got the “error: failed to open” message
  • My Windows computer flashed a message when I connected the board, saying it was an unrecognized device
  • The Device Manager showed a little “alert triangle” suggesting the proper drivers were not installed
  • All of the ports in the Arduino IDE were disabled and greyed out

I tried several different upload speeds and several different USB micro cables to no success.  It was not until I found this post explaining that I needed to update the Wemos drivers along with a handy link to said drivers.

Now that I got this board blinking, I can’t wait to get it to do MOAR…

Default Series Title

Update:  My buddy Chris pointed out that I’ve been mixing up ESP32 and ESP8266.  I’ve corrected the title now.

  1. $13 for four boards plus headers?! []

What are the minimum parts necessary for an Arduino?

Outside a MintDuino, a book is a man's best friend

Outside a MintDuino, a book is a man’s best friend

It was hard for a beginner like me to imagine that an Arduino actually requires a whole lot less than all the stuff you would see on an Arduino Uno.  Assembling a MintDuino – and slowly pulling parts out to see what was really necessary – helped me understand what was truly critical to its operation.

Inside a MintDuino, it's too dark to read...

Inside a MintDuino, it’s too dark to read…

I found it useful to know what the (near) minimum necessary components of an Arduino were so that I could build a small project directly around just the chip and whatever critical parts were absolutely required to run the circuit.1 I wanted to build the circuit as small as possible – not to save on parts or cost, but to make sure everything could fit into an Altoids tin.23

As a side note, there is a very definite monetary benefit to figuring out how to build a minimal Arduino compatible device.  A brand new Arduino will run you about $30 – whereas soldering a chip into perfboard with the least amount of parts required would probably only cost you about $9 or less if you source the pieces carefully.  While an actual Arduino form factor makes a lot of sense when you’re using off-the-shelf shields, it’s not nearly as important when you’re building a very simple or completely custom project that you don’t intend to take apart.  And, when you’re talking about leaving a chunk of electronics in a project, it’s a lot easier to leave $9 in parts inside rather than a $30 Arduino board.

Here’s what I found to be the (near) least number of parts and (basically) the smallest configuration for the programming MintDuino:

The (almost) minimum you need to upload an Arduino sketch

The (almost) minimum you need to upload an Arduino sketch

This is the “almost” minimum since the configuration above includes (1) a red power indicator LED and a 220 Ohm resistor and (2) a red wire, another red LED, and another 220 Ohm resistor for running the “Blink” sketch.  Once you remove those parts, you could still upload a sketch to the Arduino – but it wouldn’t be able to do anything.  You’ll notice that this configuration doesn’t even include the usual reset button for the Arduino.4 It’s not pictured, but you’d also need a way to communicate with the Arduino, such as a USB cable plus FTDI Friend or FTDI cable.

Here’s what I found to be the (near) least number of parts and (basically) the smallest configuration for running a sketch on the MintDuino:

The (almost) minimum you need to run an Arduino sketch

The (almost) minimum you need to run an Arduino sketch

Again, I’m qualifying the statement with an “almost.”  This nearly minimum configuration above again includes a red wire, another red LED, and another 220 Ohm resistor for running the “Blink” sketch.  You could remove all of these parts and connect whatever else you wish the Arduino to do for you.  While the power LED indicator is useful to know that your project has power, I could see some situations where you wouldn’t want it – such as for a project that needs to work in the dark without drawing undue attention to itself.

Besides fiddling around yanking parts out of my MintDuino to see what would happen, I also found some interesting tidbits about building a minimum possible Arduino.  If your project is tight on space or you are tight on parts or budget, you might find some of the following useful:

I’m still very new to this whole Arduino thing, so if you notice something wrong here, please let me know so I can fix it.

My very next Arduino project is going to be something that fiddles with my television’s IR (infrared) control codes.  You can expect some definite wackiness soon…

Default Series Title
  1. Since I wanted to include a picture of the MintDuino inside and out, I couldn’t help putting a spin on this classic Groucho Marx quote. []
  2. I ended up using the Mintduino tin – and actually recycling some of its packaging into the project as well []
  3. What project am I referring to? Stay tuned… []
  4. I discuss this more below, but I don’t think you need the crystal and two capacitors for the “external clock” functions of the Arduino if all you’re doing is uploading a sketch. []

Arduino Adventures: What I learned building a MintDuino

A MintDuino

A MintDuino

My first real foray into tinkering with an Arduino began a few weeks ago with a MintDuino.  About two years ago I contemplated trying one out, but I never pulled the trigger.  This was due to a combination of decision paralysis, a very short attention span1 , and a plethora of other projects that were always vying for my2 attention.

Overall, I think this was a good place for me to start learning about Arduinos.3 The nifty thing about the assembly tutorial for the MintDuino is that it takes you slowly through the creation of an Arduino.  I learned a surprising amount from assembling this little breadboard Arduino – more so than I ever did by just making an LED blink on a regular Arduino Uno.

  • The first thing the tutorial does is show you how it converts the power from a 9 volt battery into the 5 volts that an Arduino would use.  I found this incredibly useful.  Even if I had stopped reading the tutorial at Step 7, I would have learned that with some capacitors and a “voltage regulator,” I could create a system for converting power from a 9 volt battery into something I could use in a different project.  Sure, I didn’t learn how these parts made that happen, but this was something I could put to use immediately, if I so chose.
  • The second thing the tutorial takes you through, at step 9, is adding a “crystal.”45  This wasn’t particularly useful to me – except that now I know how the Arduino is able to keep time.  While doing some ‘net research on what constitutes a bare-bones minimal Arduino, I discovered that it is possible to omit the crystal and two capacitors in favor of the chip’s internal clock.
  • The third thing I learned from this tutorial, at Step 12, is what appeared to be the bare minimum MintDuino setup required to run a program that was loaded onto the Arduino’s chip.6 Now, it’s possible to remove several more pieces and still have a working Arduino.  If you just had to have an Arduino with an absolute minimum of parts (I’ll get to why later) you could pull the red LED, the 220 Ohm resistor, the black wire going to the red LED.  The result would be a pretty minimal Arduino that didn’t have a status/power LED, but could blink a single green LED.  Remove the green LED, the red wire going to it, and the 220 Ohm resistor going to the green LED, and you have a really stripped down Arduino – that can’t do anything.  But, if you were to design your own Arduino project, you could build this minimalistic Arduino, add connections to whatever additional parts you needed, and solder it all together.
  • By the time I got to Step 17, I learned the connections to the ATmega328 necessary to program the chip with an Arduino program.7  This was interesting to me because it meant that any circuit that I wanted to design, but still have the capability of reprogramming at a later date, would have to have these connections.  However, it would probably easier to add a 28-pin socket or 28-pin ZIF socket to your project so you can remove the chip, reprogram it, and replace it without much fuss.  ((I mean, why add a bunch of wires you only need for reprogramming to a project when you can add a little socket?))

Overall, tinkering with a MintDuino taught me quite a lot about Arduinos.  Staring at an Arduino for the first time out of a box, it’s a little daunting.  There are a ton of little surface mount parts and pins and I had no idea where to start.  I had made an LED blink – but that didn’t seem to do much for me.

Having assembled a MintDuino, I already knew what a bunch of the parts already did – so I could focus on building on my knowledge from there. Having the breadboard handy meant it was easy to connect more wires and try out other sketches and configurations.  Lastly, I went back over my work from the first time I built the MintDuino and rewired it so that the little red, black and green wires didn’t have any slack.  This let me see better which wires when where – which meant I could concentrate on working with the other pins.

I mentioned earlier why I was interested in finding out the absolute minimum amount of parts necessary to operate an Arduino.  Well, more on this in the very next post…

Default Series Title
  1. Oh!  A squirrel! []
  2. Oooh!  A shiny! []
  3. I say “start” because my prior experience with Arduinos consisted of just putting shields on Arduinos and uploading sketches. []
  4. I don’t know why they call it a crystal – it just looks like a little bit of metal with two wires sticking out []
  5. I’m just kidding.  I’m guessing they’re using a quartz crystal – similar to quartz watches – as a timer/clock.  For those of you who aren’t familiar with quartz watches – they keep time by applying a little bit of electricity to a piece of quartz and counting the vibrations of the crystal. []
  6. The Arduino’s chip is called an ATmega328 []
  7. Or, in Arduino parlance, “sketch” []

Arduino Adventure Series – The Adventure Begins!

Arduinos, Arduinos, Arduinos... where to start?!

Arduinos, Arduinos, Arduinos… where to start?!

A few weeks ago I started fiddling with an Arduino in earnest.1 I’ve built things using Arduinos before, but each time all I did was slavishly follow a tutorial as it took me step by step through a process.

Just as a child memorizes the Pledge of Allegiance, committing to memory the right sounds in the right order, I had a grasp of the assembly – but not the underlying meaning.  Sure, I built a MakerBot Cupcake CNC (“Bender”), a MakerBot Thing-O-Matic (“Flexo”), an Egg-Bot, a Polargraph/PlotterBot, and an IoT Printer.  ((FYI, my MakerBot Replicator 1 is named “HedonismBot“))  However, I have only the dimmest understanding of how the things I did actually created the things I ended up building.

However, I want more – there are several ideas I would like to create using electronics.  One is a sonic screwdriver flashlight.  Another is device for … shall we say…2  interfering with television infrared codes.3

My goal for this series of posts4 is to document my triumphs and failures playing with an Arduino.  I think it’s time to get started on that next post now…

Default Series Title
  1. Photo courtesy of Arkadiusz Sikorski []
  2. Mu-ah-ha-ha!!! []
  3. Nope, not a TV-B-Gone []
  4. I know it’s ambitious to call a post the “first” post – but dammit, a man’s got to dream []

DrawBot – The Assembly, Part VII

Yesterday I accomplished a little more with my DrawBot.  Here’s what I did:

  1. Drilled holes in my project box1 for running mounting wires through the box.
  2. Drilled holes in my project box for the power cord and USB cable.
  3. I added several yards of monofilament line to each spool.  The way I have the motors mounted into the box I had to add some filament line to it on the spool.  Obviously, I had no way of knowing how much line I would need, so I just added a few feet.  Today I cut off several additional yards, tied the new section to the shorter section already attached to the spool2 , cut off the little loose ends, and rolled the spool with a finger.
  4. Found studs in the wall, put two huge screws into two studs3 for holding the box on the wall.
  5. Ran some sturdy steel wire through the box for mounting on the wall.
  6. Cut a huge sheet of cardboard out of a box we had in the garage.  I wrapped three edges of it in packing tape, so that it would remain flat and not shed little bits of cardboard paper.  The fourth edge I covered with duct tape for a sturdier hold.  This was then mounted on the wall underneath the pine box using more huge screws going through the side with the duct tape.  The purpose of this is to give the DrawBot a flat surface to draw on, rather than the textured wall.
  7. I then plugged the power cable and USB cables in and tried to fire up the Polargraph software.  Since this is all being done in a different room, I’m connecting all of this to a totally different laptop using different software.  I have an older laptop running Windows Vista that is connected to my Thing-O-Matic and Cupcake.  Now it is attached to my DrawBot as well.
  8. At this point the only physical components of the DrawBot missing are the gondola which I haven’t installed and blank paper.
  9. Unfortunately, that laptop I connected the DrawBot to is having some kind of problem communicating with the Arduino.  But, that’s another problem for another day.
Default Series Title
  1. A long pine box []
  2. Square knot []
  3. True story:  My wife heard the new electronic stud finder going all wacky from the family room.  She called back, “If it’s making that beeping noise, you’re doing something wrong.”  I replied, “Yeah, I’m just running it over my belly just to see what it will do.”  My daughter ran over in disbelief and then called back to my wife, “Mom!  Daddy’s rubbing the finder on his tummy!”  Say what you will, that damn thing is accurate. []

DrawBot – Halp!!! No – seriously, a little help?

Okay, I’m stuck.  I don’ t know what I’m doing wrong or what I need to do next.  So, I’m calling upon John Abella, Sandy Noble, and Kongorilla for your help.  :)

Here’s where I am:

  • The burning!
    • At last attempt, I hooked up some small steppers to the Adafruit motor shield, put the shield on my Arduino Uno, hooked up the USB cable and the 9v power adapter.
    • I heard a small pop and smelled warm electronics.1
  • After the burning
    • I can upload and run the Arduino basic blink sketch.  I can alter this to change the blinking pattern.
    • I can upload and run the Arduino sketches to operate a microservo.  I can alter this to change the microservo’s behavior.
    • I can upload the Adafruit sketches for steppers – but I can’t make the steppers move.
    • I can upload the Polargraph sketch – but I can’t make the steppers do anything.

Now, I’ve got tons of questions for you:

  1. Did I ruin my Arduino?  I can still run the blink and microservo sketches.
  2. Did I ruin my motor shield?  How can I tell if it is operational?  When I connect the power to the Arduino and have the little jumper in place, the green LED is lit up.
  3. What am I doing wrong?
  4. What should I try next?
  5. How should I diagnose a problem?
Default Series Title
  1. Now I’ve got a cold and couldn’t smell anything if I wanted []

DrawBot – The Assembly, Part II

Now that all the parts have arrived, I’ve finished soldering the Adafruit Motor Shield, it’s time to figure out what the hell I’m doing.

  1. The Parts
    1. 9 VDC 1000mA regulated switching power adapter – UL listed 
    2. Stepper motor – 200 steps/rev, 12V 350mA
    3. Micro servo
    4. Arduino Uno R3 (Atmega328 – assembled)
    5. Adafruit Motor/Stepper/Servo Shield for Arduino Kit v1.0
  2. Assembly
    1. Adafruit soldering and assembly instructions for the Adafruit Motor Shield
      1. Hint:  Don’t try to put the L293D into the 16-pin sockets before you solder the socket into place.
      2. Hint:  While preparing to solder the header pins into the motor shield, I found that the motor shield would not sit flat on the Arduino Uno because the leads from the motor shield’s reset button were in the way.  I crimped the leads slightly and then motor shield sat flat.
    2. Download and read the Polargraph Instructions
      1. Polargraph build instructions on Instructables
      2. Latest Polargraph Build Instructions circa 11/28/2011
      3. Polargraph Instructions circa 10/20/2010
      4. Polargraph Instructions circa 10/9/2010
    3. Install the Processing environment
      1. Processing environment download page
      2. It’s necessary to run the Polargraph controller software
    4. Update the Arduino Uno’s firmware
      1. Go to Arduino.cc and download the latest software (Version 1.0 is 85.9MB for Windows)
        1. The latest version of Sandy Noble’s Polargraph software requires the Arduino 1.0 firmware
      2. Install the Arduino drivers123
        1. Plug in your board and wait for Windows to begin it’s driver installation process.  After a few moments, the process will fail, despite its best efforts
        2. Click on the Start Menu, and open up the Control Panel.
        3. While in the Control Panel, navigate to System and Security. Next, click on System. Once the System window is up, open the Device Manager.
        4. Look under Ports (COM & LPT). Â You should see an open port named “Arduino UNO (COMxx)”
        5. Right click on the “Arduino UNO (COmxx)” port and choose the “Update Driver Software” option.
        6. Next, choose the “Browse my computer for Driver software” option.
        7. Finally, navigate to and select the Uno’s driver file, named “ArduinoUNO.inf”, located in the “Drivers” folder of the Arduino Software download (not the “FTDI USB Drivers” sub-directory).
        8. Windows will finish up the driver installation from there.
      3. OMG!  I just made an LED blink!
        1. I followed up this incredible success by adjusting the amount of time the LED spent off and on.  It was pretty cool. 4
    5. Download Sandy Noble’s Polargraph Controller v2.0
      1. Download the Windows binaries or
      2. Download the source code and compile them for yourself
    6. Download the AccelStepper Arduino Library
      1. Direct download
    7. Download the Adafruit Motor Shield Arduino Library
      1. Direct download
      2. When I tried to drop this library into the “arduino-1.0/libraries/” subfolder, the Arduino IDE freaked out.  I had to rename the library sub-folder from “adafruit-Adafruit-Motor-Shield-library-dd30da7” to “AdafruitMotorShieldLibrary” since the IDE would not recognize a library with spaces, dashes, etc.
    8. Um… now what?
      1. As I’ve mentioned, I really have no clue what I’m doing here.  I’m mostly just banged away at the motor shield with a hot soldering iron, jammed it onto an Arduino…  and don’t know what to do next!  Halp?
Default Series Title
  1. This was written for Windows XP, Vista, and 7, there’s also guides for Mac OS X and Linux []
  2. I’ve just copied and pasted this info here for completeness. []
  3. MacOSX []
  4. Arduinos can be used for MORE than this, you say?!  Tell me more! []

DrawBot – The Software, Part I (and an existential conversation)

This morning the USPS website told me that the remaining parts from Adafruit left Oakland yesterday.  As of this moment, they should be sitting at my local Post Office… but not go out for delivery until tomorrow as today is a postal holiday.1  In any case, I just realized that a DrawBot based on Sandy Noble’s Polargraph will require some basic knowledge of Processing.  I guess I better get learning!

Default Series Title
    • My current self [CS] would like to point out to my past self [PS] that if you had only placed the order one day earlier, you’d probably have had all the parts this weekend to work on.  Heck you could even have been done by now.
    • PS would counter, first, that I couldn’t have ordered all of the parts necessary without having first sought some input from people who have done this before me.  And, second…
    • CS would interrupt saying, “Hey PS, what happened to you, man?  You used to be so cool!  What you were afraid of?  Burning a chip or some damn thing?  That’s how you learn!  Buy a helmet!  In any case, people have built these things out of complete junk before!  Where is your sense of adventure?!”
    • PS would remind CS it is not polite to interrupt, “And, secondly, as I was saying, there’s no point in not making use of the various resources available to one.  It would be brash and foolhardy to simply jump in not knowing what the heck you/we were doing.  And, thirdly, in the fullness of time, I think you’ll come to understand that a few day’s delay in assembling a robot is but a blink of the eye in comparison to the time you’ll spend assembling, tuning, and operating said robot.”
    • CS, “Really?  ‘Fullness of time’?  Seriously, man, who talks like that?  I suppose the delay is not such a big deal, but the momentum one has when tackling a project is not an inconsequential concern.  I don’t know about you, but I have the attention span of a gnat.  <Oh!  Shiny!>  It is entirely possible that by the time the final parts arrive, in less than 24 hours, I may have moved on to some new project.”
    • PS, “Momentum, schmomentum.  You might move on to a new project?  Do you realize that you’ve got 16 posts on your site yammering on about this project – when all you have so far is one half-assembled circuit board?  No, you’re going to have to do better than that.  Besides, if you had simply moved to Brooklyn already like I told you, none of this would have been an issue.  You could have just walked over to Adafruit and picked up all the parts you required.”
    • CS, “Move to Brooklyn?  That’s your answer?  I live in the Bay Area, as in ‘California.’  Chances are work is going to have me driving down to Silicon Valley at some point this week anyhow.  And you want me to move to Brooklyn over $100 in parts?”
    • PS, “Well, it looks like you just admitted that this project wasn’t important enough for you to conjure up an excuse to drive to San Jose or Palo Alto.  You didn’t even try to visit a Radio Shack or a Fry’s.  Hell, the time you’ve spent griping about the delays you’ve caused yourself would have been enough for you to drive down to an electronics store and pick up the parts.”
    • CS, “Yeah, at a 50% markup?  Right.  Good plan!”
    • PS, “Okay, which is it?  Did you want the cheapest result or the fastest?  Having chosen an economical middle ground, it seems somewhat silly to blame me that the parts didn’t arrive as fast as fast can be.”
    • CS, “Shut up.”
    • PS, “No, you shut up.”

    []

DrawBots for the slow learner

Today I bugged several people far more knowledgeable than I about Arduinos, drawbots, steppers, servos, and power supplies.  Here’s what I’ve learned:

Having just salvaged a bunch of parts from some old electronics this weekend, I think I’m ready to pull the trigger and start building this bad boy.  :)

Yay for learning!

Default Series Title

Wanna make a DrawBot?

So, I wanna make a drawbot.  While there are any number of draw-bots and art-bots out there, the kind I would really like to make is the kind that suspends a pen or a pen in a carriage on a wall by two wires or cords that are reeled in and out in order to allow the pen to draw across a large sheet of paper hung on a wall.  The Der Kritzler, in the video below, is an example of the most recently updated of such projects:

Another great reason to point out the Der Kritzler is that it links to so many other similar resources.  The other links below are for similar well documented projects.

The last one is just a graffiti/painter robot that paints on far off walls by shooting a paintball gun at the surface.  It’s really quite awesome.  Since several of these people have already actually built drawbots, I’m thinking there must be a reason for not using simpler/cheaper methods for construction.

When I conceive of such a device, I think that the kind I would want would not even need a pen lift, since it would draw in a TSP / traveling salesman problem single-line-art format.  The basic common setup is to have two stepper motor, one controlling each string or, as in the case of the Der Kritzler, two toothed belts.  However, why wouldn’t someone just use a reel of fishing line, nylon cord, or whatever that is reeled in and out on a spool that is directly connected to the stepper?

Anyhow, it would seem that the project would require an Arduino, two stepper controllers, two stepper motors, a servo motor if pen lifts are required, string, and a bunch of parts that could be printed such as pulleys, gears, carriages, mounts, etc.  Now the only thing I have to overcome is my total and complete ignorance when it comes to connecting an Arduino to anything and then, you know, programming it.  :)

Sooo…  Is this a project that interests you?  Or is this a project that holds no interest for you, but the idea of helping with a project interests you?  Where should I begin?  (I’m guessing buying an Arduino…)

Default Series Title