ESP32 E‑Paper Status Display

ESP32 E‑Paper Status Display

Using an ESP-32 board with an embed­ded E‑Paper dis­play, I cre­at­ed a gad­get that shows sta­tus infor­ma­tion from my web server.

E‑Paper, also known as E‑Ink, only needs pow­er when being updat­ed, and uses no pow­er between updates. This means that the gad­get can be pow­ered for weeks from a recharge­able battery.

The pur­pose of this gad­get is to put on my wall or desk, and show reg­u­lar­ly updat­ed impor­tant infor­ma­tion on my web serv­er, to keep informed of web site prob­lems and sta­tis­tics. The infor­ma­tion dis­played can be eas­i­ly changed, for exam­ple to the lat­est weath­er, news, cur­ren­cy prices or any­thing that can be accessed via the inter­net. E‑Paper means it uses a very small amount of pow­er and heat, com­pared to a com­put­er dis­play or television.

You can view my code on GitHub if you are inter­est­ed in mak­ing your own.

ESP32 E-Paper Display
ESP32 E-Paper Display
ESP32 E-Paper Display
Using a Cellular/Mobile Phone Network to Send Data with Arduino/Embedded

Using a Cellular/Mobile Phone Network to Send Data with Arduino/Embedded

Today I used an Arduino repro­gram­ma­ble elec­tron­ics board and a GSM/GPRS modem to send data to the Inter­net. This will be use­ful for the sen­sors I intend to build.

You can see a video of it oper­at­ing below. One win­dow shows the out­put from the ser­i­al inter­face as it makes a request to my web serv­er and out­puts the response, and the oth­er win­dow dis­plays the access logs on my web server.

I used a soft­ware UART (par­al­lel and ser­i­al data con­vert­er), as using the Arduino’s built-in ser­i­al inter­face caused con­flicts. Learn­ing to use a soft­ware UART is going to be very use­ful for the next step in the project.

I did con­sid­er mak­ing a Cat Facts for Arduino, but I resist­ed the distraction.

I did­n’t have any issues with pow­er spikes caus­ing a reset (the GSM board uses a lot of pow­er) as this is a ver­sion 2 board with soft start circuitry:

Soft Start Circuitry
Soft Start Cir­cuit­ry (Source)

I also used AT codes to send SMS text mes­sages. A full list of AT codes are avail­able here, and I used these:

Send a text

Set to human read­able text mode:
AT+CMGF=1

Set phone number:
AT+CMGS=“447944581307”

Enter the message

Send hex 1A to escape message.

List texts

AT+CMGL

Read a text

AT+CMGR=<index> (index­es start at 1)

Delete a text

AT+CMGD=<index>

 

The only stum­bling point I had was when the GSM modem was set to a dif­fer­ent baud rate than my soft­ware ser­i­al inter­face. To change this, I sent the AT com­mand AT+IPR=9600 to recon­fig­ure the modem.

I learnt that AT com­mands are also used to send and receive via TCP/UDP. This made it much more straight­for­ward than some kind of low lev­el sys­tem I had imag­ined. All that is required from the Arduino is to send AT com­mands (e.g. AT+CIPSEND=) and lis­ten for incom­ing responses.

Explanation for non-techies:

I made an elec­tron­ic cir­cuit that can send infor­ma­tion to the Inter­net. This will be use­ful for mak­ing a sen­sor e.g. a tem­per­a­ture sen­sor for an office that is acces­si­ble on any computer/smartphone.

Arduino for Atmel Studio

Arduino for Atmel Studio

Atmel Stu­dio now has an exten­sion designed as a sim­ple alter­na­tive to the Arduino IDE.

The Arduino IDE is rel­a­tive­ly sim­ple. It is great to get start­ed with AVR pro­gram­ming, and has some use­ful exam­ples to get you start­ed, but lacks many of the fea­tures that expe­ri­enced pro­gram­mers call for like detailed com­pil­er warn­ings, debug­ging capa­bil­i­ties, auto-com­ple­tion and unit testing.

Arduino IDE
Arduino IDE

Pro­gram­ming for AVR at a low­er lev­el in Atmel Stu­dio can also have per­for­mance improve­ments. Shift­ing bits rather than using Arduino IDE’s ‘dig­i­tal­write’ can have a 10x speed improve­ment for example.

Atmel Stu­dio sup­ports a wider range of AVR microchips. This can be use­ful if you aim to pro­gram one of Atmel’s huge range of microchips. I have a ATtiny13A, which uses con­sid­er­ably less pow­er than the ATMega328 in my Arduino board (190 µA in active mode, and 24 µA vs. 0.2 mA in active mode, 0.1 µA in pow­er-down mode, and 0.75 µA in pow­er-save mode).

Atmel Studio

So if you feel you are out­grow­ing the Arduino IDE, give Atmel Stu­dio a try. You may find this tuto­r­i­al use­ful: Using Atmel Stu­dio 6 with Arduino projects, or How to Set­up Atmel Stu­dio for Arduino Devel­op­ment.

Sim­plic­i­ty can be more impor­tant though, and the Arduino IDE may be more suit­able for your appli­ca­tion. After all, projects are gen­er­al­ly rel­a­tive­ly sim­ple when you have less than 16 KB of mem­o­ry to play with. I expect I will con­tin­ue using the Arduino IDE pri­mar­i­ly, and Atmel Stu­dio for any par­tic­u­lar­ly chal­leng­ing projects.

Simple explanation for non-techies

