Running On Empty: Adventures in a Kia Niro EV

When a recent flight to Maine to see my family was cancelled due to weather and replacement flights were significantly more expensive, I decided to do the reasonable thing and rent a late-model plug-in electric car and drive something like 1000 miles round-trip.

The Kia Niro EV that I rented.

The figures available online led me to believe that I would need 2-3 recharging stops of about an hour each. With highway speeds comparable to those of a gasoline car, this would mean 2-3 extra hours. So my 8-9 hour trip would turn into a 10-12 hour one. No big deal, I thought.

The trip got off to a dubious start right away, since although the website said the fuel policy was full-to-full, it started off at 57%. I then found out that this meant that I’d be lucky to get 100 miles before needing to recharge. Sure enough, I wasn’t even out of NJ before I was looking for a charger. And then (maybe due to cold weather) the 10%-80% charging time was closer to two hours than the 57 minutes quoted online for a Level 3 charger.

I eventually found a charger station, waited long enough for an available charger to remind me of the 1970s gasoline shortages, waited another two hours or so for the 80% recharge, and continued on my way. Five or six long charging stops later, I eventually made it to my destination. 500 miles took some seventeen hours; I finally arrived just after 5AM, having picked the car up at noon, driving and charging/napping continuously since then.

The charging situation really points out internal-combustion vehicles’ superpower — fuel energy density. One liter of gasoline stores 31.54 megajoules (MJ) of energy, or about 9kWh. This is about 1/7 of the Niro’s total energy capacity; the equivalent amount of energy to charge the Niro completely (0% to 100%) would take maybe a minute or so for a gas pump to dispense. Gas pumps can transfer an astonishing amount of energy per minute.

Many (most?) of the chargers I encountered along the way were “350kW” chargers, apparently capable of charging certain vehicles at something like 8x the speed I was getting from them, since charging rate is limited by both the charger and car capabilities. Admittedly, charging on a cold winter day didn’t help, but this is one of the places where higher-end brands like Tesla distinguish themselves. Decreased charging time would 100% be my top suggestion for improving the Niro EV.

Most EVs are (technically) capable of charging from a 15A wall outlet, but naturally my rental didn’t have the proper adapter cable. Two days later, Amazon came through with the correct charging cable, and I could start recharging. Since the outlet is limited to ~1.5kW, a full charge from a wall outlet can take some forty hours(!) I left it plugged in for a day and a half.

The J1772 / CCS charging port, located on the front of the Niro EV.
The top connector is for control and (slower) AC charging; the bottom pins handle fast(er) DC charging.
A J1772 Type 1 charging cable for the Niro EV (and others).
It charges at ~15A / 120V — and can take some forty hours to charge!

In terms of driving, the Niro EV is a fun little car. Even in Eco mode (which I used for nearly the whole trip), it’s responsive enough to be driven safely — and in Sport mode, it’s actually fairly zippy (if you’re expecting normal-car performance and not Tesla’s Plaid Mode.) Visibility is good, steering, acceleration, and brake pedal respond predictably, and the car feels stable. Comfort is good enough, especially for a small car. There is plenty of cargo space, too; I’m a pack rat but didn’t even have to put the rear seats down in order to bring home several boxes’ worth of flea market finds. There’s at least one 12V power outlet, and several USB-A and USB-C outlets. Keeping the car charged was a challenge, but my phone stayed on 100%.

For drivers not used to modern conveniences, though, the driving-assistance functions steal the show. I was expecting some form of cruise control, since that’s been available since at least the 50s, and should be standard by now. The Niro turns out to not only have cruise control, but adaptive cruise control that can maintain a set speed and/or a set following distance to the car in front of you, slowing down and speeding up as needed. This greatly reduces driving fatigue.

There’s also a lane-keeping feature, which will actively steer the car to keep it in its lane (as long as you keep a hand on the wheel). Naturally, there’s a nice rear-view camera, too, as well as modern GNSS navigation and Bluetooth audio/phone connectivity. It will even help you find EV charging stations, although apps like PlugShare are far more up-to-date.

The driver’s display on the Niro EV, in its natural habitat (hooked up to a charger).

