Ions Crash Course

0 views
Skip to first unread message

Elia Khensamphanh

unread,
Aug 5, 2024, 7:10:27 AM8/5/24
to zoppcasimbmi
Todaywe will start at ground zero, which means getting to know Ionic, setting up our environment, getting a first Ionic app up and running and taking a basic look at what we got inside our app folder.

Finally we will also take a short look at how Angular plays with Ionic, how our files are connected and how we can add our first elements. Oh, and of course we will deploy our app to iOS and Android devices!


With Ionic your app is built from one single code base, and the apps are often referred to as Cross Platform Apps or also Hybrid Apps (although the latter has a bitter taste for some people).


Ionic can be installed as a Node.js package through the Node Package Manager (npm) directly from our command line. On a Mac, you can open the Terminal, on other machines use the according Shell and run this command:


You might have noticed there are a few more words in this command. So besides the ionic package we also install cordova, which we need to build our apps into native projects for iOS or Android. But more on that to a later point, for now just make sure this command runs successful!


So what is all of that?

The config.xml is used once the native project is built from this Ionic project. If you need special permissions in the native app or change other stuff, it will be set inside this file.


The plugins folder contains all the Cordova plugins that you installed. As you might know, these are the wrapper around native functions and we will use some of them later in this course.


The app folder is more or less the entry point of your app. Everything inside that folder is used when your app is bootstrapped. This folder works in combination with the index.html, which also imports some stuff and has this part somewhere inside the body of your HTML:


You might now notice that when you click the button the value of the view is directly updated. This is again automatically working thanks to the data binding of Angular between view and class!


To open the project in Xcode double click the ionicStarWarsApp.xcodeproj, which will bring up Xcode. If you click on the project on the left side the general view opens which should look like this:


At the top left next to the run button you now see the name of your project and the currently selected simulator. You can now hit the run button to deploy your app to an iOS simulator and get the feeling of a native app!


If you're like me, then you're always looking for an excuse to save money, tinker, or deconstruct something that seems interesting. I found a way to satisfy all of the above! I have an affinity for lithium-ion batteries. They come in all shapes and sizes, are energy-dense (hold a lot of energy), have a higher voltage than NiCad or NiMH batteries, and can withstand high amp draws. Plus, they don't develop a 'memory' or have high self-discharge so you can store them a long time. Lastly, they lend themselves to multicell configurations. Better yet, they're everywhere and can be had for free. In this tutorial, I'll give you a crash-course in how to find, extract, and salvage lithium-ion batteries, so let's get started! Below are the links for some of the tools and items I used!


