random notes on mosfets and question on when i may see movie x or y

Author’s Note: not so much a blog post as it is a list of random thoughts. I know, I know, I could’ve made more pretty equations, but I typed this on a note pad, and now it’s 3:17 in the morning.

Stuff that I should have understood last month:

logic level transistors are transistors that can be turned on (or off) by a Voltage_gate-drain voltage less than or around 5 volts. This allows it to be controlled augmented (or regular) MCUs like arduinos and Rasperry pi without needing to amplify the voltage on the pwm signal.

Pick N-channel and P-channel, either with enhancement modes

Simple equations on making sure your MOSFETs don’t burn up. (otherwise stated: “Do I need to heat-sink this?”)

via Joule heating if

P = i2*Rds , where Rds   is the drain source resistance which is based on gate voltage.

And if your mosfet current form source to drain works at.. idk. 6A, and has a Rds = 0.6667 Ohms value than power consumption is

P = 2.4W

Pd = (max(Tj)-TA) / R_tethaJA, this is max power mosfet can dissipate, where Tj is the junction temperature, and Ta is the ambient temperature.

P = 175-25C / 62.6 c/w, 25c is ambient temp.

then Pd = 35mW which is less than 2.4W

so you’re safe to operate without a heatsink

Vgs or Vth

Rds

P=Rds*i^2

Pd = as above

mosfet shouldn’t have a very high ON high resistance

so…

https://www.baldengineer.com/p-channel-mosfet-tutorial-with-only-positive-voltages.html

