Portfolio

Showing posts with label Just For Fun. Show all posts
Showing posts with label Just For Fun. Show all posts

Tuesday, July 18, 2017

How to Make Meringue: Cascode Edition!

Have you ever made meringues? I'm a big fan of pavlova (AKA meringue cake) but unfortunately for me, pavlova isn't exactly popular in CA. Hence, I've gone through several meringue recipes. They all differ drastically from how to introduce sugar, what speed to beat, what temp to bake (and the duration...sigh), etc. And of course, *everyone* claims their recipe is "the best and most fool-proof" (hah!). I've come to the conclusion that everyone has deeply ingrained, arbitrary superstitions regarding meringue (then again, I still believe in my lucky exam pencil, so who am I to judge?). All jokes aside, the only thing that really matters is the beaten egg mixture doesn't slip out of the bowl when flipped turned upside down...(at least that's my fool-proof superstition 😆).

Likewise, the methodology behind the construction of feedback diagrams is as idiosyncratic (if not more so) than meringue. Everyone has their own peculiar feedback recipe and it's all really the same thing. Granted, I do prefer the Driving-Point-Impedance (DPI), short-circuit current. signal-flow graph (SFG) method outlined by Agustin Ochoa, but again this is more of a matter of personal taste. I specifically like Ochoa's process in that it naturally gives additional circuit information (ex: output impedance, example later in post).  

Let's take a very familiar circuit for demonstration. What's more beloved than the reliable cascode (Fig 1)? 

Fig. 1 - Cascode


Fig. 2 - Cascode Small-Signal Model
Let's start with the tried and true small signal model (Fig. 2) and algebra method. This gives us our voltage gain (Eqn. 1)


Eqn. 1 (meh it's a set, oh well)

If we're judging methodologies in terms of speed and simplicity, the normal algebra method wins (for this specific case). It's easy, but it may not give other information (which is fine if all that's asked is voltage gain). 

Now let's look at Ochoa's method (I super recommend his book).

First, we'll grab the short circuit currents. We set all potential voltage nodes as "independent voltage sources" and short the voltage source of interest (we are getting the short-circuit current after all). Then we grab the DPI by shorting all the other voltage sources and opening our node of interest (hence the driving point impedance part). Note: this all works because for each node we're grabbing: 1) short-circuit current *and* 2) "open circuit" (really driving point) impedance which gives us a voltage for each node (hence the whole fake independent voltage source for each node). We then methodically move through all the nodes until we have hit the output node. Think of it as superposition mayhem. For more info, I strongly suggest Ochoa's book mentioned above. 

Now we look at our first node: $v_{x}$. For our short circuit current, we set $v_{out}$ as a source, then short $v_{x}$ (Fig. 3). This gives us the following short circuit current (Eqn. 2, note we short across $r_{o2}$, hence no contribution). Also no contribution from $g_{m1}$ because we've shorted $v_{x}$. 
Fig. 3
Eqn. 2
For DPI (we are searching for "$Z_{x}$"), we short all sources and open our node of interest. This leaves $v_{x}$ open while all the other voltage sources are shorted (Fig. 4). $g_{m2}$ is open because the input voltage is shorted. This reduces to $g_{m1}$ and $r_{o1}$ and $r_{o2}$ all in parallel, leaving us the DPI of Eqn. 3.

Fig. 4
Eqn. 3
For $v_{out}$ short-circuit current, we set $v_{x}$ as an independent source and short $v_{out}$ (Fig. 5). The short circuit current is equal to the contribution from $\left( g_{m1}+g_{o1} \right) v_{x}$. 
Fig. 5

Eqn. 4
The DPI for $v_{out}$ is simply $r_{o1}$ since $r_{o2}$ is shorted (from $v_{x}$) (Eqn. 5). Both $g_{m1}$ and $g_{m2}$ are open since both $v_{in}$ and $v_{x}$ are shorted to GND (Fig. 6). 

Fig. 6
Eqn. 5
Now that we have a complete set of short-circuit and DPI equations, let's put together our feedback graph. Combing equations 2 through 5, we get the following.

Fig. 7

Eqn. 6

Hooray, we get our voltage gain (Eqn. 6)!!!