Like I said, rechargeable lithium-ion batteries are everywhere! This is what makes getting these batteries cheap because people tend to toss old electronics that get broken or just stop working, but leave the battery inside. I usually get mine from the thrift store for pennies, or from old toys people give away or get broken and donate for science. The ones to look for are as follows: hand-held devices, cell phones, digital cameras or camcorders, portable DVD or video players, and my personal favorite, laptop batteries. There are different chemistries associated with rechargeable lithium-ion cells as well such as lithium cobalt oxide (ICR-type), lithium iron phosphate or LiFePO4, (you won't encounter these being thrown away often), lithium manganese oxide (IMR), lithium manganese nickle (INR) and lithium nickle manganese cobalt oxide (NCA or hybrid). The MOST common you will find are the ICR-type lithium cobalt oxide. It's the best for energy density and power, but has average to low discharge current and temperature threshold. The maximum discharge current for these is equal or at least double the capacity at most. Plus, they are less stable (read: dangerous) than the other types and need to have some kind of protection circuitry. Now, let's not confuse lithium-ion batteries with lithium-ion polymer batteries or LiPo batteries. In LiPo batteries the electrolyte, anode, and cathode, positive and negative terminals, are housed in polymer pouches. The internal chemistry is similar to lithium-ion cells. Depending on the device, the battery will be different in shape or size, but they are usually rectangular and thin for cell phones or compact devices, or cylindrical like 18650 (common in laptop batteries) or 18500 common in hump packs for cameras or camcorders.


In case you've ever wondered, the name of the battery contains its dimensions. "18650" means the battery is 18 mm in diameter and 65 mm long. The "0" is just hanging out. Regardless of the type or size, these may have a single cell, or multiple cells. Multiple cells are either in series or parallel, or a mix of both. Even small batteries can have two small cells inside connected in series or series/parallel. This is due to the fact that some devices have increased voltage needs more than a single cell can provide, or to add capacity. Series connections increase the voltage, and parallel connections increase the capacity of the pack. Unlike NiMH or NiCad batteries, lithium-ion battery packs will have some kind of protection device in them like a battery management system consisting of IC's and MOSFET's or resistors that regulate current, voltage, detect short circuits, reverse polarity, and temperature. Some have an added function of balancing the cells if there are multiple cells. Why do they need this? It's because the chemistry of the lithium cell makes it sensitive to over charging, over- discharging (draining until the voltage gets too low), short circuit, and even over temperature. Any of those can damage the cell, or worse, cause a fire. Multiple cell batteries in series need the balance function that makes sure each individual cell receives the same amount of current and voltage as the other cells. If one cell gets more charge than another one, it can wear out faster or get damaged. The capacity of the pack is also reduced. These types of batteries also require special charging procedures that NiMH or NiCad's don't. More on that later!


Now before we start digging into battery packs, I want to touch on some safety items specific to lithium-ion cells. If you're into RC and have electric vehicles and have experience with LiPo batteries, you can skip this, but if not, it's important to understand that messing with lithium-ion batteries can be hazardous. I learned this the hard way!


Why? Due to their chemistry, a single 18650 cell holds a lot of energy. Strap 6 or more together, and you have a lot of stored energy. The safety consideration comes if they are short-circuited, over charged, or under charged, or over discharged, the most common type of lithium battery heats up, swells, and can explode, or cause a fire from getting so hot, which we don't want.


The way to avoid this is to handle and charge them correctly. Most all lithium-ion battery packs or single batteries have some kind of protection circuitry built into them to protect the cell from being overcharged, short circuited, or over discharged. Multi-cell packs have an added feature called a battery management system with a balance function that monitors and distributes charge current and voltage across each cell, making sure each gets charged with the same amount of current and voltage. That said, you must use an appropriate charger, either for single cells or one that supports multiple cells in a pack such as a balance charger. Using any other charger could cause the lithium-ion cells to overcharge and result in a fire.


You have the battery, the tools, and now it's time to dig in. I am taking apart two battery packs in this tutorial. One is a generic 6-cell pack for an HP Pavilion Dv 5 to Dv 6-series laptop and a pack from an ancient (2004 vintage) digital camera rated at 7.4 volts and 1500 mAh. I think it has two cells inside, but we'll find out.


Depending on the type of battery, the basic design is going to be pretty much the same, consisting of a plastic outer casing containing a liner for insulation or cushioning (foam, silastic, tape, or paper), the cell(s), a protection device/board with its internal connections, either wires, tabs, or wires and tabs. By the way, I've noticed little to no difference in construction between generic (like the laptop battery) and genuine OEM (like the camera battery). Sometimes the case is welded or glued, but other times it's just held together with tabs. You will find out quickly which method the manufacturer uses. OEM batteries are usually glued/welded and cheaper ones are glued or clipped in.


I like to start at the corners of the case with the utility knife first. Find the seam between the two case halves. Inset the knife along the edge. Rock it back and forth to get it going in the case. It should sink in, so be careful not to go too deep and cut the cells or short something out. Once you get it going and have opened up a small gap, time to go for the screwdriver. Use the smaller screwdriver to open the gap further by twisting it. Once you get it opened more, go for the bigger screwdriver and repeat. You should start getting large creases in the case. Move the screw driver up the seam of the case, twisting as you go. If you aren't getting anywhere, go back to the knife and repeat the first step. I don't think I need to remind you to be careful here.

3a8082e126
Reply all
Reply to author
Forward
0 new messages