PrintSnap Instant Camera

Electrical Design Rev 1

Both the camera and the printer operate over TTL serial UART which was great considering that the STM32F105 has multiple UART ports available.  All my circuit really has to do is connect both of these components to the micro-controller, power them, monitor the battery, and offer a few bits of user interface like a button and LED.

My original schematic looked like this:

I was a little nervous about managing power for a 7.4V battery.  Getting a micro controller  to go to low power sleep mode is easy, but when the micro controller is powered through some kind of voltage step-down, managing quiescents from the power stages becomes a little problematic.  I instead opted to give the device a big honkin' toggle power switch which connects to J2.

When in the "on" position, this switch connects the battery to the micro controller and other components.  When "off" the battery is connected to the charge circuitry.  When the charger isn't powered, it will draw a small amount of current backwards from the battery according to the data sheet, but it's such a small amount that it probably won't have real affect on a 3000mAh cell.  If the device is stored for a long period of time and the battery does discharge substantially, the integrated protection circuitry should prevent any permanent harm.

I originally wanted this guy to be USB powered, but the complication of boosting 5V up to 9V minimum to then feed into the charger made a 12V DC wall-wart much more attractive.  When connected, this 12V input powers the charger as well as the main circuit through a diode power OR.  This allows the micro controller to monitor charge status and provide feedback to the user. I also included a pair of voltage dividers on the battery rail and 12V rail that allow the processor to safely detect which are connected.

My first pass at this design used a linear charge management circuit, but after realizing that I'd probably be using a wood enclosure, I started getting visions of smoke forming as the case struggles to dissipate the wost-case 6 watts of heat produced.  Instead, I used the LT3650 which is a much more efficient switchmode device. A later thermal test indicated that the temperature inside the case rarely got above a balmy 101F while charging at 340mA.

That being said...I probably should have utilized the thermocouple hookup for the LTC3650, but...oh well.

Unsure of how big the camera and printer standby currents would be, I included PFETs that let me shut them off when they're not needed. It's good I did that too because the camera draws a whopping 50mA even when it isn't taking a picture. I also included some gigantic bypass caps for the printer which is sure to have some wildly fluctuating current draws. To power these, I used a simple inrush current limiter similar to what I built for the Gutenberg Clock demo to prevent the large capacitors from drawing too much from my power rail on startup.

Finally, I needed a way to measure the battery voltage. This is a little tricky with an 7.4V battery. Normally, I would use a voltage divider to drop the battery voltage down to something safe, but this would present a constant load which would reduce the battery's lifespan.

The second option is to connect an NFET to the low side of this divider to disconnect the load when not in use. This brings up another issue because with no current flowing through the divider, the output will rise up above the tolerance of the micro controller pin and damage it:

One solution that solves both of these problems is to supply power to the voltage divider from the high side using a PFET.  In order to turn the PFET off though, you need to pull its gate up to match its source which in this case is 7.4V.  To do that, you need a pull up resistor.  You can't connect this pull up resistor to your processor line though, so an NFET is required on the low side to protect the processor:

While this solution is perfectly fine, it's actually more complicated than it needs to be. NFETs typically have their sources connected to ground.  This is to ensure that whatever is driving their gates can raise the gate voltage up high enough above the source to turn the NFET on.

If you're clever though, you can put a small resistor between the NFET and ground and use that resistor to measure current passing through the FET.  As long as the voltage drop across the resistor plus the V of the NFET is less than what you can supply to the gate, it should work just like the second example above:

When the NFET is off, the 1k resistor pulls the output to ground, and the 15k resistor pulls the drain up to 7.4V.  No current flows from the battery.  When the gate voltage is raised up to 3.3V (GPIO level of the processor), the NFET turns on and the Drain-Source voltage drops close to zero.  About 460A will flow through the resistor divider which will raise the drop across the 1k resistor to 0.46V.  This voltage will be proportional to the battery voltage which will allow the processor to safely measure the battery's state of charge.

Issues with Rev 1