Now a few interesting things to note from Fig. 7. First off, we actually get the same voltage gain as algebra method because we have positive feedback from the output voltage (Fig. 7). As we look back on the original small signal model, this makes some sense. Resistors are bi-directional, hence there is some "backwards-leaking" current from $v_{out}$ to the $v_{x}$ node (which ends up mingling with the $-g_{m2}*v_{in}$). Second off, we can calculate output resistance easily from Fig. 7. In fact, Fig. 7's output impedance matches the algebraic solution (Eqn. 7 derived from Fig. 7 is the same result as the traditional algebra).
Eqn. 7
The third cool part is let's say there's some voltage noise coupling to $v_{x}$ from another trace in the circuit. With the overall block diagram, we can see how the coupled noise to $v_{x}$ would look on the output by calculating $\frac { v_{ out } }{ v_{ x } }$. We could also introduce current noise sources at the various short-circuit currents to simulate shot noise. Heck, you can add noise sources where ever desired and see the effect on the output. The real magic is the feedback diagram enables noise modeling.

Equally important (which I haven't listed here) is if this exercise is re-done with reactive components (mostly caps), it should become obvious which caps affect bandwidth/stability the most.

Now...there is a third method to calculate voltage gain via *another* feedback graph technique. I haven't found a formal name for this technique other than "‘Fake Label’ Circuit-Analysis Trick" from Ultra Low Power Bioelectronics.

I don't particularly like this method because the diagram produced isn't guaranteed to carry more information other than the *specific* output/input requested. Why? Ochoa's method intentionally dissects the circuit into short-circuit current, driving point impedance, and voltage sub-blocks ($i_{sc}*DPI = v_{node}$). This is great in that we can easily get impedance, $\frac { i_{ out } }{ i_{ in } }$, and $\frac { v_{ out } }{ v_{ in } }$ naturally by looking at the diagram because it's already intentionally broken into current, impedance, voltage. The "Fake Label" method instead takes all the dependent sources, makes them fake independent sources, and re-builds a diagram by turning each source on one at a time. While the overall transfer function (as in output/input only) might be accurate, the "Fake Label" feedback diagram won't be in current to impedance to voltage blocks, so information from intermediate nodes within the overall diagram may not be accurate/present. Thus with "Fake Label", you end up drawing different diagrams for different specified transfer functions (like the examples below with voltage gain and output impedance).

However, the useful part of "Fake Label" is that it's more simple than DPI/short-circuit current - we're only looking at one source at a time. For larger circuits, I can see using "Fake Label" over Ochoa's.

For example, let's look at "Fake Label" for cascode's voltage gain.

First, we would turn all the $g_{m}$ dependent sources into independent current sources. Our control variables will be $v_{x}$ and $v_{out}$.
Fig. 8

Now we step through turning on one source at a time.

If $v_{in}$ were on but the other two current sources off (i.e. open), $v_{x}$ and $v_{out}$ see no contribution. Hence nothing to write about here.

If $g_{m2}$ (called $i_{2}$) were on and $v_{in}$ were off (i.e. short to ground) while $g_{m1}$ were off (open), then we see the following.
Fig. 9

Eqn. 8

If $g_{m1}$ (called $i_{1}$) were on and $v_{in}$ were off and while $g_{m2}$ were off, then we see the following. 

Fig. 10
Eqn. 9



Eqns 8-9 create Fig. 11 (which has the correct voltage gain). However, this diagram doesn't describe the output impedance (and I wouldn't use Fig. 11's $\frac { v_{ out } }{ v_{ x } }$ either since the intermediate nodes aren't meticulously split into current and DPI). Again, we haven't re-conditioned the system into short-circuit current, driving point impedance, and voltage sub-blocks (a sub-block for each node) but rather look at the aggregate contribution to a node via several "independent" sources. Because the processes are different (which leads to different equations as well), we get different block diagrams. 

Fig. 11

This means that if we want output impedance (via "Fake Label"), we'll have to construct another diagram... Sources will be $v_{t}$ (previously output voltage) and $i_{1}$. $i_{2}$ disappears because the input is grounded in order to calculate output impedance. Control variables are $i_{t}$ and $v_{x}$.

Fig. 12

If $i_{1}$ is on and $v_{t}$ is off, then we see the following.

Fig. 13
Eqn. 10


If $v_{t}$ is on and $i_{1}$ is off, then we see the following. 
Fig. 14

