Sunday, July 12, 2015

In the Windows 10 Era: Microsoft Wins, Intel and AMD Vie for Scraps

For the last 25 years, there has been a dominance in the computer industry: WINTEL, a nickname for the Microsoft & Intel dominance.  It has varied over the years - AMD rose up to challenge Intel, Microsoft has had challenges including government charges and Apple.
How did they do it: Microsoft built Windows versions which used more system resources.  Intel would build processors (and chipsets, and other items) that would be more powerful to meet Windows' demands.  With special catering to business and enthusiasts, this teaming provided growth and revenue for both companies year after year.  Governments investigated various times when dominance was against consumer rights but generally the progress was steady.

The entire mountain is now in collapse.  Let's look at things:


After the failure that was Windows Vista, corporate clients have stuck with Windows XP basically until the bitter end.  This has reduced Microsoft's income from sales of operating systems.  Windows 7 has been adopted by many but corporations have trimmed IT budgets to the point where what IT staff have been left have not wanted to move their constituency off XP and Windows Server 2003.  This late switching costs Microsoft revenue.  

Microsoft has also attacked windmills left and right - Lotus, dBase, Wordperfect, Google, Apple, many more over the years - whenever they foresaw a threat, they would try to outdo the threat through skill or maneuvering, always using up valuable resources (usually to little end for the consumers).

Most shops shifting off Windows XP have chosen Windows 7, lowering revenue and compatibility of the current Windows 8 frontline system.


The confluence of several issues:
1) With the lag in software sales, the amount of new hardware being purchase has slowed, with chip sales in a huge slump.
2) The tablet market slowed sales of traditional desktop and laptops significantly.  Intel has been late to the low power mobile space with cool, efficient, powerful chips.

Intel has hoped to keep the high end computing market going, especially as new servers are required.  But Intel has had problems with their 14nm chip fabrication, needed to reduce chip power and size (size = more chips per wafer, making more money).  Intel's process tick-tock release schedule (improvements, then shrink in size, then more improvements, etc., is seriously stalled with newer chips not on a new process or with significant hardware improvements.  Some say the hardware improvements have actually been stagnant since 2011.  Intel's withheld 6 core and higher core chips from affordable consumers.

Hardware's Downfall: Windows 10

With Steve Ballmer gone, Microsoft's new CEO is trying to save the company in the face of the above scenario coupled with threats from Apple and cloud computing.  Windows 10 upgrades for many for free will be a huge boon to capturing customers.  And Windows 10 can run on some hardware that is 8 to 10 years old, breathing life into hardware already paid for.

Few people will now be buying many new Intel (or AMD) chips just to run Windows 10 like they might have for new versions of Windows in the past.  Why when it runs well on current and past hardware?    Intel and AMD stock has tanked and Intel has lost some key management.

The key is to watch what companies may do - stay on Windows 7 until end of life or adopt Windows 10.  Microsoft must include features in the OS worth upgrading to - both for home and office users.  Do not do it through past trickery, but do it through winning over customers with superior product & service.  Focus on your core and that's what they've done this month.

Hardware - a Possible Path

Intel must cut hardware costs.  They have a very high margin for current chips.  If new fabrication plants will be spun up slower, funnel the money into cheaper chips, fueling savings and making stock holders see Intel is not down & out.  Also allow for cheaper 6 core chips (about $350) and 8 core chips ($499).  They are in your servers, allow them on the desktop.

If Intel cannot move hardware down a bit, then perhaps AMD can move in in the budget space.  But they'd better look to advertise how well their chips run Windows 10.

Where do you see the market?

Saturday, June 20, 2015

Comparing Microcontroller + Wifi Breakout Boards

There was a large interest in last week's post on WiFi solutions for microcontrollers.  These days Makers are often looking to choose development boards that contain both a microcontroller and a WiFi transceiver. There are many benefits:

  • The solution is pre-made and debugged - ready for integrating into a project
  • Size is often smaller
  • FCC certification is most often done for the module
  • Often cost is lower than separate WiFi and microcontroller breakout boards