Given the tricky 64 pin package of my STM32, I opted to get these boards made at SeeedStudio.  As you can see from the image below, there were some...issues:
The first and most important issue is that the date on the silkscreen reads 9-17-14.  I temporarily forgot that October, my birth month, is in fact the 10th month of the year, and so it looks like I've had these boards for a month longer than I really have.

Connectors

Seriously though, there were a bunch of really annoying errors starting with the connectors.  The thermal printer I chose came with a set of cables that used a particular type of connector.  After hunting around and looking at images on Digikey, I finally identified them as JST type connectors.  I later discovered that JST connectors are something of an industry standard. They're incredibly cheap, and they come in a large variety of pin numbers.  They sure are a lot nicer than the crap I used in the Gutenberg Clock:

I opted to use them for the rest of my design connecting all of the other components like the button and switch to the PCB.

The data sheet for these connectors has no recommended footprint, so I had to make my own using the 0.64mm pin width as a reference.

When I designed the library part for these connectors, I made the holes 0.7mm in diameter figuring that would give me enough space.  I failed to account for the fact that these pins are square, so while the sides are all 0.64mm, the hypotenuse is about 0.9mm.  There's a great "a mathematician, a physicist, and an engineer" joke to be made here.  This problem was immediately obvious and incredibly infuriating.  Although I could sort of surface mount the tips of the pins into their holes, it was extremely easy to tear them out by accident especially considering the high retention force of JST connectors. For some components I just gave up and soldered directly to the PCB.

Processor

Given that I was diving into unfamiliar territory with designing a PCB for a processor I had never used, I was understandably concerned when it didn't immediately start up.

The first problem was that the pin 1 designation on the package isn't very obvious.  The mark is comprised of a small circular divot in the corner near pin 1, but in the opposite corner is another divot that is likely a result of where the plastic was injected into the mold during manufacturing.  These circles look very similar.

The datasheet didn't offer much help here.  I finally figured it out after probing the pins of the part to verify that what I thought were ground pins all had internal connectivity.  I got it wrong the first time, so I had to desolder and rotate the part around.

That wasn't the only problem though. Even after replacing the part with a fresh new one in the correct orientation, I didn't get any communication through the debugger.  I started working my way around the part to see if I had anything connected wrong, but everything looked right.  I even went as far as to replace my Discovery board debugger with a proper dedicated USB dongle.

Finally, I realized that I had VDDA configured incorrectly.  As you might expect, VDDA is an analog voltage source.  When I designed my schematic, I was thinking of AREF from the AVR.  AREF is an external connection to the analog voltage reference.  Through software commands, this can connect to a number of things including VCC and the 1.1V internal reference.  It only has external access to allow you to decouple it with an external capacitor.

In a recent project, I had connected this pin to VCC and ran into problems when I tried to set the pin to the 1.1V reference.  When I was laying out this camera schematic, I decided to keep VDDA disconnected from the power rail and just decouple it with a cap.

Well as it turns out, VDDA on the STM32F105 is not only used to power the ADC.  It also powers the PLL and the reset circuit:

Perhaps I should have paid attention to this note:

With that reworked, my debugger instantly started working.  I still had trouble for another day or so getting my debug LED to do anything intelligent, but after closer investigation, I found that that processor pin connected to the LED had been damaged at some point and wasn't able to source or sink any current while other pins had no such trouble.  In fact, I actually never got it to work even on the second revision.  Not sure what the deal is with PA15.  The data sheet didn't offer much.

I definitely did find it weird that my debugger was indicating that code was running while nothing outside the debugger was doing anything intelligent, and I couldn't shake the feeling that gremlins were messing with my design and causing strange and unexplainable behavior.  Here I was, drifting further and further away from assembly code and things were making less and less sense.  This feeling followed me to another problem.

The Discovery board didn't have any hardware to control power going to the camera module, so I had to add code to accommodate my new board.  What I found is that the debugger glitched out every time I switched on the camera.  Things would run fine until it just suddenly lost the connection to the device.  I didn't trust my debugger set up very much at this point, so it took me longer than usual to point the probe at my own circuit.

The power rail looked like this:

Yikes!