I don’t need to worry about using an opAmp inverter (which can go up to 5$/USD!) to get inverted voltages to drive a PNP MOSFET. However, issues exist when the logic voltage is 5V on the MCU if my Li-Po voltages vary from 9 to 11.1 to 12.75 volts. [9V-12.75V] is basically my absolute range in order for things to be safe. Less than 9Vs (or less than 3V per cell) and you’ll have to pay a visit to the trickle charge fairy. (Less than 2.X V and some chargers will refuse to charge them). More than 12.75V (or 4.24V/cell) and your Li-Pos could could get damaged in some other way. Anyways, if the source is at 11.1V and the gate is at the max possible voltage of 5, then the difference is 6.1V. The PNP will forever remain on high and never close. According to this http://electronics-diy.com/electronic_schematic.php?id=1012 I can use use a simple BJT to account for the difference. In this case, I only care about the voltage, not the current. Actually, I doubt that little transistor can handle more than an Amp. According to the secs, https://www.sparkfun.com/datasheets/Components/2N3904.pdf that’s a definite no on going over 1A. So the in-series resistor would have to be something that limits the current going through it. Something not in those URLs Is where said resistor could be placed. In theory, I should be able to place a resistor in series to the 2n3904 on the ground side to limit current as low as possible, but also to keep the voltage value at the source to as close to the 11.1V (incoming voltage source value) as possible. I mean, in my head (and I haven’t drawn this out in paper yet), that should work. I don’t want the li-pos to drain current while any particular MOSFET is off, so ideally that resistor value should be high. Further, using a transistor to control another transistor will add in some extra delay on the PWM side of things. I’m leaning towards using the 2n3904 to simply on/off the PNP MOSFET. Oh, the application for all of this is a Peltier h-bridge. e.g. an electric-thermal device. So the input would be digital (1 = HIGH, ditital 0 = LOW) –→ 2n3904 –→ PNP While on the bottom 2 NPN MOSFETs, the full fury of a the PWM input will be direct driver of them. I hope this makes sense. If it doesn’t, it’s because I didn’t put up any specs, it’s 2:24 in the AM, and my equations should probably reference specific pages on particular datasheets. Right, if you didn’t understand it, it’s because it’s my fault. That’s what some professors say anyways (“I’m sorry I didn’t explain it well, let me try again”) If I were lecturing, I would be like, pay attention kiddo! I’m only going to go through this once. Blah blah. So, if you were wondering what was on my mind this weekend, it was on this. These were some of the things that I should’ve known last month, but didn’t until recently. Hamilton is coming to town around May. Ticket prices are already at the 800USD+ range now. The good seats are gone, and the remaining ones range between 1.1K-1.2K. Assuming one takes their S.O. to such a play, we’re talking about paying between 1.6k-2.4k…$_$. Here’s the thing about going to see Hamilton. If you take a girl to see it, she better be your girlfriend, or fiancé, or wife, or something that places the ‘significant’ in the S.O. Buy your tickets now, and the lady friend you’re seeing could be very well be seeing some else within 2-3 months. It’s not for the light hearten relationship. If a guy takes you to see Hamilton, that’s a serious date. That’s a, “hey, will you marry me date?”, not a “Hey, will you be my girlfriend date?” So, here I am wondering.. Screw S.O’s. I’ll go see Hamilton myself. Alone. Solo. But who does that? I’ve went to see movies solo before (sorta like a dating yourself type of thing), but that’s only ~15 bucks. Seeing a play is more like a social event between viewers when you’re dropping that much. I guess the only thing left to say would be: I, Want to be in the room when it happens, the room when it happens. When movie X came out, some of my friends had already seen it. It was really a family event for some of them (inter-generational type movie). A few of them had even went on to see it 1, 2, even 3 times. I eventually went to see movie X with my own family. I guess, I’m bringing this up because, that same afternoon I had a breakup with a person in my life. We had spoken, made plans, canceled, made more plans, on watching movie X. Tickets may or may have not already been purchased by me. I had planned to go watch it twice. Once with family, the other with the aforementioned. So here I am, comparing movie X tickets with Hamilton tickets. As 45 would say; sad. How does that tie in to today? I’ve tried asking some people if they wanted to watch movie Y. Similar story, many folks have already seen it (my folks already went without me!) at this point. The longer I wait the subset of friends I have who would have seen it and wouldn’t bother seeing it for the n-th time with me decreases. It’s been Z weeks now. I think I’ll just go watch it myself. Or.. Maybe I’ll go see it next week? This is supposed to be a hell week for me, a 4 hours of sleep every day type of week. Not really though.. I mean, I don’t need to go to the coding challenge thing on Tuesday, and I don’t need to go to the hackathon thing next week. I sorta need to go to the hackathon thing this weekend though since since tickets have already been paid for. 3/5 Monday: Dr.K meet, design stuff, lecture, design stuff, tech event that ends at 9pm (but I only need to spend 20 minutes there if any at all). 3/6 Tuesday: Dr.R meet, design stuff until whenever (cancel? Go watch movie Y?) 3/7 Wednesday: hackathon stuff, lecture, design stuff 3/8 Thursday: design stuff (end night watching movie Y?) 3/9 Friday: hackathon stuff (fuck sleep) 3/10 Saturday: hackathon stuff (no sleep) 3/11 Sunday: hackathon stuff (sleep? Lol), end night with design stuff 3/12 Monday: Dr.K meet (again), lecture, hackathon #2? (I still need to do design stuff), prep presentation 3/13 same as 3/6, prep. presentation 3/14 similar to 3/7 but team needs to present I’m not obligated to do hackathon#2 (and now I see why hackathon#1 cost money to get in) from the 12th-16th, so I might cancel that event depending on how much progress on my ‘design stuff’ gets done. How ready my ‘design stuff’ team is on our presentation on the 14th will be the determining factor for that. This leaves tuesday or thursday for movie going this or next week. Hopefully movie Y is still screening by then. Off to go check Fandango. On Auctions Author’s note: Just some of my notes and thoughts on doing homework before an auction Check VIN number from wind shield to compare to VIN number in other locations such as door and trunk. They should all match. Check the dip stick. Flooded cars should be avoided Edmunds – tends to give an overall average. Prices are usually somewhere in between what a private seller and a dealership would offer for it. [damaged, rouge, average, clean, outstanding] https://www.edmunds.com/ Kelley Blue Book – favors car values towards the dealer. So people will start at the KBB price and negotiate down based on depreciation and other factors. Prices tend to be higher than what private seller would sell for. Don’t expect to pay the KBB value in most cases. [fair, good, very good, excellent] National Automobile Dealers Association (NADA) Dealership trade in value for cars use * Wholsale Blue Book – the most money a dealer would pay for a car *The Manheim Market Report – averages 1k’s of sells of cars sold in auctions. https://www.manheim.com/ There’s also a Black Bluebook, but this uses weekly wholesale auction values. These prices are lower than trade-in values. Because, you, me, and everyone else has a life, we don’t want waste time searching through endless pages and dealing with ad consuming page downloads. TNT auction – there is no preview of airport lost and found. They uploaded their car listings to https://www.proxibid.com/asp/catalog.asp?aid=138219&ipp=100&sort=0&lr=1519326363358 this view gives the items under their sell order. e.g. (Sale Order: 6 of 325) * not everything is a car. Some trailers are listed too. https://tntauction.com/images/pdfs-doc/DAYNA.pdf This is the .pdf for the miscellaneous items listings Clark County holds a surplus auction three times a year. They contract TNT Auctions to do this for them. Two auctions are held simultaneously. One is the miscellaneous items auction and the other is the car auction. One may register as a bidder on-site from the TNT trailer. There’s no registration fee. Just show a valid form of ID to receive a bidder’s card. Miscellaneous items like electronics or office equipment cannot be bid on online, only in person. If you bid in the car auction in person, you must register in person. If you want to bid for the car auction online, you need to register online in the TNT Auction website. There’s same day registration, but you’re encouraged to register during the preview and pre-registration period. For those bidding on a vehicles, the preview period is the time to inspect the vehicle. Inspect engine, put the vehicle into gear (they allow you to get in?), listen to the motor run, and check the gear. Individuals may not move the vehicle. Raise hand into air, or raise your bidder’s card. 10% buyer’s fee when bidding live 13% buyer’s fee when bidding online. The extra 3% probably covers banking fees, but if that’s the case, what difference would it make compared to using your credit/debt card in person? In which case, it probably covers some fee the TNT website adds for their ‘internet services’. After you win the bid, you must deposit$300 for vehicle by the end of the same day. By the following Monday before 2PM. You must pay the remaining balance. With that done, you’re handed the keys and the vehicle title. It’s up to the winner to smog check the vehicle and to register it with the DMV. Miscellaneous items winners must pay in full and remove the item from the same day.