With that, here is the comparison:
For a larger view, click here
and here are the caveats:
  1. The data is gathered via the whole web and the web is often wrong, so don't take every value as fact, use it as a value which you can check if interested.
  2. Some of the prices have a "+" next to them - those boards require additional circuit boards with breakout capabilities, power, etc.
  3. Some boards are due out in the next 3 months, noted in "Availability"
  4. Some values are not clear from manufacturer data, so the values may be from components or left as unknown.
  5. Prices can vary, they are retail prices and probably have shipping, taxes, etc.  For the ESP-12, they are available from eBay to retailers, the amount of Flash memory may vary depending on how they were manufactured.  Also FCC markings may or may not be valid depending on manufacturing to the tested configuration.  Companies using ESP8266 modules generally buy FCC compliant subsystems.
  6. Wireless boards that do not have 802.11 b/g/... WiFi were not compared.  That would be for a separate comparison.
  7. All boards were TCP and UDP capable (as far as I saw) and can do Client and Server duties so I didn't compare those characteristics.
  8. The data may change over time (especially price), and additional boards will become popular.
I didn't add the ESP8266 ESP-01 module to this list although it qualifies.  See last week's post and use the ESP-12 values with only 2 GPIO, no analog pin and costing a bit less.

I didn't add every board on the market.  I am trying to keep the list to popular and commonly available boards.  You can use the table to compare features with other manufacturer's boards.


I am very happy that we are not stuck with the status quo of 3 years ago, where adding a WiFi capability to a microcontroller board costs over $75.  Manufacturers know that the Internet of Things really needs small, low cost, programmable WiFi communications and control devices.

Some of these solutions have very good cloud infrastructures provided by the manufacturers to program and communicate.  These may help overcome the learning curve for programming and/or it may provide easier methods for Internet communication.  The downside could be if the manufacturer decides to leave the product, the web service could close.  

As for Arduino IDE programmable capability, this is as of today and is for the versions of the software.  Many boards are billed as "Arduino compatible" but that may be electrically or programmable via a similar language.  Personally I like the ability to take code from existing projects and libraries and use them on a different board.  I recently ported NeoPixel and LED matrix code to the Adafruit Huzzah.


The choice of what product to use is up to you.  Everyone has their top requirements which could be compute power, connectivity. price, etc.  For a large segment of the market, price is a large factor.  Then again size for wearables may be a factor - all these modules are fairly small but may require larger batteries for long life.

If you like these comparisons, leave comments on what else would be good to compare.  And again, if there is an error, leave a comment and I'll look to change the inaccuracy.


Here are primary links to the boards.  Some of the information in the table is from other sources web-wide.

  1. Adafruit Huzzah ESP8266
  2. NodeMCU Version 2
  3. Generic ESP-12 (not E)
  4. Electric Imp imp001
  5. Intel Edison
  6. Particle Core
  7. Particle Photon
  8. WiPy WiPy
  9. Digistump Oak

Sunday, June 14, 2015

Comparing Modern Microcontroller WiFi Solutions

Comparing modern microcontroller WiFi solutions, even in the Internet age, requires a great deal of searching.  So to provide a list of popular microcontroller WiFi transceivers, I compiled the data in the table below.

    Product Info:          Link                  Link                 Link                 Link               Link                Link

Note 1: Also comes in Arduino Shield size with SD card slot for $39.95
Note 2: Adafruit and Sparkfun sell tested units with AT Firmware for $6.95.  eBay prices and quality vary.
Note 3: Adafruit sells tested units with AT Firmware for $6.95.  eBay prices and quality vary.
Note 4: Currents are probably somewhat higher than stock ESP-12 due to onboard LED and regulator.  

The data should be taken as  informative, not authoritative.  I may have not gotten the data 100% correct or comparing some information may not be a one-to-one comparison.  The cost information is in United States dollars - prices in other countries are comparable but may vary.

If there is data that appears incorrect, please leave a comment on the blog and I will see about correcting things.

Why these devices?

I tried to choose the most commonly used WIFi devices today.  There are several smaller manufacturers with WiFi boards and there are devices like the NodeMCU DevKit that implements an ESP-12 board with similar features to the Adafruit Huzzah ESP8266.  Sparkfun also sells a CC3000 board similar to the Adafruit Huzzah CC3000.  So the table does not list all available boards but does have a number of the more popular / different boards.  There are also some WiFi radios in Xbee form factors (one is in the picture, upper right) but use of the Xbee socket has waned in the last two years.