Tantalum capacitors can be made much smaller than electrolytic or ceramic capacitors, so I didn't even think to check what kind of bypass capacitance was built into the camera module.

That little yellow guy is 100F of capacitance! When switching on camera power, I was connecting a huge totally dead capacitor to my 3.3V power rail which drew an incredible amount of current and caused my rail to sag.  I estimate somewhere around 3.5A based on the waveform.  The bottom tip of that sag is very close to 1.8V which is right where the processor will cease to function.  This makes it pretty clear that the processor was browning out just enough to mess up the debugger connection.

Adding an inrush current limiter fixed this problem:

Though the rail still sags, it's much better than it was, and the part started behaving normally.

I think this is the first time bypass caps have actually been the problem, and not the solution.

Sourcing

The last major problem I had was definitely a new one.  The 8.4V battery charger I used comes in a variety of packages and voltages.  I originally opted to use the MSOP package as it was easier to work with than the no-lead options, and I had plenty of board space anyway.

After I assembled my board, I noticed that the battery charger wasn't pumping any current into the battery.  When I disconnected the battery, the charger provided an open-circuit voltage of exactly 4.2V.  I had accidentally ordered the 4.2V version!

No problem, just a quick Digikey order, and...

Uh oh... No matter where I looked, nobody had this part in stock.  It's a real bummer when you know something will work and you just can't get your hands on it.  It's a problem that I certainly haven't come across before in my projects.

In writing this article, I noticed that Digikey does now have the part in stock under a slightly different part number.  I'm going to assume this is a recent development because I couldn't find a source for the life of me when I was assembling the board, and I ended up moving to the smaller DFN package for my second build.

Besides that, there were just a few alterations to part footprints to make them fit better, and I was off to PCB V1.1!

Electrical design Rev 2

By the time I made this second revision, I had already been writing software on the first revision for a number of weeks. I had a chance to test out all of the systems, so there was almost nothing wrong with this board.

The one mistake I did make was with my capacitor selection on the 12V rail.
Many of the capacitors in my parts library were made a long time ago when I was working on very simple circuits, so I never went through the effort of specifying the voltage rating of the components. I just picked 10V caps that were "good enough" for everything I was doing.

As a result, many of the caps in Rev 2 are not rated for 12V.  I'll have to go back through my library and make a different part for higher voltage rails. For the time being, I just stuffed different caps that I had on hand.

Table of Contents