Eqn. 11

Putting this all this together leads to the following (Fig. 15). The overall transfer function is equal to the inverse of the output impedance!

Fig. 15
As we've seen, there's a lot of ways bake meringue. In terms of pure output/input transfer function, they all end up with the same result. Depending on what you're looking for, one way may be better than others (Table 1). Again, it's a matter of personal taste (along with objective), but I would definitely take a look at both Feedback in Analog Circuits by Agustin Ochoa and Ultra Low Power Bioelectronics by Rahul Sarpeshkar if this is interesting. Seems like classical feedback is somewhat of a dying art nowadays (boo), but the intuition is still fun and it's always good to expand one's palette, even if it all makes the same meringue. Hah!

Table. 1










Saturday, June 24, 2017

"Hello, World!" A Short Recap of Thoughts on Industry...

Long time no chat 😜

Surprisingly, I am *not* dead (although did I come close during one particularly bad China trip). A lot has happened since undergrad - got my masters, industry-ed for ~3 years, shipped millions, went blonde, etc. Regretfully (or maybe luckily hahaha) most of that can't be shared due to friendly Silicon Valley NDAs :)

As a sort of time capsule exercise, here are a couple of personal realizations amassed thus far.

  1. Life expectancy in the US is about 75-80 years. 
    • Given that I'm in my mid to late twenties while writing this, I have about ~50 years of life left. In which case, 5 year increments are about 10% of my remaining life. 
  2. Industry is almost entirely dominated by the manufacturing machine. 
    • The manufacturing machine feeds on optimization. This in turns means low-risk, high volume, high reliability, fast turnaround. However, this also means that often enough:
      • Priorities are placed on "what" and "how much", less so on "why" and "how come". 
      • Novelly creative designs aren't highly valued (since it may be more risky, slower to manufacture, harder to plan out/around, etc). New ideas are often met with skepticism, but this is understandable. 
        • Nonetheless, make sure you've the right spec/figure of merit priority before heading down any single execution path. Challenge yourself - always think of at least 3 different implementations before settling with any single one. Sometimes your first idea isn't the best.
        • Don't become enamored with one implementation style. "If all you have is a hammer, everything looks like a nail." 
      • The adage "all models are wrong, some are useful" is forever true. People often (accidentally) mislead with data. Always keep a watchful eye out... Double check everyone's data / model / assumptions (including your own!!!) 
      • Don't assume that people understand what you're saying (and don't assume you understand what they mean!). Give your instructions / suggestions / comments, and then ask the person to reiterate what *they think you meant*. Do the same for when you're given task! Most communication problems stem from small misunderstandings.
      • Budget enough time for rigorous analysis beforehand. Problems will haunt you if you don't. 
        • While I understand that *certain* product cycles may not have enough time for full simulations/mock-ups, this "we don't engineer, we make a ton of configs at the build" technique only works for companies with more money than time... 
        • Also the whole "million different configs" method forever involves drama. Limited build quantities means everyone has to share. The worst result is people not getting the right data (either too little or too messy). Other stressful consequences range from overly long builds to overly chaotic build matrices - all with a huge dollop of engineering drama. (Whose units can we use for this config, when are they going to be inputed, who gets the final allocation, is this going to disrupt Reliability's quantities, etc.)
      • No one is above Murphy's Law. 
      • You'll almost always end up regretting shortcuts. The worst shortcuts are the forgotten ones. Those are a nightmare to debug. 
      • People like to say root-cause matters, but often completely forget its importance once there's a tight enough tourniquet around the wound (note: horrible mindset to adopt). 
        • As matter of personal principle, *always* nip failure modes in the bud. What might be a 3-off or 5-off in the first build rapidly grows to become a fail rate of 10%, 30%, 50%, etc in subsequent builds. Early problems often have relatively easy solutions - had you implemented the fix a few builds ago! Never skip your debug/analysis chores. 
        • Occam's razor is sharp. Before going after some crazy, complicated theory, always cover all your basics. Check the obvious things you assume *must* be working. Systems can be majorly screwed from the simplest things. 
        • Divide and conquer. Split your debug tactics logically. Try to check SW then HW then branch down into a decision tree until you know if the issue is either completely SW or completely HW (or somehow tangled in both, although that's extremely rare). Once you've understanding of the true root-cause, *then* brainstorm solutions. Always take the SW fix if you can (then you can avoid waiting for another expensive build, reliability testing, etc)
      • Large scale debug typically consists of data correlations, odd distributions, and borderline rude emails asking why distributions look so bad. 
        • *Always* do the correlation study first. It's cheap (no need for physical hardware, can be done anywhere at any time), relatively fast, and can give you a lot of insight. When starting, just plot everything. True, correlation doesn't mean causation, but sometimes bizarre things end up correlating in ways that do make sense (ex: a high PMU temp correlating to large decreases in battery SOC). Go overboard first, then fine tune. 
        • A few choice CDF plots can save your product.  
      • Your work must be useful to the company/product (this should be self-evident). The only way to get projects you want is to sell them in terms of company/product benefit. This will place artificial limits on what you do with your time. 
      • You wear a lot of hats. Sometimes you'll have to play program manager, test engineer, build lead, statistician, salesman, psychiatric counselor, and lastly electrical engineer all in one day. 
      • Some people genuinely love all of this. Although I may never understand why/how they do, I've come to accept that people exist on axes orthogonal to my own.
  3. Visceral technology consists of improvements in the following: 1) Energy, 2) Time, 3) Space, 4) Mind:Mind Interface, 5) Mind:Machine Interface.
    • If your technology (*cough cough consumer electronic*) doesn't either 1) improve one of those 5 significantly, or else 2) improve at least two of those decently, then it's not going to make much of an impact. At best, it'll be regarded as some weird Silicon Valley toy. 
  4. Having all the money in the world doesn't matter if you don't have time to spend with your friends and family. 
  5. Understand your personal motivations and agenda. Remember, you are not an open-loop system! If you can re-identify your personal motivations and agenda again, you can always negative feedback back. Also, just as the input signal can vary with time, so can you! Don't beat yourself up if your goals have changed/evolved since years and years ago. Just be the very best closed-loop system you can! 
