In this entry, I bring up the chosen platform (Huzzah), the sensor, and start on some framework. A good deal of this will be bolting tutorials and code pieces together, so there will be a great deal of outside referencing
Think of this as “I put this down for six months; gotta get back up to speed”
So, to recap: embarking on a project of a complex yet easy to use weather station.
To start: identifying technologies and a roadmap.
The ultimate goal is a stand-alone device. Let us further narrow this by stating that it should be assumed to be close to a base of operations (more normal folk might call this a “home”). WiFi seems like a great excuse to segue into using an ESP8266-based solution. Why ESP8266? I know that chip (and related modules and similar devices) is WiFi capable, widespread, cheap, well-supported, and in the Arduino framework – Arduino being another goal, as it allows rapid lash-ups, prototypes, development, and other hobby+ fun. Looking into ESP8266 a bit, it does indeed allow connection to Wifi, and certain modules break it out even beyond the sort of command/serial transmit/serial receive to take advantage of the microcontroller behind it all. Continue reading
The plan is to build a weather station. Not the most original or groundbreaking of projects, but it will be useful, complex, have some documentation as guidance, and introduce technologies that can expand to some … loftier goals**.
To that end, the idea is to start small and build out. Coming from an EE with limited coding exposure (BASIC, Pascal, and C; oh my!) this will work with hardware module integration and utilization more than nuts-and-FETs designs.
A widely-quoted misunderstanding is that “[electrical] current follows the easiest path”. This is incorrect, and destructive to a good understanding of electricity. A simple example can demonstrate this is not true: plug a 25W light bulb into a power strip and turn it on. Now plug a 75W bulb into the same power strip. The 75W bulb is an easier path for current to flow (higher wattage means more current is flowing, which is due to a lower resistance, e.g. an “easier path”). However, both the 25W and the 75W bulb stay on.
Current follows all the paths available to it, not just the path of least resistance. However, the amount of current in each path will vary based on its electrical impedance and the energy available.
“A microgrid is a localized grouping of electricity sources and loads that normally operates connected to and synchronous with the traditional centralized grid (macrogrid), but can disconnect and function autonomously as physical and/or economic conditions dictate.” –Microgrids at Berkly Lab
Boom, crash, the lightning flashed, and out went the power.
This is something that happens from time to time, though far less so where I live now than in my youth (where we kept a generator in the shed for such occasions). However, several recent outages started me thinking: how would I bridge the occasional and sometimes relatively long power gaps?
Phase 0: What happened, and initial parameters
Major component(s): Data, data, data! (I cannot make bricks without clay)
So the most recent outage was over 24 hours. Long enough that we familiarized ourselves with food safety during a power outage (the refrigerated and frozen food briefs at FoodSafety.gov were quite useful, as would have been the USDA guidelines for emergency food safety). As we did not take any supplemental precautions (such as icing the freezer) most everything was lost. But in the time and uncertainty between the work reports (we have power; no, we don’t though some of our neighborhood does; we will have power soon – I can’t fault the response teams, they busted butt to get the most people restored as quickly as possible), I kept started running through ways to save the contents of the freezer, to charge cell phones, to run fans. Why not power my home myself? Or just a small, critical part of it. After the power returned and the damage was assessed, I shared my musing with my spouse, who supported it rather enthusiastically1. So, now to form a plan!
Setting up this website, I have certain requirements. Superscript, subscript, equation display, logical picture display, charts, formatting that I like and presents information in a manner I think works1. This is the useful test post to evaluate all of these capabilities. The subject below is covered in severalotherplaces on the wide wide webz.
Calculating current-limiting resistor for an LED
An LED is a great thing. It makes a great deal of light with relatively little heat and over a long life. However, LEDs are also a bit more sensitive to power requirements and more easily damaged than other indicators and/or illuminators6. LEDs require a minimum amount of voltage before they will turn on, producing any illumination, and have a maximum amount of current they can tolerate before their lifespan is degraded (or they fry; I consider this a notable degradation of the expected life of the product).
Refer to the diagram to the right. An LED is a diode; as such there is a voltage threshold below which no current will flow and above which current will. This forward voltage drop of the diode, defined as Vf, varies depending on the type of LED used2. Once voltage exceeding the forward voltage is applied across the LED, current will flow. The LED has a maximum forward current (and/or typical, and minimum, too) given by If, where the LED will emit light of the specified intensity and frequency for the given lifetime. If the datasheet or part spec does not indicate if this is a typical or maximum value, assume it is maximum.
Note: exceeding the maximum current level of an LED will not necessarily fry it immediately. Too, it will be brighter. However, exceeding it will decrease the lifespan and luminous efficiency3.
A current limiting device must be used to protect the LED. The simplest way to limit current is to add a resistor, R, in series with the LED.
Maturity is knowing you were an idiot in the past. Wisdom is knowing you will be an idiot in the future. Common sense is knowing you should try not to be an idiot now.
We as a community (the internet) are becoming increasingly concerned with pointing out how something could go wrong, or the safety concerns of any project. Whether the reason is an increasingly litigious society, a greater average degree of inexperience working with tools and materials, or other factors, any write-ups, instructions, or videos explaining how to create are invariably littered with commenter (if not the author) helpfully pointing out how they should be safe and not put an eye out.The fact is that everything we do, including doing nothing, carries a moment-by-moment risk of harming or killing ourselves. This in mind, The Stupid Rules – the basic and overarching guidelines you need are:
Don’t be stupid doing projects: Don’t show off, don’t rush, don’t work drunk or high or sleep-deprived or impaired.
Don’t be stupid with new tools: When using a new tool, learn what it is and what precautions to take. Get instruction, find a video, take it slow and focused the first few times, and initially follow the instructions and advice on how to use it.
Don’t be stupid with new materials and systems: Cutting MDF for the first time? Spray-painting? Wiring a breaker? Stop and learn about what you are working with. Get advice, find an instructional sheet or video, and follow the advice, precautions, and instructions on handling.
Don’t be stupid with familiar tools and materials: Working with 14 molar HCl all the time does not make it any less dangerous if you do something stupid with it. Understand what precautions you are taking and why before you decide to violate them.
Bonus guidelines, once you have a handle on the cardinal Stupid Rules:
Don’t be stupid around other people’s projects(aka a hacked, modded, rough, or even final thing or system): It may look cool. It may look safe. It is shiny and you want to touch it, play with it. ASK FIRST. It may be dangerous if mishandled, it may be delicate; it is always courteous.
Don’t be a whiny butt if you do something stupid: If you get hurt or something gets screwed up, learn why and fix it if you can. Don’t whine and moan and sue some random manufacturer because they thought “don’t dry-hump our product” was a obvious enough that it did not warrant a printed warning.
“We are dreamers, shapers, singers, and makers. We study the mysteries of laser and circuit, crystal and scanner, holographic demons and invocations of equations. These are the tools we employ, and we know many things.” – Elric, The Geometry of Shadows, Babylon 5
Years ago, at the beginning of my education, one of the Masters charged our introduction to our craft began our class with the statement above:
Ah, Fourth of July. The joys of smokebombs and explosives. The delight of shooting off rockets. Who wouldn’t want their toddler to participate? To see his shining face as there is a boom or a shower of sparks at the press of a button?
I planned to use a model rocketry ignition system to create a safe way for the youth mentioned above to participate. Unfortunately I had given all of my model rocketry equipment away in an effort to increase usable space (and to get it in the hands of budding rocketeers). Commercial options were available, but they were relatively expensive, and frankly lacked visual appeal. Engineer’s audacity (not hubris, though) may have had something to do with it.
Initial research / Functional Specification
I started with a fairly clear idea of what I wanted and how I wanted it to work. The launch box itself should look like something a government scientist or military agent would carry – aluminum box, black briefcase, field com box or similar. It should have large functional switches and buttons (power, arm, and ignition), various LED indication (power, safe, ready, continuity, armed), and a removable safety key that disarms the launcher. The last is a feature of every commercial hobby rocket launcher I have seen, and is doubly important when you are on the launchpad and there is an excitable toddler near the controls.
“There are more capacitors in a distributor catalog, Horatio, than are dreamt of in your philosophy. “ – Shakespeare (I think? Close enough)
Specifically, I am talking about Safety capacitors, aka X-capacitors, Y-capacitors, XY-capacitors, RFI/EMI suppression capacitors, line filtering capacitors, and no doubt other modes of reference.
When you have the occasion to mix hazardous household voltage with capacitors (perhaps to keep noise from leaking out of your circuit, or for surge protection), special care needs to be taken in selecting the capacitors used.
Normal ceramic capacitors have the distressing tenancy of failing short. In the case of diagram to the right, such a capacitor in the “Cx” position would cause the mains to short through the capacitor, creating a risk of fire, (small) explosion, and a Bad Day. Should the failing capacitor be in the “Cy” position, the mains could be shorted to earth ground (risking fire, etc) or, if the case is not connected to earth, could just directly connect the case to mains, creating the risk of arcing, electrocution, and a Bad (hair?) Day for someone. Continue reading