123 thoughts on “PrintSnap Instant Camera

  1. Pingback: Towards More Interesting Instant Cameras | Hackaday

  2. Pingback: Towards More Interesting Instant Cameras - Tech key | Techzone | Tech data

  3. Pingback: Towards More Interesting Instant Cameras | Ad Pub

  4. Pingback: Towards More Interesting Instant Cameras | Hack The Planet

  5. Pingback: Towards More Interesting Instant Cameras | 0-HACK

  6. Thoughts about heading toward a KS project:

    1. Separate the battery/charger from the camera/printer: Support attached and/or detached/cabled power, with standard LiPO standard and the option of a pack with replaceable/rechargeable NiMH cells (dirt cheap). Then, also offer the camera without a battery pack (DIY power is relatively easy if the interface is simple).

    2. Personally, I'd want a clear case with all the internals visible, using standoffs and 3D-printed brackets where needed. Hopefully, this would also be the simplest/cheapest case.

    3. Kit the custom parts and include a simple "no-solder" BOM for the rest. This permits a "partial gift" for the makers among us. And I certainly don't mind giving Adafruit some business, especially if a small discount can be negotiated for this project's BOM.

    I think the above can provide a wider range of KS options and price levels with (hopefully) relatively little change to the core device.

  7. Pingback: PrintSnap Wants to Bring Back the Instant Picture Using Dirt Cheap Receipt Paper

    • Yep, I'm well aware of that problem. I wash my hands compulsively anyway, and I'm sure someone will come around with a BPA-free option soon in response to public outcry. The same thing happened with Nalgene and leaded gasoline.

  8. Pingback: PrintSnap Wants to Bring Back the Instant Picture Using Dirt Cheap Receipt Paper - news from Allwebsolutions.net

  9. Pingback: l’appareil photo instantanée le plus économique | news-apple

  10. Hi Ch00f,

    Your PA15 pin isn't busted; the problem is that it is by default mapped as a JTAG debug pin and not to the GPIO block. In the device datasheet (the 100-page thing, NOT the 1000-page reference manual), there will be a "pin definitions" table near the front containing pin numbers for all the different package options, pin names ("PA15"), pin-types ("I/O") and 5V-tolerance ("FT"), a "Main Function" column (this is the important part) and "Alternate Function" columns.

    Note that for most GPIOs, the Main Function is GPIO, i.e. at power-on, PC12 is PC12, etc. However at power-on, PA15 is JTDI (jtag data in). This is necessary so that JTAG can start talking to a device when it boots. If you're using SWD (and it seems you are) and want to make use of the PA15 pin, you need to disable the JTAG peripheral and its pin remapping.

    Note that if you don't want to be able to debug or maybe ever load code into the device again, you could also free up PA13 and PA14 which are the SWD pins.

    Email me if you get stuck and I can send you the specific line of code you need; I just don't have it here right now.

    (I found this one out the hard way while playing with an stm32; I wasted a good 4 hours figuring it out)

    • THANK YOU

      I figured it was something like that. I mentioned that part specifically hoping someone would figure it out for me.

      Thanks for the tip!

  11. Pingback: Prints for less than penny

  12. Pingback: PrintSnap: A Home-Built Camera That Prints on Receipt Paper (and Almost for Free)

  13. Pingback: The Quirky PrintSnap Instant Camera Let's You Create Instant Prints On The Cheap - DIY Photography

  14. You are a silly man with silly ideas. As soon as I started the video I thought, "Why is he recreating the GameBoy Camera/Printer?" Your presentation was mockingly beautiful. It's good to see your personal projects continue to be so whimsical.

  15. What's nice about the Cortex series is that some of the "peripherals" are standardized by ARM, so no matter the manufacturer, they'll all behave the same. SysTick, FPU, NVIC, etc.

    To enable the FPU, google "cortex m4 enable fpu" and you'll find the following asm to do so (basically setting a couple bits to turn on the coprocessors in the coprocessor access control register):

    ; CPACR is located at address 0xE000ED88
    LDR.W R0, =0xE000ED88
    ; Read CPACR
    LDR R1, [R0]
    ; Set bits 20-23 to enable CP10 and CP11 coprocessors
    ORR R1, R1, #(0xF << 20)
    ; Write back the modified value to the CPACR
    STR R1, [R0]

    I'm actually working on a project right now using a thermal print head, but rather than an all-in-one module like you have, I am using discrete components: a solenoid to push a kyocera print head onto the paper and a stepper motor to drive the paper through. I can print a 1450x672 px image in 3-5 seconds. In my case, going faster actually improves the quality of the print because the print head stays warm.

  16. Pingback: PrintSnap: eine Sofortbildkamera, die Thermopapier statt PolaroidInstant-Film verwendet | Foto[gen]erell

  17. I like this idea, the camera itself is sound for a version 1.0 project. To make it "sellable" you should consider a different housing altogether to make it look like an old school camera. Two ideas I thought are a TLR (like a Rollei) where the user looks down at a mirror to compose the image through a lens, while the camera is in a lens just below it, and the printer goes out the side. Another is a Brownie box camera style with an offset finder and the camera in a central front port. Either way something that looks like an old school film camera from a few feet away would be a winner.

  18. Pingback: Una cámara DIY instantánea

  19. Pingback: Una cámara DIY que hace fotografías instantáneas mas baratas que una Polaroid | Android 3G

  20. Pingback: PrintSnap:用小票做相纸的黑白拍立得相机 | 趣火星

  21. Pingback: PrintSnap Kamera Cetak Instan - Titikfokus

  22. Pingback: Instant Camera Uses Receipt Rolls For Printing Paper - PSFK

  23. Pingback: Instant Camera Uses Receipt Rolls For Printing Paper * The New World

  24. Pingback: This instant camera will print images on a receipt paper roll - Berbit.net

  25. This is fantastic! You basically made a spiritual successor to the King Jim Da Vinci DV55. I really want to see this becoming a real product and hope you go with Kickstarter on this project!

  26. Pingback: This instant camera will print images on a receipt paper roll * The New World

  27. Pingback: This instant camera will print images on a receipt paper roll | xoneta.com - majalah online gadget, komputer dan teknologi terbaru

  28. Pingback: PrintSnap, una cámara instantánea con la que imprimir fotografías en el papel de los tickets

  29. Pingback: PrintSnap, una cámara instantánea con la que imprimir fotografías en el papel de los tickets | Fravala.com - Las noticias de tecnología a tu alcance.

  30. Pingback: PrintSnap, una cámara instantánea con la que imprimir fotografías en el papel de los tickets - QuickIdeas

  31. Pingback: PrintSnap, câmera instantânea para imprimir fotos em papel de tickets

  32. Pingback: PrintSnap, una cámara instantánea con la que imprimir fotografías en el papel de los tickets • 25 noticias

  33. Pingback: PrintSnap, a camera which prints the photo instantly | Minionvilla

  34. Pingback: PrintSnap: an Instant Camera, which uses Receipt Paper instead of Polaroid/Instant Film |

  35. Pingback: PrintSnap – レシートの感熱紙にプリントできるインスタントカメラ | トイカメラ。【トイカメラとトイデジの情報】

  36. Pingback: PrintSnap is a Lo-Fi Polaroid that Uses Thermal Printing | Digital Trends

  37. Pingback: PrintSnap instant camera concept uses receipt paper for low-cost solution - news from Allwebsolutions.net

  38. Pingback: PrintSnap instant camera concept uses receipt paper for low-cost solution | TechnoTwitts | TechZone | Technology Updates | Gadgets Reviews

  39. Pingback: PrintSnap instunt camera concep uses receipt pap'r fer loe-cost solushun zano mini drone | T'Redneck Revue

  40. It is a great idea. This would be a great present for my 8 years old daughter who loves to take pictures. PLease make it at an acceptable price for normal people.
    Thanks

  41. Pingback: PrintSnap Instant Camera

  42. Pingback: La “Polaroid” più economica di sempre, funziona con gli scontrini (foto)

  43. this would be a hit on kickstarter, its totally geared towards the 20-30 something year old, new and upcoming product loving, crowd that kickstarter brings in. where are you based out of?

  44. Hi ch00f!

    We really like your "PrintSnap Instant Camera" project and want to cover it on EEWeb.com for our readers.

    EEWeb.com is an online resource community site for Electrical Engineers and I'm sure that your project will be a great addition as an entry on our webpage.

    Would it be ok, if we write an article about your project and include some pictures and other relevant materials?

    We will give you credit for the project and link back to your site so our readers can learn more about you.

    Hope to hear from you soon.

    Regards,

    Tin

  45. Pingback: Instant Camera, Instant Receipt Paper Pictures / Receipt Rolls Blog

  46. It could be really nice if you can use your code to create something like an app for smartphone who can automatically dither the photo you take and send it to a bluetooth thermal printer !

  47. Pingback: Actualidad: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi | Compu Vigilancia

  48. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi | Nuevo Titulo |

  49. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi | TecnologiaDigital

  50. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi | Ceo Bolivia

  51. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi - TodoMovil

  52. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi - InformeGeek

  53. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi

  54. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi - ChatNews

  55. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi - FM Centro

  56. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi - Point Fusion

  57. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi | Noticias: TecnoAR - Agencia Diseño Grafico & Web

  58. Pingback: PolaPi es un fantástico homenaje a las Polaroid y está basada en una Raspberry Pi | Dellthus – Noticias

  59. Pingback: Electrolytic capacitors and preserving a family heirloom | ch00ftech Industries

  60. Pingback: Las maravillas de Raspberry Pi! – Tara2

  61. Pingback: Animated EVSE | ch00ftech Industries

Leave a Reply

Your email address will not be published.