Anyway, I'm planning to blog again because I miss the virtual ether of the internet. 

See you all soon! 😊



Thursday, June 7, 2012

Y6 Copter

I saw this and thought it was the most beautiful thing ever.


I really, really, really want to build a Y6 copter. It's technically a hexacopter, but honestly it looks more like a tricopter. I'm also not quite sure what extra rotors do for you, but I'm sure there has to be documentation somewhere. I feel like if one motor were to fail, you might get better compensation/not fall to a miserable death, but otherwise, it looks like it'd have less lift that a X6 hexacopter. Regardless, I really like the Y6 design aesthetic (I know, I know, but it's the fashion side of me talking), and I'd much rather build a pretty thing if I can. 

I might cheat this time and start with ArduCopter so I don't have to come up with the controls by hand. Bad part is that a nice ArduPilotMega Board is expensive, but then again I don't think I'll need the GPS, barometer, etc. However, a toned-down version is still pricey. The main reason why I'm considering ArduCopter is because the software advertises itself as already set up for Y6 configuration. *Sigh* I really should just man-up and program it myself...but I'm burnt out :(

Also, lookee here!



Now that's magic. He is cheating a little with motion capture camera feedback rather than a true on-board PID, but nonetheless, it's awfully impressive. My new goal is to have Babycopter balance a broom before I graduate. Not too lofty of a goal, eh? :P

Oh and one last treat before I become too busy again.


Sunday, March 11, 2012

Analog Hipster

So first off, I saw these awesome tights from Black Milk. So fabulous.


They're circuit board leggings and they're a little pricey, but I think worth it for the novelty. I got Black Milk's Purple Galaxy Leggings as a Christmas present. I swear, they are the best leggings ever. They're really durable and thick like under armor. Go buy these for yourself (or screen print your own layout) because they are hilariously baller. 

Second off, I'm going to make an analog quadrotor. It's gonna be named Babycopter! :D 

....

So basically, I got super excited about quadrotors (well, n-rotors) after I saw this gorgeous video of a Cinestar octorotor. 



After I made Segboard, I discovered I want to learn all the things about PID controllers. And what better thing to try after Segboard than 2 Segboards! Together! In the sky!

A quadrotor is essentially the same as 2 Segboards, except you secretly have 3 axises (yaw, pitch, and roll) rather than one and you have flying baby brushless motors!

So why analog?

Well, Segboard was all digital, and I want to try being an analog hipster. I've always wanted to make analog controls with active filters and such, so yay!

Also, er, well.....

My secret goal of this project is to have a quadrotor for 6.115 (my microcontroller class). However, the main terror of this class is that everything is done in 8051 ASSEMBLY. EVERY SINGLE PROGRAM. WAAAAAAAAAAAAAAAAAAAH.

I've never missed compilers so much in my life. ;_;

The true other reason for analog is because I don't want to implement floating point in assembly. Heck, even fixed point with software filters of like 0.9### is horrible enough and wah I hate 16 bit and 32 bit math waaaaaaaaaaaaah.

Essentially, what I want to do is do all the math for my sensors in analog. This should theoretically be fine because they're all analog accelerometers and gyroscopes! The only bad thing is that analog is also tricky and hard and magical, but I'd rather be better at analog magic than assembly magic. Least for this project.

I do, however, plan to make 8051 motor controllers. This should be perfectly fine and dandy and I like motors anyway so yeah.

Think of it this way - whether through analog or assembly, magic is still magic. Least Imma tell myself that at night.

Oh well!
Jordan

Saturday, February 18, 2012

Things That Are Entertaining :P

Term started (booooo) but I'm pretty excited about classes :D I get to take another lab class from my favorite professor so far, Steve Leeb, but this time on microcontrollers (6.115). I've had some experience with Atmel products, but only at a high level. Most of it was attempting to write C/developing Arduino boards at the Media Lab. Arduino actually uses Atmegas, both 168 and 328 chips. However, most of the programming is an Arduino developed IDE which basically uses pseudo-Java (Processing). Now I'm writing in Assembly, a low-level machine language. The last time I touched Assembly was during 6.004 where everyone makes a beta processor. However, that's written in wannabe Verilog, and you don't write in Assembly until like half-way through the semester.

Anyway, what I've learned so far is that stacks are hard and you can't mess with them too badly or else all the sadness happens. :(

I miss compliers SOOOOOO MUCH.

Also, I twerked segboard again for MIT Techfair. Check out some video of its new lolzy wireless remote.


Did you know that the interfacing with wireless wii nunchuks depends a lot on the nunchuk? Different brands will have different communication setups, so that really, really, really sucks. However, there exists a good amount of documentation in case you run into trouble. I used a Nyko Kama Wireless Wii Nunchuk for segboard.


*Sigh* Now back to my daily amount of Institute hosage.

Seeya.

Wednesday, January 25, 2012

First of the Year!


Well, Segboard is finally happy enough I feel relatively safe riding it. Working on turning and more safety controls. Check out me riding it. :P


Monday, December 5, 2011

Victoria's Secret Fashion Show Uses EL Wire

Hey all! Found another example of "high-tech" fashion. I've posted before on Katy Perry's EL peacock tail, and this year Victoria's Secret did a similar thing with their EL Angel wings. While I think they looked overall cute (and were structurally robust, props to whoever mechanically designed them), I was a bit disappointed in their electronic simplicity. I feel like the amount of work for audio processing/visuals isn't that hard. Bright wings that stay on are pretty, but just a little too boring. I would've really like it if Victoria's Secret made their lighting more dynamic (like the beating heart bra worn at 2:00). It's clear that they were technologically sophisticated enough to know how to vary brightness/speed of their lights, but didn't for their wings. At the end of the day, I suppose my main gripe lies with their decision not to. *Shrugs* I'm too judgmental :P



On the bright side, at least I now know of who might want to buy my EL Shutter Shades :)

Wednesday, November 30, 2011

Hunt for the cheapest!

I haven't done any fashion posts for a while and I feel deprived (especially with all the Segboard posts lately). I'm going to show you 2 pairs of shoes that I find similar.

Jimmy Choo Glitter Pumps
Urban Outfitters Glitter Pumps
The question "Am I going to buy an IMU or a pair of shoes?" probably isn't asked by many engineers or fashionistas. I don't meet many people here at MIT who care about fashion. In fact, there's almost an "anti-culture" of dressing up (I'm generalizing, but still). In one sense, practicality drives this trend. You can't wear a chiffon anything while messing with motor grease. However, I try to dress well regardless (just bring another set of clothes or dress differently those days), but most people are either too lazy or too "counter-fashion". Anyway, main point - I like dressing nicely even if a lot of engineers don't and I think it's perfectly fine to be smart and chic.