Arduino refers to a few types of tiny elec­tron­ic board with a repro­gram­ma­ble microchip. Pro­grams can be sent from a com­put­er to this microchip to per­form what­ev­er task is required.

A fun exam­ple is Leah Buech­ley’s Turn Sig­nal Bik­ing Jack­et project, shown in the video below:

Software Defined Radio (SDR) and Field-Programmable Gate Arrays (FPGA) — A Free Radio Scanner

Software Defined Radio (SDR) and Field-Programmable Gate Arrays (FPGA) — A Free Radio Scanner

When I was grow­ing up, one of my favourite birth­day presents was a Uniden UBC3000XLT radio scan­ner. I enjoyed find­ing and lis­ten­ing to var­i­ous radio trans­mis­sions, and I had some suc­cess decod­ing data trans­mis­sions and morse code using my PC and Sound Blaster soundcard.

Uniden UBC-3000XLT Radio Scanner
Uniden UBC-3000XLT Radio Scanner

I was inter­est­ed to read about a tech­nique called Soft­ware Defined Radio (SDR), which can sam­ple the entire short­wave spec­trum, and use the pro­cess­ing pow­er of a com­put­er to vir­tu­al­ly ‘tune’ in to transmissions.

A home-built SDR board oper­at­ing at the Uni­ver­si­ty of Twente in the Nether­lands (pic­tured below) and a receiv­ing ele­ment around 5cm x 10cm is capa­ble of receiv­ing a fre­quen­cy range of 0 — 29.160 MHz.

It uses a Spar­tan XC3S500E Field-Pro­gram­ma­ble Gate Array. FPGAs can be pro­grammed using a hard­ware descrip­tion lan­guage, and arrays of pro­gram­ma­ble log­ic blocks which can be vir­tu­al­ly inter-wired. The most impor­tant advan­tage over a micro­con­troller like a Atmel/Arduino, is these oper­a­tions can hap­pen in par­al­lel, which is crit­i­cal to cre­at­ing a soft­ware defined radio, as a typ­i­cal AVR micro­proces­sor sim­ply does­n’t have the nec­es­sary clock speed. The sam­ple rate must be at least twice the max­i­mum fre­quen­cy of the sig­nal (Nyquist theorem).

PA3FWM Software Defined Radio
Soft­ware Defined Radio at the Uni­ver­si­ty of Twente

Tak­ing this a step fur­ther, Soft­ware Defined Radio can allow mul­ti­ple users to share the same receiv­er. At time of writ­ing, 184 users are lis­ten­ing to dif­fer­ent fre­quen­cies using the receiv­er at the University.

You can lis­ten for your­self at the Wide-band Web­S­DR at Uni­ver­si­ty of Twente. It’s essen­tial­ly a free radio scan­ner any­one can access for free. You might enjoy stum­bling upon a vari­ety of trans­mis­sions from all over the world, and you may have suc­cess using tools like Sor­cer­er to decode data trans­mis­sions, weath­er fax trans­mis­sions, and morse code.

With the ever-con­tin­u­ing advances in data stor­age capac­i­ties and scal­able clouds, one day it may be a triv­ial mat­ter to archive the entire radio fre­quen­cy spectrum.

DIP switch with Arduino

DIP switch with Arduino

Here is a use­ful func­tion to read DIP switch­es with Arduino. Wire the switch­es to ground, as this uses pull-up resis­tors:

Photograph of a DIP switch

 

  1. int myDip­Pins[] = {2, 3, 4, 5, 6}; //DIP Switch Pins
  2. void set­up()
  3. {
  4. Serial.begin(9600);
  5. for(int i = 0; i <= 4; i++)
  6. {
  7. pinMode(myDipPins[i], INPUT);       //Set DIP switch pins as inputs
  8. digitalWrite(myDipPins[i], HIGH); //Set pullup resis­tor on DIP switch pins
  9. }
  10. delay(100);
  11. }
  12. void loop()
  13. {
  14. byte DIP­Val­ue = readDIP(myDipPins, 5);
  15. Serial.print(DIPValue, BIN);
  16. Serial.print(“\n”);
  17. switch (DIP­Val­ue)
  18. {
  19. case B00000:
  20. Serial.print(“Match 00000\n”);
  21. break;
  22. case B00100:
  23. Serial.print(“Match 00100\n”);
  24. break;
  25. case B11011:
  26. Serial.print(“Match 11011\n”);
  27. break;
  28. case B11111:
  29. Serial.print(“Match 11111\n”);
  30. break;
  31. case B01001:
  32. Serial.print(“Match 01001\n”);
  33. break;
  34. case B10000:
  35. Serial.print(“Match 10000\n”);
  36. break;
  37. }
  38. delay(1000);
  39. }
  40. //Read bina­ry from DIP switches
  41. byte readDIP(int* dip­Pins, int numPins)
  42. {
  43. byte j = 0;
  44. //byte j;
  45. //Get the switch­es state
  46. for(int i = 0; i < numPins; i++)
  47. {
  48. if (!digitalRead(dipPins[i]))
  49. {
  50. j += 1«(numPins — 1 — i);
  51. }
  52. }
  53. return j; //Return result
  54. }

 

 

Be sure to check ” and ’ sym­bols haven’t been made fan­cy by Word­Press, or you’ll have errors in your code.

Continuing electronics

Continuing electronics

I’m con­tin­u­ing my learn­ing of elec­tron­ics, and I seem to be much bet­ter at it than the first time around. It is sat­is­fy­ing when a cir­cuit works first time.