• Rethinking form factors

    zokier03/11/2018 at 21:10 0 comments

    While fuzzing with the PCB layout, I also thought bit about the form factor, especially if the dongle-style I was going for is really good solution. While it is pretty neat to have it in a compact package that you can just stick in (like those modern 3G/4G USB modems) without needing to have cables and such, there are several downsides too. One of the biggest problems what I hadn't been thinking originally is the need for external power. A battery is not going to fit into a dongle form factor, no matter what. Another 200LX specific issue is that the "ground clearance" for the serial port is not very great, maybe less than 5mm. My board designs are loaded on both sides (to get the small size), so while I think they'll still fit, it will be pretty tight and designing any sort enclosure will be a challenge. More generic problem is that dongles are kinda fragile and might end up damaging the host port if knocked off because they are all rigid and sticking out in a perilous way. Finally even a reasonably small dongle will feel pretty big when sticking out from 200LX, just because the device itself is so much smaller in comparison to typical laptop which such dongle might be attached to.

    So what I'm going to do? Not sure at this point. One idea I had was that I could form a wire mounting clip and hang the module with it on the screen bezel at the back side. It would not address the battery issue at all, but could be otherwise kinda neat way make the whole setup more mobile.

    Another more obvious idea is just to put the module in a external box. I could then fit a small lipo cell in there too, so that would solve my battery problems. The also obvious downside being that I'll lose a lot of portability if I have handle a separate box around. On the other hand, external modems are very retro and I could design a fancy custom 3D-printed enclosure that both evokes old classic modems and matches the 200LX design, kinda same way like some of the adorable SD-card floppy disk emulators I've seen:

    While all this pondering does not necessarily affect the PCB design all that much, one thing I do need to decide is what sort of mounting holes (if any) I will be adding. For a bare dongle there isn't really need for those, and as such I hadn't planned for them either (whoops..). But if I want to make any sort of enclosure then I most likely will need some holes. Problem being of course that the board currently doesn't really have all that much extra space as such, and I'm not sure if PCB fabs are happy with this sort of things:

    I'll have to check if that is ok. For reference, that's 2.7mm hole from KiCAD library for M2.5 screw, which is pretty much the only thing that possibly could fit in (I guess?).

    Of course I could redesign the whole board for specifically enclosure in mind, that would probably allow me to make the board bit bigger (if the battery sits on top of the board), and that way I might be able to do it in 2 layers (current design is for 4 layers, which is slightly extravagant) and single-sided assembly which would make life easier.

  • ESP module layout rev 1

    zokier03/10/2018 at 22:32 0 comments

    Saturday well spent. Now I have all components in, nets routed, and passing DRC.



    Still needs some tweaking. At minimum the silkscreen needs to be improved. But I'm generally pretty happy how this turned out so far, especially how everything mostly fit to the size I wanted even if it was completely arbitrary. I might even be able to shave a mm or two from the width.

  • Layout time!

    zokier03/09/2018 at 22:18 0 comments

    Yay!

    That 680u cap might be slight overkill for ESP. On the other hand, ESP is said to have very spiky power consumption, so I'll want some chunky cap there.

    The prettiness of the KiCAD 3D-view makes me want to model all the parts, just for making pretty pictures. Probably won't be doing that, but it would be nice.

    The reset switch placement is not ideal, but I feel like it is pretty much the only available space for it. It might be feasible to swap it with flash toggle switch, have to think about it.

    Whole layout is still bit of a mess, I just threw the components in, so yeah, very much WIP.

  • Connectors and buttons

    zokier03/07/2018 at 21:20 0 comments

    I was just getting the rest of the footprints set up and that also involved selecting what sort of connectors and buttons do I want. I hadn't really been thinking those before and of course its another rabbit hole again. 

    First the simpler one; switches. Most ESP devboards I had seen did feature a pushbutton for entering programming mode, that you are supposed to hold down on boot. I began to think that maybe having a slide/dip switch would make more sense, you wouldn't need to fiddle with holding buttons down as much. Continuing on that trail of thought led me to the idea that using SPDT switch (instead of simple SPST) would allow me to remove the pull-up resistor from the pin; the switch would always connect the pin solidly to either Vcc or GND, so no floating around. That's nice win, especially as I'm not 100% confident that my great idea of minimizing BOM and using same 249k resistors would actually work that great as pull-ups as they are bit high valued. The downside of using slide switches here is that now I need to order two different types of switches, pushbuttons (or tactiles) for reset and slides (or dip) for programming. I think the tradeoff is worth it.

    The power connector is another issue. I had been thinking just using "some generic power connector", but of course there is no such thing as standard common generic power connector. I could put in 0.1" headers in, but those are not really ideal as connectors and they are kinda bulky too. Quickly googling around people seem to be using among others Molex PicoBlades, whole variety of JST connectors, and I also saw some Hirose DF series ones. They all seem pretty much the same to me. I suppose JSTs are most common (?), but there are also like 10 different varieties so that's not all that helpful. I probably will go that route anyways, but I'll need to do bit more research still.

    These are the things that are keeping me awake at nights now. And I was naively thinking I would be getting to PCB layout anytime soon..

  • RS-232 is weird

    zokier03/02/2018 at 20:42 1 comment

    • DB-25. Why on earth does simple serial port need 25 pin connector? Of course almost everyone in the real world uses DE-9 (don't dare to make the mistake of calling it DB-9..) instead, which makes double fun when trying to figure out if the "pin X" refers the pin on 25 or 9 pin connector.
    • DE-9. Do we really need even 9 pins? Afaik people these days are happily doing serial with just three pins (Rx/Tx/Gnd).
    • Asymmetrical pin assignment. 5 of those 9 pins are to one direction and 3 to the other. While that might have made sense in the original use as PC-Modem interconnect, it feels bit awkward for anything else.
    • 30 V voltage swing. For something designed for connecting a modem to your computer. Overkill anyone? Sure it might be nice for some industrial uses, but how did that end up in the general spec?
    • Terminology fixed on modem use case. So now everyone needs to deal with (or rather ignore) stuff like "ring indicator" or "carrier detect", even if those make little to no sense in most applications
    • Null modem cables. Because of the aforementioned asymmetry, connecting two computers together with serial is a huge hack, you need to do some sort of cross-over configuration and fake the "missing" signals.
    • Incompatible null modem cables. As far as I can tell, there are at least three major types of null modems (no/partial/full flow control), which are at least partially software incompatible with each other. So you need to pick the cable depending on what application you are running.
    • Flow control. Hinted above, but you can do flow-control in "hardware" (out of band/separate pins) or "software" (in band/control characters). If you ever wondered what some of those ASCII control characters are used for, this is it. Why exactly they are specified in ASCII, rather than in RS232 or something, god (or IBM, which I suppose is practically the same thing) only knows. What if you actually want to send 0x13 over the line? Haven't figured that out yet (and hopefully never will need to..).
    • stty. I do not look forward to the day I get to software bits and need to use stty. Of course serial ports on unixen are bound to the terminal subsystem, instead of being, idk, general IO devices. So you got tons of archaic options you can set on your "terminal" device (i.e. serial port). This is one of the few cases where Windows actually makes bit more sense. Maybe.
    • 9600,8,N,1 and friends. If you have gotten this far, you can guess there are tons of different ways of using RS-232, so you need to know/guess the parameters when setting the connection up. Having the standard actually standardize those would have been too much to as I suppose. Or include way of indicating/negotiating the configuration.
    • Modern software stacks. You might think that with the history and ubiquity of RS-232, using it on a PC would be piece of cake. You'd be wrong, very wrong. Depending on what serial port controller you have, you will need to download some driver that ranges from a shady unsigned kernel blob to ones that brick your hardware. How the heck there is not one standard built-in driver for USB RS-232 dongles, like there is for everything else. Apparently there actually is standard USB device class ("CDC") for this sort of thing, but for some reason that is not enough

    In unrelated news, I need to do minor redesign of the ESP module because I have a 5/3 level shifter on it instead of 3/5 one. Of course the USB module will still have 5/3 because it represents DTE, whereas ESP is DCE. And I will be needing to make few null modems, gender changers and straight cables to make everything work.

    In retrospect, I probably should edit the list a bit considering how the items grew in length towards the end. But eh, its a rant anyways. And I didn't even get to the higher level software things (XMODEM, SLIP, PPP, Kermit, oh my..). Or AT commands, which are another layer of weirdness.

  • Power protection

    zokier02/23/2018 at 23:01 0 comments

    Quick note on power rail protection. LTC4365 (pdf, digikey) seems nice little device for protecting things; it does under- and over-voltage, and reverse polarity protection. It is bit pricey though, but if that avoids setting things on fire then I think its still worth it. Needs to be paired with dual MOSFET, digikey has plenty of options available. DMG9926 (pdf, digikey) was one of the cheapest. Some never-heard company "Taiwan Semiconductor" had parts (pdf) specifically designed for Li-ion battery packs, that included also ESD protection which might be nice?

    Did the math on the resistor values for LTC4365, and 2.49M - 249k - 249k will produce exactly 3V/6V thresholds with <5mV offset and 1-2 µA current draw. Seems good, 249 being on the E48 series and readily available as 1% SMD resistor.

    Biggest problem (in addition to cost) might be fitting two chips and handful of passives to the board. We'll see how it goes..

  • Programming the ESP

    zokier02/23/2018 at 19:40 0 comments

    I was doing the schematics for the ESP module, and added a programming header without thinking about it too much. I mean, you gotta program the chip somehow, right?

    Then I began to think more how annoying it would be to make a programming jig/board for this, and how 10 pin connector feels bit excessive anyways. What do I really need to get the ESP programmed? Well, basically the UART0 Rx/Tx pins.. and those are fixed to the level shifter and furthermore uses that weird connector, so that's not helpful... except.. maybe.. yes! I should in theory be able to use the USB-Serial module, that I was planning to make anyways, for also programming this ESP module. Sure, it goes through pair of level-shifters for no good reason, but it should work. As added bonus I could also program it with the 200LX itself also if I so desire.

    Okay, the plan is not all roses; the thorn here being that both modules have the same female header connector for the serial. Meaning that I need to make a custom null-modem style cable for this specific purpose. But I think I can live with that, if it works. Failing to get it working for some reason, I think I can always fall back to either out-of-circuit programming (this jig looks kinda cute), or in-circuit pogo-pins (something like this). And OTA flashing would be neat too, so maybe I don't need to do wired programming all that many times.

    The morale of this post is not as much the specific method of programming, but rather how I was initially kinda fixed on thinking that of course I need a separate programming system and then feeling clever that I got out of that idea and figured out a solution that is much more suitable here.

    With the programming bit being dealt with, the schematics are almost ready. I would still like to put in an under-voltage protection to prevent brownouts, and maybe some other minor tweaks for the power supply. And then I need to double-check all the pin assignments etc and then comes the fun part; PCB layout.

  • ESP module progress

    zokier02/21/2018 at 20:49 0 comments

    Worked on the schematic a bit. Need still to figure out what pins actually are needed for booting (and flashing) and what are free for use.

    Need also to drop in the LDO, but I need to create kicad part for that and too tried now for such things.

    Fun fact: the pin numberings of a random github library part don't actually match the pin numbers in ESP-12F datasheets

  • Power-supply for the module

    zokier02/18/2018 at 23:32 0 comments

    I realized that while the USB-module is a piece of cake as there is USB power available, I have no such luck with the wireless module. So I need to figure some way to power the ESP-12F module and the level shifter. Couple of alternatives that came to mind:

    • USB-power. I could use one of those power-banks and get 5V power. I can power the level shifter directly from 5V rail, but I need additional conversion to get 3V3 for ESP-12F. LDO would be simplest, but might be too inefficient (66%). It's bit hacky to use USB for power without any negotiation etc, but I hope that will work anyways.
    • Lithium cell. Maybe 18650 (quite big, and I don't have any at hand), or find some nice small pouch cell somewhere (where?). Simply LDOing it down to 3V3 or maybe 3V0 could work fine, as both level shifter and ESP are specced for 3V0.
    • 3-4xAA. Somewhat bulky, but the most readily available solution. With four cells, I could drain down to 0.8V and still get 3.2V which should be enough. Again, LDO might be too inefficient, but I wouldn't be too concerned. Probably would make sense to add some extra capacitance (how much?) in the power rails to help feed the peaky consumption of ESP.

    Ideally I'd have power port that would accept anything between 3-6V, and convert that efficiently to whatever I'd need. For first revision, I'm kinda tempted to just throw a decent LDO in there and then add proper SMPS on later. It is somewhat questionable how much "real-world" use this will ever see anyways, so it should be fine. Besides, 2000mAh should last for something like 5 hours even with just LDO, so that doesn't sound that bad.

    I will want to have some under-voltage protection to prevent brown-outs etc, even if I'm using protected cells or batteries that don't care.

    A random reddit link that might be useful: https://www.reddit.com/r/esp8266/comments/4gmkfl/how_to_actually_run_an_esp8266_for_months_on_aa/

  • Few other similar projects

    zokier02/18/2018 at 23:03 0 comments

    Found couple of other projects that are doing similar things. These two are somewhat C64-focused so the featureset does not exactly match my use. Still useful for reference. I would expect that there are probably tons of others too, considering how obvious this sort of project is.

    https://github.com/jsalin/esp8266_modem

    https://github.com/bozimmerman/Zimodem This seems really feature-packed