My thoughts

Like many experimenters, I have some criteria and  requirements for specific projects.
  • Price is always a factor, from hobbyists on a budget to groups manufacturing large product quantities.  There are generally three tiers of pricing.  Older modules cost above $70 US.  The CC3000 brought reliable communications down to half that, at about $35.  Then the new ESP8266 based devices have shattered the price points at $10 or less.
  • Software is one of my factors (and I'm sorry it isn't in the table). The WiFi Shield is a benchmark for many developers for a standard.  I rate Adafruit's CC3000 comparable on use, better on examples - Adafruit's tutorials on device use are very good (I'm biased having written for them some).  The ESP8266 information was pretty poor in the beginning but the number of people experimenting with these modules has generated a great increase in information.  So I rate ESP8266 as still a bit "wild west" but getting better.
  • Usability is a factor for specific projects.  Arduino shield form factors are easier for beginners but typically use more power, are larger, and are convenient only for those boards that have shield sockets.  Smaller boards are much easier to put into finished projects and novel uses such as wearable electronics.  This is a factor for each individual to judge.
  • Power must be considered for battery-operated projects.  Arduino shields do not lend themselves to low power.  The CC3000 has very good power management with one Adafruit tutorial providing excellent information.  Use of ESP8266 in low power modes is possible but standard examples are elusive.
Other criteria you might have are: manufacturability (putting chips into custom solutions), features (does the solution have what I need), etc.

Product lines are continually evolving.  Espressif has two new chips on their website which may lead to more hobby solutions and other companies may be working on new designs.


WiFi radios are very useful as many different types of devices, from cell phones to tablets, laptops to desktops, can communicate with these boards.  But most WiFi radio signals do not travel great distances.  They are also not very tolerant to data loss.  Other radio frequency solutions may be better for different applications.  But for ubiquity (finding these everywhere), WiFi is hard to beat.  That and they "speak" the language of the Internet (TCP and UDP), so a project could communicate (via a gateway device) with devices anywhere around the planet.

Saturday, June 13, 2015

ESP8266 Basics and Direction

The ESP8266 has become the price/performance darling of the Maker community.  What is not to like: small size, connectivity, powerful microcontroller.
ESP8266 Modules - the ESP-01 on the left, the ESP-12 module on the right

Well, there are frustrations.  Wiring the modules is not so easy, as pinouts are not breadboard friendly.  The microcontroller is new and not well documented in English, with some information proprietary, yes not Open Source (but processors generally are not fully open).

So what is driving the interest: size and cost.  The ESP-01 module is 14.54 mm x 24.9 mm(about an inch by a bit over half an inch - tiny compared to modules that proceeded it (which did not include a microcontroller).  And the cost of the ESP-01?  $6.95 from Adafruit (flashed with a reliable firmware and tested) down to $2.88 or so on eBay from China.  Compare to a $25 Arduino Uno and a $35 CC3000 wifi module.  A tenth the cost or less and perhaps a tenth the size.

The basic ESP-01 version has limited input/output pins.  Other models,up to the ESP-13 have additional pins of the microcontroller available.  A list of various versions is at

So if you see the connections on the modules above, The ESP-01 has two rows of 4 pins, making it hard to breadboard.  The ESP-12 module has metric pin spacing which does not connect to 0.1 inch breadboard spacing.  What to do?  Various people have various solutions.  On the ESP-12, companies have mounted them to larger 0.1" boards.  From plain carriers on eBay to Adafruit's new Huzzah board.


The following data are based on a 3.3V power supply, ambient temperature 25C and use the internal regulator measured. Data is from
802.11b, CCK 1Mbps, POUT=+19.5dBm215mA
802.11b, CCK 11Mbps, POUT=+18.5dBm197mA
802.11g, OFDM 54Mbps, POUT=+16dBm145mA
802.11n, MCS7, POUT =+14dBm135mA
802.11b, packet size of 1024 bytes, -80dBm60mA
802.11b, packet size of 1024 bytes, -70dBm60mA
802.11b, packet size of 1024 bytes, -65dBm62mA
Deep sleep10mA
Saving mode DTIM 11.2mA
Saving mode DTIM 30.86mA
The units should never be powered off more than 3.3 volts DC.  Using a voltage other than 3.3 volts, you will need to use a power regulator.  Looking at the power requirements above, a 250 ma regulator like the L4931-3.3 is pushing the limit.  If you are breadboarding, most people appear to be using the LD1117.3.3 800 ma linear regulator which gives plenty of current without requiring a heat sink on the regulator.  It is best to use a 10 microfarad capacitor on the input and especially the output to keep the output smooth.  If you are breadboarding only, there are breadboard power supplies that make it easier to generate 3.3 or 5 volts when you want it.


There are currently two general variations on firmware.  The first implements an "AT" command set to instruct the module how to connect via wifi.  A second firmware has been developed by NodeMCU implementing the Lua scripting language.  There are some other firmware images including one implementing the MQTT protocol.

User Software

Some smart folks have added the Espressif code compiler to the Arduino IDE.  This allows for the average person to write code that runs on the ESP8266 board itself (no Arduino or other controller required).  This makes it exciting that in a one inch size board, you have a complete Internet of Things node.

Where to go from here

While Lua allows for web apps with a small amount of code, I believe there is a great deal one can do to interface hardware with the ESP modules and compile code directly.  As a person who has done Arduino code for 2+ years (and a C die hard), that's where I'll be looking to provide projects.

For my first published project, See an ESP-01 connected to a temperature and humidity sensor, available via any web browser - at

Saturday, April 25, 2015

Arduino Packaging

Adafruit made an interesting suggestion regarding the Arduino vs. Arduino lawsuit. Adafruit noticed that the packaging for the Arduino Uno and Leonardo includes a pamphlet that states:

Manufactured under license
from Arduino by

Smart Projects is the former name of Arduino Srl. Arduino Srl is claiming to be the trademark holder and has forked the Arduino IDE.

If Arduino Srl feels they own the trademark, why would they include this statement in their packaging?

Here are my package inserts from retail Arduino packages over the past couple years.  They all have the license text.

Unlike Sparkfun who decided to walk a line between the companies, I believe the - the original founders - as holding the Arduino ecosphere rights (it was their creative work from which the project was born).

Monday, April 6, 2015

Using the Arduino IDE to Program the Raspberry Pi and Other Devices

Ever wish you could prototype a Raspberry Pi program as easily as prototyping on Arduino?

The Arduino IDE allows nearly any processor to be programmed with the same easy to use language. Back in 2012, this was possible: it takes architecture changes by the Arduino group (, some programming by code library developers (,, many others), and from users to get all of this working.

The parts are now in place to do this: the latest Arduino IDE releases are in a new 1.6.x branch, the latest as of this article is 1.6.3.  This release is revolutionary in having the following:
  • A new library manager - libraries can be installed with several clicks from a website without downloading code and installing it in a specified place on the user's PC.
  • The capability to specify new boards that are not quite the same as Arduino boards. Companies have done this by hacks and creating special versions of the Arduino IDE which can get confusing after a bit.
  • A mechanism to easily specify and use code compilers other than the Atmel AVR.  The Atmel SAM series is available after installing the 1.6.3 version if you request it. 
In the same manner as the SAM (Arduino Due) capability can now be an add-on once the initial IDE is installed, other companies are working (quickly) to add the capability to incorporate their products. Obvious candidates include:
  • Non-Arduino Atmel AVR boards
  • Arduino "compatibles" - like the Teensy series which is very popular
  • Boards based on ARM cores Cortex M0, M0+, M3, etc.
Take this a step further.  While running "simple minded microcontroller code" on more powerful boards seemed nonsensical not long ago as cost inefficient, those costs have plummeted. Development boards using powerful processors have come down in price thanks to Raspberry Pi, BeagleBone, and many others.  The $50, $35, $25, $12, and $8 price points all have different boards that can be used.  Even at $2 to $5, new boards like the ESP8266 Wifi controller are coming in.  So, extend your thought to using the Arduino IDE to actually run Arduino code (not just program an AVR) on:
Some will say "Why Arduino?"  The Arduino IDE and language specification, started in 2005 and extended since, has a proven track record for allowing users to easily get code running that actually interacts with the "real world".  Millions of lines of Arduino code have been released under open source licenses, allowing reuse by anyone. With such a vast repository, why not leverage this onto other microcontroller and microcomputer architectures?  With the compatibility to use C and C++ code, it is even more compelling.

Raspberry Pi as an Arduino Target

If I have some interesting Arduino code, say for controlling a near-field card reader, and wanted to port this to Raspberry Pi, I'd face a tough choice.  Think about reprogramming in Python and hope there is manufacturer library support for Python, or consider programming in C and know that I'd have to rewrite the Arduino library to work on the Pi.  Unsavory choices.

If the Arduino IDE would create a Raspberry Pi Linux executable of my Arduino sketch (program), I'd be nearly done.  Due to differences in programmable pin (GPIO) numbering, some items would require changes but those are numbers and not wholesale code structure changes.
This could increase (rapidly) the available uses for a Raspberry Pi.

With a huge body of Open Source coders who may have the interest and time, I looks like there will be many more places where we will see Arduino code running.

Friday, March 27, 2015

Arduino Day 2015 Project - Air Quality Display

Arduino Day gives folks the opportunity to showcase their work with these easy to use microcontrollers.  Today's project is something I've wanted for awhile: an Internet connected air quality display.  Folks looking to go outside want a quick glance look at how the air quality is that day.  This includes runners, those with breathing problems, and young children.


There are several blocks to the project, both hardware and software:
  • Arduino Uno Microcontroller
  • Arduino Ethernet Shield
  • Adafruit LCD Display (select one that does not require hardware SPI that conflicts with the select line).
Software used:

How it works

The ethernet shield is connected to your home network.  The software sketch ensures all the pieces are communicating, then it obtains the air quality based on the latitude and longitude of the project.  This is available in the United States for free from the U.S. Environmental Protection Agency (EPA) via their free AirNow API.  In other countries, there are some data service providers, the code would need to be written to read the other service's API and data, see the list at 

Once the data is collected, the specific data desired is parsed out of the HTTP code and API output.  Then the data is written to an LCD display.  A color display is important as the U.S. EPA has specific colors for specific air quality levels:

AQI NumbersAQI Category (Descriptor)AQI Color  Hexadecimal Color ValueCategory Number
0 - 50GoodGreen  (00e400)1
51 - 100ModerateYellow  (ffff00)2
101 - 150Unhealthy for Sensitive GroupsOrange  (ff7e00)3
151 - 200UnhealthyRed  (ff0000)4
201 - 300Very UnhealthyPurple  (99004c)5
301 - 500HazardousMaroon  (7e0023)6
So the display should be clear seen from a distance using the EPA colors what the status is.  For a 24 bit (3 byte RGB) color display, the color values specified above can be sent.  I tried to use two other displays: a large touchscreen (conflicted with the Ethernet SPI control) and a display shield (I probably have a wiring issue with it) so I jumped to a trusty display I have written about used with the Arduino Esplora.  The problem is it is discontinued and it is only 16 bit color.  SO I had to tweak the Adafruit driver library code to compile under the Arduino IDE Version 1.6.x and to use 16 bit colors.  I have tried to get similar colors but I suggest you select colors that you find are closest to the colors above.  If you can find a color picker for 16 bits, place a comment below.

You will need to get an API key from  The key is free but you need to sign up.  Replace my key in the code (please!) with your own.


I'll admit the code is not as elegant as that in many of my Adafruit tutorials.  I had to change displays late in the project.  And I did not use a GPS shield to keep the project simple but that does not help in portability.  Also I've selected the US service with a link to other countries' air quality services.  Each will probably have their own data format which will require the correct code to parse the data, that has not been done here except for the US formatting.  I'd like to have several projects from simple to more complex to show the variations, but life intervenes....

  Air Quality Monitoring
  Uses the Arduino Uno, Ethernet Shield, and Adafruit 1.8"
  display shield

  Check out the links above for our tutorials and wiring diagrams

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Based on code written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
#include <Ethernet.h>
#include <SPI.h>      

#include <Adafruit_GFX.h>      // Core graphics library
#include <Adafruit_HX8340B.h>

// Display Color definitions
#define BLACK           0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0  
#define WHITE           0xFFFF
#define ORANGE          0xF500

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Ethernet shield MAC address

char server[] = "";    
IPAddress ip(192, 168, 0, 178);  // select for your home network - it will try DHCP first though

EthernetClient client;

uint8_t lineCount = 0;

// TFT display will NOT use hardware SPI due to the SPI of the Ethernet shield
// SO other pins are used.  This makes the display a bit slow
#define SD_CS     4   // Chip select line for SD card
#define TFT_CS    9   // Chip select line for TFT display
#define TFT_SCLK  6   // set these to be whatever pins you like!
#define TFT_MOSI  7   // set these to be whatever pins you like!
#define TFT_RST   8   // Reset line for TFT (0 = reset on Arduino reset)
Adafruit_HX8340B tft(TFT_MOSI, TFT_SCLK, TFT_RST, TFT_CS);

void setup(void) {

  Serial.println(F("Air Quality Monitor"));
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  // Give the Ethernet shield a second to initialize:
  Serial.println("Ethernet connecting...");
  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("Ethernet connected");
    // Make a HTTP request
    // Change the latitude/longitude for your location
    // You need your own API key from pasted into the string below
    // If you will go mobile, get lat/long from GPS or from your outward IP address
    //   from a service like
    client.println("GET /aq/forecast/latLong/?format=text/csv&latitude=38.8&longitude=-77.3&distance=25&API_KEY=FE62B688-EE27-4214-8BD8-9903E1AC5881 HTTP/1.1");
    client.println("Connection: close");
  else {
    // If you didn't get a connection to the server:
    Serial.println("Ethernet connection failed");
  tft.begin();           // Initialize  TFT
  tft.setRotation(1);    // Landscape display

void loop() {
  char buffer[160];      // The HTTP read buffer - the maximum line returned by the API is 158 chars
  char partInfo[4][10];  // The air quality values are placed in 4 strings of length 10 characters
  uint8_t tokenCount, valueCount;
  char *bufValue;
  char *bufPtr;

  if (client.available()) {
    byte numChar = client.readBytesUntil((char)0x0a,buffer,159);  // Read until a line feed character
    lineCount = lineCount + 1;
    if(lineCount == 11) {  // Parse first record
      Serial.print("-> ");
      bufPtr = strtok(buffer,",");
      while(bufPtr != NULL && valueCount < 10) {
        if(valueCount > 5) {
          strcpy(partInfo[tokenCount], bufPtr+1);
        bufPtr = strtok(NULL,",");
      for( uint8_t i=0; i<4; i++) {
        for( uint8_t j=0; j<10; j++) {
          if(partInfo[i][j] == '"') {  // the second quotes is the end of the string we want
            partInfo[i][j] = '\0';     //   so replace it with the C null end of string character
    } else {
      Serial.print(": ");

  if (!client.connected()) {
    Serial.println("Ethernet disconnecting.");
    /* process the values */
    uint32_t colorAQI = AQI2hex(atoi(partInfo[1]));
    //Serial.print("Color set: ");
    drawtext("Air Quality Today", BLACK, 2, 10, 10);
    drawtext(partInfo[3], WHITE, 3, 40, 40);
    drawtext(partInfo[1], WHITE, 3, 85, 80);
    drawtext("Type:", WHITE, 3, 20, 120);
    drawtext(partInfo[0], WHITE, 3, 110, 120);
      ; // Infinite loop, press reset button to get daily reading
        // It's best to have a real time clock to pull the value at midnight
        // Perhaps a GPS shield would get the time and the lat/long but be sure 
        // to deconflict the data pins if necessary.

uint32_t AQI2hex(uint16_t AQI) {   // see color tablee for mandated color coding
  if(AQI <=  50) return(GREEN); // Green
  if(AQI <= 100) return(YELLOW); // Yellow
  if(AQI <= 150) return(ORANGE); // Orange
  if(AQI <= 200) return(RED); // Red
  if(AQI <= 300) return(MAGENTA); // Purple
  return(0x8000); // Maroon

void drawtext(char *text, uint16_t color, uint8_t tsize, uint8_t x, uint8_t y) {
  tft.setCursor(x, y);