Nonetheless, I am also really cheap. I almost have to pick between 2 types of tools. Do I buy clothes or parts? The point of the pictures was to show the silliness of price. The Jimmy Choos are $745 and the ones from Urban Outfitters are $49. I'm the type of girl who will go for cheaper if they're similar enough (if you want even cheaper go on ebay). When push comes to shove and you've got to pick between parts for your segway skateboard or nice shoes, the going gets tough :P Basically, always look for the best bargain! 

End rant. 

Monday, September 19, 2011

Make Magazine Thinks I'm Shiny! :D

This weekend I went to Maker Faire: NYC and got interviewed by Make Magazine! Make sponsors this convention/fair for creative people throughout the US. This year it was hosted in New York. One can register as a maker or as a normal spectator. If you're a maker, you have something to present. I went with the MIT Electronic Research Society (MITERS), and together we had a bunch of modified electronics, and, of course, shiny things.


This was pretty neat as a personal step for electronic fashion!

I also saw lots of other wearables, learned some neat ways to deal with lighting, and had a fun time! Definitely an event worth attending!

Saturday, July 23, 2011

Smart Hood 1.0

This summer I have the best job ever! I'm working at the MIT Media Lab with High-Lo Tech, a cool group that does a lot of e-textiles and electronic craft applications research. Basically I get to do fashion engineering and learn new things, which is always super awesome. Anyway, one of the projects I'm working on is this smart hood that lowers/raises itself in response to light and temperature, and also heats itself up. Not finished yet, but I have a video of it being silly, so hey. :D