Living in the city, I usually don’t really have need for a car, and actually hadn’t driven to speak of since the Before Time. At one point, I had more miles driven backwards than forwards in the past two years’ time, and more miles piloting a boat under sail than both driving directions put together. In terms of familiarity with modern cars, my previous daily driver was a 1997 Ford Escort, which is probably less sophisticated than some 2024-model mopeds out there — gas pedal, brake pedal, speedometer and gas gauge, and not a whole lot more. Crank windows!

Lane-keeping seems to use video (probably mounted in the rearview mirror assembly), while adaptive cruise and the “front safety features” rely on a radar transceiver hidden behind a black plastic plate mounted underneath the front license plate. Coming back home through a snowstorm, I learned that this radar panel is prone to collecting snow and slush, and with enough snow built up, the radar stops working.

When this happens, the Niro throws a bunch of errors, disables the “smart cruise” features — and unfortunately, it doesn’t let you fall back to an old-school (“stupid?”) cruise mode, where the car simply maintains a set speed. Lane-keeping still works, but until you stop and clear off the snow, you’re stuck controlling the car’s speed manually with the pedal like it’s still the 1900s. (I’m guessing the lawyers didn’t let them run the cruise control in degraded mode since this might be confusing to drivers.)

Fortunately, on a long road trip, your next charging stop is never very far away, and once the radar plate is once again clear of snow, you’re back in 2024 flying your short-range spaceship. And at least you can run the heated seats and climate control while charging.

I love living in the future. I just wish it would charge a little more quickly.

Posted in High Voltage, Power, Reviews, Toys | Tagged , , , , , , , , , | Leave a comment

Mini Museum: Arduino Uno

The Arduino Uno has been an important part of the electronics hobbyist scene its release in 2010 (as a refinement of earlier boards such as the Arduino Duemilanove.)

A typical Arduino Uno R3 microcontroller board.

I picked one up in 2011 to see what this new “Arduino” craze was all about, and discovered what is still to this day the easiest way I’ve found to get a microcontroller-based whatever up and running. The Arduino IDE, and especially the included libraries and example sketches, make programming as easy as it gets (at least, for the era before LLMs could plausibly write most simple sketches for you.)

Due to its popularity over the past fourteen years or so, the Uno is still somewhat relevant in the Maker community, although it is inevitably being replaced by newer boards such as Espressif’s ESP32. But the IDE and libraries have proven so popular and easy to use that even newer boards like the ESP32 can be readily programmed in the Arduino IDE, once you have downloaded and selected the appropriate core.

The example in the Museum is a garden-variety Arduino Uno R3 board — the “default” model of Arduino. If someone talks about an “Arduino” project and doesn’t specify which board they used — it’s a good bet it’s this one. The Uno is, at least currently, the poster child for all things Arduino, and it deserves its small but important place in the Museum.

Working with a 16MHz, 8-bit microcontroller with 32kB of Flash in 2024, on a workstation with an AI-capable GPU with over a thousand cores does seem quaint — but the Arduino ecosystem (mostly, the libraries) was and is absolutely a revolution in hobby electronics.

Arduino Uno specs:

  • Microcontroller: AVR Atmega328P (20MHz, 8-bit, 32kB flash, 2kB RAM, 1kB EEPROM)
  • Operating voltage: 5V (USB, or 7-12V DC supply via onboard regulator)
  • Analog input pins: 6 (A0 through A5; these can also do basic digital I/O)
  • Digital I/O pins: 14 (6 capable of PWM output)
  • Interface: USB-B
  • Compatibility: Windows / Linux / Macintosh
Posted in Arduino, C, Coding, Digital, Electronics, Mini Museum, Tools, Toys | Tagged , , , , , , , , , | Leave a comment

Components: Capacitors

Capacitors: More Than Just Stored Charge

Capacitors are everywhere in modern electronics, from tiny capacitors on microprocessor boards to the massive ones that help start large motors. They are essential components, often taken for granted, yet understanding how they function can give us insights into everything from power smoothing to signal processing. In this post, we’ll explore the fundamental properties of capacitors, their behavior in circuits, and some practical applications.

Various types of capacitors. (Image: Wikimedia)

Basic Mathematical Model: How Capacitors Work