There seems to be an understanding that car auctioneers will lie about the condition of the vehicle. There’s also concern that you might get a ‘flood’ car, which might require investments to get fixed if it’s even possible. Basically, “as if” is the phrase to remember when buying.

What I’m doing right now:

1) I was going to do some wget magick to automate the process of getting the entire listing of what’s up for auction.

2) Then I was going to phrase the data and export it in a spreadsheet friendly format

3) Then I was going to conduct analysis cross referencing each Car’s Make, Year, Model to averaged values from the above “blue book” websites (which I would also have a set-up to automate retrieval using their APIs or through less respectful methods)

4) Then I was going to use a report I wrote on calculating depreciation using this year’s interest rate, and run Monte Carlo simulations to… to…

Was* is the take away word. For now, I’m just going to manually select a few items from the listings, and get a blue sky value for them. That report on calculating depreciation, I did write it (along with a co author). I’ll find it later. Was it depreciation? Maybe it was on financing a loan? I forget these things sometimes. Anyways, that’s all for today.

Vim + LaTeX and YOU!

Author’s note: I think I can make this one short.

Notice how we’re still in insert mode and that this file hasn’t been saved yet. For some, this is all they want, the ability to have a live preview rendering of their drawing. To receive that WYSIWYG culture intersected with the WYSIWYM dogma which is life. That’s what  the kids want these days. I didn’t write this, it’s simply yet another plug-in for vim. What I will go over, is how this tool in combination with a few little hacks helps to streamline report making.