3D Pocket Locket!

I've been kinda lazy with blogging ever since the summer started. Sorry! But I do want to share with you my latest full-creation.

For this class I took with Camera Culture from the MIT Media Lab, I made a 3D pocket-sized display. It's based off of a stereoscopic display from Instructables. The difference is mine is about the size of a deck of cards. As this utilizes stereoscopy, you need polarized glasses. If you wanted to be all fancy and make a Nintendo 3DS display, you'll need a fancy lenticular set-up (think of those rulers and stickers you had in grade school that moved if you tilted them from side to side. Lenticular lenses look like that grated plastic). Lenticular lenses are awesome in that they allow you to see 3D without spectacles. They are autostereoscopic displays that basically allow each eye, right and left, to see its specific image due to specific light refraction.

Unfortunately, I wasn't that fancy, so my pocket locket needs glasses, but since it fits into your pocket, I think it's kind of dandy :)

I need to get a real digital camera, but I'm a poor college student :P
If you look at the center lens, it's a 2-way mirror. What happens is that the mirror allows an overlay of 2 images, left and right. When each image is viewed by its respective eye, the right or left, the brain puts the two images together as one 3D picture. Now the 2-way mirror is great in that it reflects one image, the one in front of it, and lets another one through, the one behind. Hence, when you look at the mirror you see 2 pictures. Now, all LCDs are polarized. However, when you bounce an image back, you reverse the polarization. So now on the mirror, you have 2 differently polarized pictures! That means, when you wear your 3D glasses, each eye sees its particular image (and only that particular image due to the polarized light), so your brain sees 3D! Pretty neat! If that was confusing to understand, I suggest looking at that Instructables page. If you want to know how bad my papers are (or want to read it for the lolz), continue down. Either way, hope this spiced up your interest in 3D imaging. :D Now if only someone made some 3D display jewelry. I can see this going in a real locket someday.





Thursday, April 28, 2011

Chanel's BAMF-titude

I haven't been able to look at many collections recently, but as I was skimming around, I saw the most awesome shoes.


Dang Chanel, this is just BAMF-tastic. Now I just have to wait until they actually come out. I think they'll be available for sale next month. 

In case you don't have a couple of grand to spend on designer shoes, you can get an equally baller pair of heels with brass knuckles instead of guns for about $50 instead. :D


Now for some more awesomeness. 

Chanel's Fall 2011 RTW has this post-apocalyptic vibe that I love. The whole nonchalance of the baggy shape and tough-textured fabric is so...cool. It sure has a "Don't Mess With Me" look. I just dig the tomboy twinge.