At its core, a capacitor is a device that stores electric charge. It consists of two conductive plates separated by an insulating material (the dielectric). When voltage is applied across these plates, positive charge builds up on one plate, and negative charge on the other, creating an electric field. The amount of charge a capacitor can store per volt applied is called capacitance, measured in farads (F).

Capacitors Oppose Changes in Voltage

A key property of capacitors is their ability to oppose rapid changes in voltage. This property, related to the equation I=C*dV/dt, means that when a voltage across a capacitor changes, the capacitor either charges or discharges to oppose this change. In other words, capacitors “smooth out” sudden shifts in voltage, which makes them valuable in both DC and AC applications.


Capacitor Behavior at DC and AC

Behavior at DC

In a DC circuit, once a capacitor is charged to the applied voltage, it essentially behaves like an open circuit. No more current flows, and the capacitor simply stores charge. This is why, in many DC applications, capacitors are often used for energy storage or smoothing, as they can provide short bursts of power when needed but do not continuously conduct current.

Behavior at Increasing Frequencies

In AC circuits, capacitors act very differently. As the frequency of the AC signal increases, capacitors allow more current to flow. This behavior is due to their impedance, which decreases with frequency, given by Z=1/(jωC), where is the angular frequency. This property makes capacitors useful for filtering applications, as they can “pass” higher frequencies and “block” lower ones.


Basic Uses of Capacitors

Power Decoupling: Filtration and Smoothing

One of the most common applications for capacitors is in power decoupling. In digital circuits, especially where microprocessors and other ICs are present, there are often rapid fluctuations in current demand. Without decoupling capacitors, these fluctuations can lead to noise on the power supply lines, which can disrupt the operation of sensitive components. By placing capacitors across the power supply, these spikes in demand can be smoothed out, as the capacitors act as local charge reservoirs.

AC Coupling of a Signal

Another vital use for capacitors is in AC coupling, which is essential for isolating the DC component of a signal. In audio circuits or amplifiers, capacitors are often used to “block” any DC bias while allowing the AC (signal) component to pass through. This is commonly referred to as “capacitive coupling,” and it ensures that each stage of a circuit can be biased independently while still passing the signal along.


Sample Circuits Featuring Capacitors

Let’s look at a few practical circuits that demonstrate how capacitors are applied:


  1. Low-Pass Filter: One of the simplest applications of a capacitor is in a low-pass filter, where it’s paired with a resistor to create a circuit that allows only low frequencies to pass while attenuating higher ones. In this case, the capacitor blocks high-frequency components, acting as a filter to remove noise or unwanted high-frequency signals.



  2. RC Timing Circuit: Capacitors are also crucial in timing circuits. When combined with a resistor, the time it takes to charge or discharge a capacitor can be carefully controlled, creating predictable delays. This concept is essential in applications like timers and oscillators, where precise timing is needed.



  3. Decoupling Network: For digital systems, capacitors are often placed close to ICs in parallel with a power supply line to act as decoupling capacitors. By filtering out transient voltage spikes, they ensure the ICs receive a stable power supply.



Additional Capacitor Considerations

Capacitor Types and Their Applications

Not all capacitors are created equal. Depending on the application, you might encounter ceramic capacitors, electrolytic capacitors, tantalum capacitors, and more. Each has unique characteristics and is suited to specific tasks. For instance, ceramic capacitors are generally used for decoupling due to their low equivalent series resistance (ESR) and stability, while electrolytic capacitors are often preferred for bulk storage in power supplies due to their high capacitance values.

ESR and Leakage

A capacitor’s equivalent series resistance (ESR) is another important factor, particularly in high-frequency applications where lower ESR capacitors are desirable for efficiency and stability. Additionally, capacitors aren’t perfect insulators and often exhibit leakage, where a small current continues to flow through them even when fully charged. This leakage can be significant in sensitive circuits and should be accounted for during design.


Conclusion: Small but Mighty Components

Capacitors may seem simple at first glance, but their unique properties make them indispensable in nearly every branch of electronics. Whether they’re being used to smooth out power, couple AC signals, or provide precise timing, capacitors are essential tools in the engineer’s toolkit. Understanding their behavior and how they can be used to manipulate signals or control power can deepen your appreciation of both the versatility and elegance of electronics.

This article was coauthored by GPT-4o.