Okay, the secret sauce is in the makefile.

TARGET=filename
PDFVIEWER=evince

all: $(TARGET).pdf ## Generalized rule: how to build a .pdf from each .tex LATEXPDFS=$(patsubst %.tex,%.pdf,$(wildcard *.tex))$(LATEXPDFS): %.pdf: %.tex
pdflatex -interaction nonstopmode $(patsubst %.pdf,%.tex,$@)

# removes intermediate files
clean:
rm *.aux *.log || true

# removes intermediate files AND the .pdf you made
veryclean: clean
rm $(TARGET).pdf # compiles file and uses evince to view document, or use your favorite viewer! view:$(TARGET).pdf
$(PDFVIEWER)$(TARGET).pdf

# in case you're working in a sub-folder and need to send elsewhere
submit: $(TARGET).pdf cp$(TARGET).pdf ../

# lpr will use default printer and default printer settings
print: $(TARGET).pdf lpr$(TARGET).pdf

.PHONY: all clean veryclean view print

For yourself, the “filename” variable should be changed to your filename without the extension. So if your filename is “myFinalReport002.tex” the first line should read “TARGET=myFinalReport002”. PDFVIEWER should be set to whichever pdfviewer you prefer on your machine. Evince is the one used here.

mkdir a  folder for your latex report. In this folder, you’ll want both this makefile and the myFinalReport002.tex that you’re working on. The sample *.tex file in the screen shot above is simply this

% This is a sample input file
% & $# % _ { } ^ ~ \ are all special characters \documentclass{article} \begin{document} \section{Simple Text} Words are separated by one or more spaces. Paragraphs are separated by one or more blank lines. The output is not affected by adding extra spaces or extra blank lines to the input file. Double quotes are typed like this: quoted text''. Single quotes are typed like this: single-quoted text'. Long dashes are typed as three dash characters---like this. Emphasized text is typed like this: \emph{this is emphasized}. Bold text is typed like this: \textbf{this is bold} \subsection{A warning or Two} If you get more space after a mid-sentence period---abbreviations like etc.\ are common culprits---then type a backslash followed by a space after the period, as in this sentence. Remember, don't type the 10 special characters (such as dollar sign and backslash) except as directed! The following seven are printed by typing a backslash in front of them: \$ \& \# \% \_ \{ \}.
The manual tells how to make other symbols.

Greetings people who read my blog! o/

\end{document}

With these two files in your working directory you can simply call make, make clean, make veryclean, make submit, make view, and finally makelpr (for when you want to print and are on the go). A person can pretty much put whatever commands they want to inside the makefile, but here’s something neat about using vim with the makefile.

:make view

Just as you normally would :w or :wq,  vim has an inbuilt function where it runs commands inside of a makefile that’s in the same directory. There’s no need to open up a 2nd terminal screen or to exit vim to check you work (or submit the report). If typing in :make view is too much for you, you can always remap the commands in your .vimrc like so

155 " LaTeX fun - in lou of :make view
156 command MV w | make view
157
158 " LivePreview
159 let LLPSTartPreview = "VLP"

If typing :mv becomes too much for you, and constantly checking and rechecking your work puts a strain on your body, mind, and soul; then there’s a way to make this viewing thing a bit more automated. Aforementioned, there’s a plugin.

cd into your ~/.vim/bundle and simply

git clone https://github.com/xuhdev/vim-latex-live-preview`

To begin, all you need to do is invoke :LLPSTartPreview in your vim terminal, but adjust that .vimrc for a more pleasant experience. The READ.md instructions for this plugin does not explicitly mention pathogen(), but /bundle is the defacto /plugin folder. These quick instructions should get most people started, but for this plugin to work you’ll need to make sure that your vim has been compiled with a specific configuration, e.g. python. Most vim installs on a new system are meant to be light weight, and quick to load. If you’re having issues while compiling your own heavy duty vim installation you might find this post helpful.