Posted in Components, Electronics | Tagged , , , , , | Leave a comment

Cómo se llama su LLAmA?

Large Language Models (LLMs) such as ChatGPT are dramatically changing how many information tasks (notably, writing code) are done. Thus far, these models have generally required extremely powerful servers, running multiple H200 tensor core processors, sometimes with hundreds of gigabytes of available memory.

Recently, though, there has been a good deal of success in paring these huge models down to a size where modern home PC workstations (or apparently, even a modern Raspberry Pi!) can run them. In just a few minutes, I was able to download “Ollama” server software for Meta’s “Llama” LLM models, select a model to try, and host it locally on my PC. With a little more setup (setting an environment variable to get the server to listen to the local network and not just 127.0.0.1), the Llama server was available across my local network — and I was able to chat with it via a Llama client app for my Android phone.

As a test, I asked the first model I tried (Llama 3.1) to write an article for this blog, describing how to set up a similar Llama server. Oddly, it insisted that it could not help with this, since Meta’s LLM models are not intended to run on home servers. (It even stuck to its guns after I pointed out that it was, in fact, running on my main home PC workstation, Scientia.)

So I loaded up Llama 3.2 (a smaller but newer model), and gave it the same request.
Here’s the response I got — pasted directly from the text file I used to save it.

Setting Up Your Own LLaMA LLM Server: A Step-by-Step Guide

The Llama Large Language Model (LLM) has revolutionized the field of natural language processing, enabling rapid advancements in areas such as conversational AI, text generation, and more. While access to pre-trained LLaMA models can be limited, setting up your own server at home can provide unparalleled flexibility and control over the model’s configuration.

Hardware Requirements

Before embarking on this project, it’s essential to understand the hardware requirements for popular LLaMA model sizes:

  • Small: 8-16 GB RAM, NVIDIA Tesla V100 or A100 GPU (optional)
  • Medium: 32-64 GB RAM, NVIDIA A100 GPU
  • Large: 128-256 GB RAM, multiple NVIDIA A100 GPUs
  • Huge: 512-1024 GB RAM, multiple high-end NVIDIA A100 GPUs

For a home setup, it’s recommended to start with the Small or Medium model sizes. This will allow you to test and refine your LLaMA server without incurring significant hardware costs.

Setup and Configuration

To set up your own LLaMA LLM server at home, follow these steps:

  1. Choose a Hardware Platform: Select a suitable platform for your server, such as:
    • Raspberry Pi (for small models)
    • NVIDIA Tesla V100 or A100 GPU-based servers (for medium to large models)
    • High-end desktops or workstations
  2. Install the Required Software:
    • Install the PyTorch library and its dependencies.
    • Configure your system’s network settings for optimal performance.
  3. Download the LLaMA Model: Use the official Hugging Face repository to download the desired LLaMA model size.
  4. Prepare the Dataset: Prepare a suitable dataset for fine-tuning the LLaMA model, such as a large text corpus or a custom dataset of your choice.
  5. Configure the Training Script: Write a training script using PyTorch and customize it to suit your needs. You can use the official Hugging Face LLaMA training script as a starting point.

Tips and Considerations

  • Power Consumption: Be mindful of power consumption when choosing hardware, especially for larger model sizes.
  • Memory and Storage: Ensure sufficient memory (RAM) and storage to accommodate the LLaMA model and your dataset.
  • Cooling Systems: If using high-end GPUs, consider investing in a reliable cooling system to prevent overheating.

Conclusion

Setting up your own LLaMA LLM server at home can be a rewarding experience for AI enthusiasts and researchers. By following these steps and considering the typical hardware requirements, you can create a custom setup that suits your needs. Remember to carefully evaluate power consumption, memory, and storage requirements to ensure optimal performance.

Despite what it claims about the availability of trained models, this was produced by an as-downloaded copy of Llama 3.2 without any additional local training or prompt engineering. Not bad, for a free, relatively easy-to-use model that I can run on existing hardware and have as a local resource. I think I’ll still keep my GPT subscription, but it’s definitely impressive to be able to host your own LLM at home. (And the responses are fast — much faster than I’ve seen even with quick cloud-hosted models like GPT-4 Turbo.)

I love living in the future!

Posted in Uncategorized | Leave a comment