Trybotics Logo

4 Projects in 1 Using DFRobot FireBeetle ESP32 & LED Matrix Cover

DESCRIPTION

I thought about doing an instructable for each of these projects - but in the end I decided that really the biggest difference is the software for each project I thought it was better to just make one big instructable!

The hardware is the same for each project, and we are using the Arduino IDE to program the ESP32 device.

So what is the hardware: All of the hardware was provided by my friends at DFRobot, they have very good tutorials, and easy to install core boards for this. Also have a good support system in place, and pretty fast shipping to the U.S.

Full disclosure the Firebeetle ESP32 board, and the LED Matrix were provided by DF Robot, the projects presented and in the videos are my own.

These projects all use a DFRobot FireBeetle ESP32 IOT MicroController

https://www.dfrobot.com/product-1590.html

The support wiki - with board core install instructions can be found here:

https://www.dfrobot.com/wiki/index.php/FireBeetle_...

We also need a FireBeetle Covers 24x8 LED Matrix (BLUE)

https://www.dfrobot.com/product-1595.html

Don't like BLUE leds - They have different colors as well.

GREEN - https://www.dfrobot.com/product-1594.html

RED - https://www.dfrobot.com/product-1597.html

WHITE - https://www.dfrobot.com/product-1593.html

YELLOW - https://www.dfrobot.com/product-1596.html

You only need one LED Matrix - the color is your choice, they all work the same.

LED Matrix support wiki can be found here:

https://www.dfrobot.com/wiki/index.php/FireBeetle_...

Here we find a link to the Arduino Library.

https://github.com/Chocho2017/FireBeetleLEDMatrix

More on these a little later on....

Something that is optional, but maybe handy to have is a MicroUSB 3xAA Battery Holder.

https://www.dfrobot.com/product-1130.html

So That is the hardware needed - What are the 4 projects -

Description:

Project 1: Is a simple LED Matrix NTP Clock with either Military Time display or AMPM time display,

This clock will connect to a NTP (time server) grab the time, and apply an off set so you get local time. It will display the time on the LED Matrix. - It's a very simple clock, and very simple 1st project.

Project 2: ISS Pass Prediction Display, this project uses the 2nd core of the processor. It will display how close (in miles) the ISS is, when to expect the next ISS pass at your location (In UTC time), and optionally how many people are in space. Since a lot of this information doesn't change often, we use the 2nd core to only check for updates of the pass predictions, or how many people are in space every 15 minutes. We can prevent too many API calls to the server this way. This project is a little more complicated, but still pretty easy to do.

Project 3: A Simple Moving Message Sign using MQTT, I revisited a project that was made for the ESP8266 D1 mini board, and it's 8x8 LED Matrix - The idea is to connect to a MQTT broker, send a message to a topic the device is listening to - and display that message. It's pretty easy, and very simple to do once everything is setup. And there are a few steps to setting up the MQTT client software on a desktop computer. Once setup MQTT is very powerful messaging protocol used by many IoT devices to send and receive messages.

Project 4: Weather Station Display - based on the ESP8266 D1 mini weather station made by Squix78 and ThingPulse. We grab our data from Wunderground, and display the current conditions, and the tempature in degrees Fahrenheit. We use the 2nd core of the ESP32, to update our data every 10 minutes. It is also simple to setup.

BOUNS MINI EXAMPLES: The library (and sketches above) use a 8x4 font, the library also contains a 5x4 font, which I used for most of these BOUNS mini examples. There are a couple of problems that I can note with the small font, one it seems to cause problems when you use the WIFI of the device. This is something I want to explore more, but have had the time. The other problem is it doesn't scroll, only the larger font can scroll. So none of these examples use the WIFI - they just update the display, and more about these will be later.

Let's get started.....

Description:

So, I'm going to refer you to the DF Robot Wiki on installing the board core for the Arduino IDE.

It is pretty easy to do with the modern IDE (1.8.x or better).

https://www.dfrobot.com/wiki/index.php/FireBeetle_...

I found that the WiFi library built into the Arduino IDE causes problems (PS any other WiFi Library that maybe installed in your library directory may or may not cause problems). The only way (or at least the easiest way) that I found to solve the issue is to remove the WiFi library from the IDE directory. Unfortunately there is no good way to tell you where it maybe installed - it depends on how the IDE is installed, and on what OS you are using.

What I have done is found the WiFi library that is causing problems, and just move the directory WiFi directory to your desktop...and restart the IDE. That way you can keep the library in case you do need it for the Arduino WIFI boards.

90% of the problems I've seen have been related to the above issue. If you get a lot of compile errors, related to using WiFi from the Arduino IDE directory or the Arduino Library directory, this is the problem you have.

My 2nd issue is sometimes the sketch upload fails to upload - In which case I just have to hit the upload button again, and it works.

And lastly, if you have the serial console open, and then close it - the FireBeetle freezes.

I know that DF Robot is actively working on the board core, and just in the short time that I've had the board they have released a new core. Unfortunately it didn't solve the WiFi issue which is my biggest issue.

* Espressif has a 'generic' core manager that can be installed, the core does include the FireBeetle ESP32 board, but I was having an issue with how it has the pins numbered. The interesting thing here is the WiFi library works with the built-in WiFi library - so I know there is a solution to that issue just around the corner.

If you would like to try the Espressif cores you can find out more information here:

https://github.com/espressif/arduino-esp32

I personally like how the DF-Robot core works, even with the few issues I am having.

** NOTE: I am using LinuxMint 18 which is Ubuntu 16.04 based I think, I've not tried this on any other machine, but I believe the issue is present for all of the OSes based on some internet searches I did. **

Description:

All of these projects use a few common libraries, so it's easier to do this step now.

Depending on the library you may find it in the library manager - which is by far the easiest way to install a library.

Another common way is to install via a zip file, which works equally as well. But generally I use the manual install method. There is a good tutorial on the three methods on the Arduino Website.

https://www.arduino.cc/en/guide/libraries

For these libraries, I would recommend the manual method - because there are a few different libraries with the same name, using the library manager you may end up with the wrong one.

All of these projects use a WiFi Manager to make it easy to connect to your wifi - I decided to do this so if you need to move your project, you don't need to reprogram the board. This is something that I use for the ESP8266 boards, and it works well - it's not perfect. Luck for use the library has been ported to use the ESP32 by a github user named bbx10. (This manager should also work with the ESP8266 boards)

We need to install three libraries for this too work.

The WiFiManager - https://github.com/bbx10/WiFiManager/tree/esp32

The WebServer - https://github.com/bbx10/WebServer_tng

And finally the DNSServer - https://github.com/bbx10/DNSServer_tng

Also common to all the sketches is the DF Robot DFRobot_HT1632C library for the LED Matrix.

https://www.dfrobot.com/wiki/index.php/FireBeetle_...

The library can be found here (Again I would recommend the manual install method)

https://github.com/Chocho2017/FireBeetleLEDMatrix

A Special note: in my github repository - I have a couple of slightly modified DFRobot_HT1632C libraries

https://github.com/kd8bxp/DFRobot-FireBeetle-ESP32...

The modification is for a smaller font, and only used for some of the bonus examples. You can use the modified library and it shouldn't cause any problems. There is also a slightly modified library (Attached to some of the sketches as tabs) that can do bitmap images.

If you choose to use the slightly modified version, you need to rename the "modified-library" directory to FireBeetleLEDMatrix and move that folder into your Arduino library directory. You don't have to use this version for these projects, it is needed if you want to try some of the smaller fonts from the bonus examples.

Those are the common libraries - we will be installing some specific libraries for each project.

Let's move on to the LED Matrix....

Description:

For We are going to follow along with the DF Robot Tutorial for the LED Matrix

https://www.dfrobot.com/wiki/index.php/FireBeetle_...

Introduction: This 24×8 LED Matrix display is special designed for FireBeetle series. It supports low-power consumption mode and scrolling display. With HT1632C high performance LED driver chip, every led has independent register, which makes it easy to drive separately. It integrates a 256KHz RC clock, only 5uA under low-power mode, support 16 scale PWM brightness adjustment. This product also works with the other Arduino micrcontroller like Arduino UNO.

Specification:

  • Operating Voltage: 3.3~5VLED
  • Color: Single color (White/Blue/Yellow/Red/Green)
  • Drive Chip: HT1632C
  • Working Current: 6~100mA
  • Low-power Consumption: 5uARC
  • clock: 256KHz
  • Chip Select (CS): D2, D3, D4, D5 selectable
  • Support Scrolling display

Default PINs:

  1. DATA<——>D6
  2. WR<——>D7 (Generally Not Used)
  3. CS<——>D2, D3, D4, D5 selectable (D2 default)
  4. RD<——>D8
  5. VCC 5V<——>USB ; 3.7V<——>Lipo Battery

(All of these projects use D2 for the select pin, this can be easily changed as needed.)

On the back of the LED Matrix you'll see 4 little switches, make sure to only select one of the CS pins. These little switches are how you select your CS Pin, and the default is D2.

The DF Robot WIKI has some sample code, this code is also in the examples for the library. (I believe)

Another note: use the Dx numbers for your pins - otherwise the pin numbers will be the IO pin numbers/names

And that may cause you some problems.

Setting a point:

X is 0 to 23 (or if you think about it as a spreadsheet these are columns).

Y is 0 to 7 (or if you think about it as a spreadsheet these are rows).

The library provides a set point function.

display.setPoint(x,y) this will set the cursor to that location, where you can now print a message.

display.print("Hello World",40); //this will cause the display to display "Hello World" starting at the x,y point and scrolling off the screen.

There is also a setPixel(x,y) and clrPixel(x,y) - setPixel will turn on one LED at the x,y location, and clrPixel will turn off a LED at the x,y location.

There are some other things this library can do - and most are included in the examples.

(I would recommend running and modified the examples to to see what it can do).

* One thing that seems to be lacking is drawing bitmaps - the library can actually do this but for some reason it's a private function of the library. See some of my bonus examples for a slightly modified version of the library

** Another thing it includes a 5x4 font set, which is nice to have a smaller font - it's commented out how ever in the library. I did uncomment it, and have it working, but noticed a few issues with it - the biggest it doesn't scroll. And I noticed that it seems to cause problems either with the wifi or maybe a another library I wanted to use.

One of the modified libraries I include however does use the 5x4 font.

Let's move on to the projects.....

Description:

Project 1: Is a simple LED Matrix NTP Clock with either Military Time display or AMPM time display,

This clock will connect to a NTP (time server) grab the time, and apply an off set so you get local time. It will display the time on the LED Matrix. - It's a very simple clock, and very simple 1st project.

Before we get started with this simple project, it may be a good idea to know what NTP is -

NTP is an internet protocol used to synchronize clocks of computers to some time reference. It's a standard protocol. NTP stands for Network Time Protocol.

NTP uses UTC as a reference time (UTC is Universal Time Coordinated) it evolved from GMT (Greenwich Mean Time), and in some circles it's called Zulu Time (Military). UTC is based on a quantum resonance of a cesium atom.

NTP is fault-tolerant, and highly scalable, the protocol is highly accurate, using a resolution of less than a nanosecond.

* http://www.ntp.org/ntpfaq/NTP-s-def.htm

A UTC clock isn't much use to most people, so we need to adjust our clock to local time. Luckily we can do this pretty easy. So let's get started with this simple NTP Clock....

1st we need to install a library that makes talking to the NTP servers easy.

https://github.com/arduino-libraries/NTPClient (this library is probably in the library manager)

Did you skip step 3 - and not sure how to install libraries(?) Better go back and read step 3 :-)

You need to go to this website, and put in the closest city to you that is in your timezone.

https://www.epochconverter.com/timezones

When you hit enter, you will see "Conversion results", and in the results you'll get your offset (difference to GMT/UTC) in seconds (For me that is -14400)

In the dfrobot_firebeetle_led_matrix_ntp_clock sketch on line 66 you'll see:

#define TIMEOFFSET -14400 //Find your Time Zone off set Here https://www.epochconverter.com/timezones OFF Set in Seconds
#define AMPM 1 //1 = AM PM time, 0 = MILITARY/24 HR Time

replace -14400 with your offset. The next line you'll see AMPM 1 - this will cause the clock to display time in AM/PM - if you'd rather see it in 24 hr time make the one a zero.

Next upload the sketch to your board, connect to the Access point (wifi manager) and enter the details for your wifi. IF you have already done this, you should see "connected" scroll across the screen and a few seconds later you should see the time.

That's it for this project - simple and easy to use.....

(Possible improvements: Display the Month, Day and Year, setup a buzzer and alarms - generally control what you see via a web page. These idea would take a big rewrite of the current simple sketch)

Ready for another simple project -- Display where the ISS is - Pass predictions, and how many people are in Space! (PS this sketch does use a web page to control what is displayed) .....

Description:

Project 2: ISS Pass Prediction Display, this project uses the 2nd core of the processor. It will display how close (in miles) the ISS is, when to expect the next ISS pass at your location (In UTC time), and optionally how many people are in space. Since a lot of this information doesn't change often, we use the 2nd core to only check for updates of the pass predictions, or how many people are in space every 15 minutes. We can prevent too many API calls to the server this way. This project is a little more complicated, but still pretty easy to do.

This project is based on one of my earlier projects that can be found here: https://www.instructables.com/id/Simple-ISS-Notifi...

(A Simple ISS Notification System) In That I used a ESP8266 with an on board OLED screen (D-Duino). For the most part this project just uses a different display system, I expanded on it so you can change what you want to see on the fly via a web page. So let's get started....

Most of the credit for easy of use goes to http://open-notify.org which has a very simple and easy to use API. The open-notify API has three things that can be displayed, location of the ISS in latitude and longitude, pass predictions based on a given latitude and longitude. And finally how many people (And their names) are in space.

We will need to install another library - The ArduinoJson library.

https://github.com/bblanchon/ArduinoJson

We also need TimeLib.h but I'm not sure where I got that one from or if it's included in the IDE (sorry)....

So why predict where the ISS will be - The ISS contains various amateur radio equipment, and when it's "over head" an ham radio operator can make contact with the ISS using some very simple (and cheap) radios. I've even done it while mobile (driving in the car). You really don't need much to make this work. The one thing you do need is to know where it is. And pointing the antenna in it's general direction helps.

Line 57, 58, 59 are some display variables - if they are set to 1 you will see a display, if they are set to 0 (zero) you will not see a display. (These variables can be set in the sketch, or updated from a web page that the firebeetle creates - more on that later).

int locDis = 1; //Display Location of ISS
int pasDis = 0; //Display Pass Predictions int pplDis = 1; //Display People in Space

so locDis will display the location of the ISS in latitude and longitude - it also displays how many miles away it is.

pasDis will get the pass predictions from open-notify.org and display them.

and finally, pplDis will display the names and how many people are in space - this can get very long, it doesn't

change often either. (you can change these or leave them, it's totally optional)

We also need to know our latitude and longitude and put it into the sketch.

This doesn't have to be a precise lat/long, it can be the center of your city, or off just a little. The foot print of the ISS is wide while it's over head, and hundreds (or thousands) of miles can be covered, so being off a little on your lat/long isn't going to be a deal breaker (most of the time), communication over 500 miles is pretty common.

If you don't know your latitude and longitude this website can help you out.

https://www.latlong.net Near line 84 of the sketch you'll see something like this:

//Find your Latitude and Longitude here
//https://www.latlong.net/ float mylat = 39.360095; float mylon = -84.58558;

That should be all that needs to be changed. Upload the sketch, and connect the Firebeetle to the internet - and you should see, the location of the ISS given in lat/long and how many miles away it is (remember this will be an approximated distance. The ISS moves very fast, and by the time the display is finished the ISS has moved many miles from where it was). You should also see the people in space. (IF you didn't change the variable above).

We are using the second core of the ESP32 to run a web-site, using the site gives us control over what is displayed on the LED matrix. It should be pretty intuitive on how it works, one sections shows what is turned on for display, another section has "yes" "no" buttons - clicked the "yes" means you want to see it, the "no" mean don't show it. You should also see that the top section changes based on the buttons.

The only thing that isn't so cut and dry here is how to find the IP address of the Firebeetle - unfortunately I couldn't come up with a good way to find it - so I just used the serial console of the IDE to display it (9600 baud).

Open the console, and you should see the IP address. (open it before you get the connected message) - my other choice was to display it on the LED Matrix once right at start up - I decided against that because you might not be looking at the time and you'll miss it. I had considered sending a sms message, or something but, in the end I just keep it simple. (I also tried to assign a static IP/gateway/etc, I couldn't get it to work right with the wifi manager - the code is still in the sketch, so if someone figures it out let me know)

The sketch also takes advance of FreeRTOS build into the ESP32 core - We have a task that runs every 15 minutes or so, what this does is update the pass predictions, as well as the people in space. Like I said earlier people in space doesn't change that much, so that could probably be moved to yet another task and maybe ran once every 12 hours (or 6 hours) - but this works, and it keeps things simple.

For those that don't know FreeRTOS is a way to let a single core micro-controller run multiply tasks

Normally you have to include some libraries and other things to make it work - however it's build into the core for the ESP32 - which make the ESP32 a very powerful device. for more information about FreeRTOS

https://freertos.org/

IMPROVEMENTS: there are a number of things that can be improved on for this project, and almost every day I think of something that could be done a little different, or changed, or added.

And in the more examples directory of the repository you can see some of the earlier/different things I thought about- some of these didn't work, some just changed, and some where included in the current sketch.

* At one point I tried to add a neopixel to the display so it would be a little more like my previous project - I never got it to work quite right (I found it to be a power issue which I had not considered) I am working on a way to improve this idea *

While writing this step, I thought, maybe I can add a way to update your latitude and longitude to the website - that way the sketch would never need to be modified - I'll think about this one a little more as well.

An improved way to get the IP address is something else I'd like to do (still thinking about that one too)

Let's move on to our next project.....

Description:

Project 3: A Simple Moving Message Sign using MQTT, I revisited a project that was made for the ESP8266 D1 mini board, and it's 8x8 LED Matrix - The idea is to connect to a MQTT broker, send a message to a topic the device is listening to - and display that message. It's pretty easy, and very simple to do once everything is setup. And there are a few steps to setting up the MQTT client software on a desktop computer. Once setup MQTT is very powerful messaging protocol used by many IoT devices to send and receive messages.

So this is a redo of this project: https://www.instructables.com/id/Simple-Moving-Mes...

Which was based on another one of my MQTT projects: https://www.instructables.com/id/ESP32ESP8266-WIFI...

I've covered MQTT pretty good in both of those instructables - so I am just going to hit the basics of it.

MQTT is a simple publish/subscribe lightweight messaging protocol designed for constrained devices and low bandwidth, high latency or unreliable networks. Making it nice for IoT devices.

For this project we will be using the MQTT broker at http://test.mosquitto.org We will be using a public broker, without any type of encryption or security - so don't send anything secure to the display. You have been warned.

We will need to install the PubSubClient library for the Arduino - https://github.com/knolleary/pubsubclient

You will probably want to change line 70 of the sketch -

<p>const char* subTopic = "matrixDisplay10"; //subscribe topic</p>

This is the topic that the device will subscribe too, and other devices (clients) will publish too.

* This is really the only thing that you will probably want to change, you don't even have to change it - but since we are using a public broker, there is the possibility that you will get messages that you don't want from other people also running the sketch/client with the generic/default topic *

Line 68 is the broker we are using

<p>const char* mqtt_server = "test.mosquitto.org"; //MQTT broker</p>

If you want to change to a different broker this is where you can do it - you don't have to change this line (Line 70 is really the only thing that I would recommend changing)

Lines 125 - 126 is the device ID - I am using in part the MAC address of the ESP32 device, since each device should have a unique mac this shouldn't need to be changed.

<p>uint64_t chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes).<br>    char clientid[25];
    snprintf(clientid,25,"WIFI-Display-%08X",chipid); //this adds the mac address to the client for a unique id</p>

Finally, line 92 contains the port of the broker we are connecting to. (IT should be noted here, that most brokers that have encryption, also have additional things that need to be setup - so just changing the port number in most cases will not work correctly).

To use this we need a MQTT client, or another device that is publishing to the topic we are listening too.

There are a number of clients, mosquitto being a very popular desktop client.

There are also clients running on websockets - and this is probably going to be the easiest way to test the display. So we go to http://test.mosquitto.org/ws.html

First thing we need to do is connect to the broker, click the connect button in center of the web page.

Next put the name of your topic (subTopic in the sketch) - in the Topic: form, and the message you would like displayed in the payload form, click publish - and a few seconds later you should see your message on the LED Matrix....

IF you would prefer to use a desktop client the install instructions for mosquitto can be found here -

https://mosquitto.org/download/

Most linux distros have mosquitto in the repositorys, so check there first - there is a client and a broker, unless you want to run your own broker you just need the client.

Using the client is just as easy: From the command line (or CLI)

$ mosquitto_pub -h test.mosquitto.org -t matrixDisplay10 -m "Hello World...."

The -h is the host name (or broker name), -t is the topic (subTopic), -m is the message or payload.

I find there is a small delay when using the desktop client vs using the websocket client, but that may just be me.

Finally, MQTT is really ideal for M2M communication (Machine to Machine) - so I would recommend looking at the mqtt_esp8266 example included with the PubSubClient library - it's not overly useful other than to give a way idea on how to make a device publish a message to the broker. - or in otherwords, it will show (hopefully) how to have a device publish a message to be displayed.

Limitations: So as it stands right now, the LED Matrix library (as provided) seems to have a cut off of about 24 to 27 characters. I've not investigated this, and I have no idea why there is a limit. there maybe a good reason for it, then again....

Anything over that limit just gets cut off.

Improvements:

Right now the sketch is pretty simple, it subscribes to the topic, it listens to the topic, and it displays the message.

You don't need to know anything, well ok, you need to know the broker, and topic - but that is it. I can't see much to improve on - but I'm always open to suggestions.

Lets move on to our last project....then some fun!!

Description:

Project 4: Weather Station Display - based on the ESP8266 D1 mini weather station made by Squix78 and ThingPulse. We grab our data from Wunderground, and display the current conditions, and the tempature in degrees Fahrenheit. We use the 2nd core of the ESP32, to update our data every 10 minutes. It is also simple to setup. But there are a lot of steps.

1st - We need to install the esp8266-weather-station library, be sure you get at least version 1.5.0, this version of the library also works with the esp32 devices.

https://github.com/ThingPulse/esp8266-weather-stat...

We also need the Json-streaming parser library by Squix78.

https://github.com/squix78/json-streaming-parser

Both of these libraries should be in the Arduino library manager.

Next, we need to get an API key from OpenWeatherMap, ThingPulse has a good tutorial on how to do this.

https://docs.thingpulse.com/how-tos/openweathermap...

The only other thing I would do here is click on the "Weather" button on the Openweathermap.org website.

https://openweathermap.org/city Type the name of your city/location into the search, and see how they want that location/city put in the "OPEN_WEATHER_MAP_LOCATION" field in the sketch.

Speaking of the sketch.

Line 68 - will set you up for IMPERIAL or METRIC measurements. IF you choose true you will get metric (Celsius) degrees for your temperature, if you choose false, you'll get IMPERIAL (Fahrenheit) degrees.

Lines 78 to 80 are more settings that you will need to change.

<p>String OPEN_WEATHER_MAP_APP_ID = ""; // API KEY HERE!!!<br>String OPEN_WEATHER_MAP_LOCATION = "Dayton, US"; //Check OpenWeatherMap for the name of your town or location
String OPEN_WEATHER_MAP_LANGUAGE = "en";</p>

These hopefully are self explanatory - here is the run down, the api key you generated, or the one that was generated when you created your OpenWeatherMap account, goes between the quotes. Leave the quotes, they are important. Your location goes into the next variable, you see here I have Dayton, US - that is Dayton OHIO

My language is English, You may want to check with openweathermap to see what languages are supported if you speak something other than English.

That's really about it for this one - lots of little steps, but overall it's a pretty simple and straight forward project.

NOTE 1: The previous version of this project used Wunderground, unfortunately it's been deprecated in the current version of the library - Reason, they no long offer a free tier to the service. * It appears however that if you have a Wunderground API that is free it does still work, at least that is true as of June 23, 2018 *

NOTE 2: OpenWeatherMap.org provides less information, but it is free and usable.

NOTE 3: OpenWeatherMap.org has some better ways to give a location built into the API, unfortunately, those ways are not implemented in the library as of yet. (Thou it looks like they maybe sometime in the future)

Possible Improvements (?) - I'm not sure at this point, the code isn't pretty, as I was writting this instructable I became aware of the change from Wunderground to OpenWeatherMap and quickly made the needed changes, I verified that it worked, but the code is a bit of a mess now :-(

Maybe future version can tell if critical or severe weather watches and warning are in your area - currently I don't see anyway to do this with OpenWeatherMap, but that may change.

Time to move on to some of the Bonus Things (FUN FUN FUN)......

Description:

These are some things I did when I first got the board to learn a little more about how they work and what they do. I'm calling them bonus examples - Some of these require a slightly modified version of the LED Matrix library included in my GitHub repository.

These should work without any modification to the DFRobot_HT1632C library.

Cylon Scanner - sometimes called a Larson scanner (thou typically that is usually the Knight Rider style) - This has two sets of four dots moving across the screen in a back and forth motion. (This is sort of like the Cylon Lucifer, in the Original Battlestar Galactic) - By playing around with the wait time on line 17 you can get some kind of interesting effects. With the wait time set at 10 and shaking the device you can some interesting patterns. This is based off of something called presistence of vision. https://en.wikipedia.org/wiki/Persistence_of_visio...

So play around, shake up your FireBeetle and see what kind of neat things you can make (Hint: a wait of zero produces what appears to be a line, and anything above say 100 is just too slow).

Theater Chase - I used the drawLine example as a base for this one (And all of the other Theater Chase sketches that need a slightly modified library). For this I removed the fading effect, and added some setPixels (pixel turned on), and clrPixel (pixel turned off), on top of the lines, by doing this like an alternating effect, I created something like a led chase, often referred to as a theater chase (In the days of a marquee and the lights moved around it to draw attention to what was playing). There are many examples, (in the modified library 5x4 font directory) The difference is how many or where/how I turn the pixels on and off - and timing a little bit.

Feel free to play around with this one too, you should beable to create some interesting chase patterns.

Finally the last sketch that doesn't need a modified library is what I'm calling a Knight Rider Scanner off course this scans back and forth, what else! - Ok well, the big difference here is I'm using the whole screen turning on a whole column at a time. The screen fills, when the screen is full the column is erased, then the process is repeated in the other direction. With a wait time that is low (1) it looks like everything is moving with each other, if you increase the wait time, you'll see everything is being drawn out slowly. (PS. a wait time of zero produces something like a slow strobe effect) The best time for this effect is the default of 1, but again feel free to play around. Can this be done better, yes, sure now that I understand the display and the library better, yes there are better ways to do this. But As I said, a lot of these "bonus" sketches were my process to learn what was going on.

Let's move on to some bonus sketches that need a slightly modified library: (as stated in step three)

There is a slightly modified DFRobot_HT1632C library included in the github repository.
The modification is for a smaller font, and only used for some of the bonus examples. You can use the modified library and it shouldn't cause any problems.

At this point If you want to play with the slightly modified fonts (5x4) you will need to use my slightly modified version, you need to rename the "modified-library" directory to FireBeetleLEDMatrix and move that folder into your Arduino library directory.

I am using the slightly modified version for everything, I have noted a couple of issues when using the small font (5x4). One is there is no scrolling of the small font, the other I've gotten some interesting debug messages while using them and being on line - I'm not sure what the second one is all about, the first is a limitation of the library.

So, first things first - The 5x4 font was in the library too start with, it was just commented out, as well as a few other things related to the 5x4 library, all I did was un-comment those things, and save the library again. That being said, the few issues I've had with them is probably why there were left out in the first place.

All that being said, lets look at a 5x4 font and a few examples I put together...

In the bonus_examples directory, you'll see a directory call "Modified Library 5x4 Font" - here you will find all the sketches that use the small font, there are 5 different versions of the theater chase sketch with the main difference between them is how many and how I turned on and off the pixels, these sketches also say "Hello" in the "marquee" screen.

led_matrix_eye - is a silly little sketch that uses the 8x4 size "O" and the 5x4 size "O" to produce a wink effect - it's not very good, I will admit that, but it does show that both the 8x4 font, and the 5x4 font can be used at the same time.

That next ones, are just modified original example sketches, but using the 5x4 font - there is drawText_small font which is the same as drawText example, just small font, and the drawLine_small font, again it's just the same as the drawLine example.

We have one more set of "BONUS" - drawing bitmap/images to the screen....

Description:

So it turns out, that the library can display images - thou for some reason that function seems to be "private" - well, for these next sketches I modified the library once again and made drawImage a public function.

This time, I put the modified library in the sketches directory, so you don't need to reinstall the library, the sketch looks at itself first, then it will look in the library directory, so we are good!

*** I am planning on submitting this change to DFRobot, as it is really very cool, and kind of neat to be able to do these types of sketches ***

LED Matrix Images sketch, here I was first trying to figure out what the library wanted, and what would and would not work - with varying degrees of success. I found that the 8x8 images work the best, but you can get others to work as well. I found a few online led matrix editors as well, some work better than others.

https://xantorohara.github.io/led-matrix-editor/ - seems to work ok, makes 8x8 images, and you want them as byte arrays.

https://www.riyas.org/2013/12/online-led-matrix-fo... this one works well, and has the ability to make larger than 8x8 displays, the display appears to be turned on it's side with this display however. Byte arrays seem to work best here. I used it to make the "space invaders" seen in the video above.

So how does this work,

<p>drawImage(const byte * img, uint8_t width_t, uint8_t height_t, int8_t x, int8_t y, int img_offset);</p>

image byte array variable, the width of the image (8), the height of the image (8), the starting position on the screen x (0), y (0) usually, and a offset number, which I'm not 100% sure what it does, so most of the time I left it at zero.

In the sketch LED Matrix Images - there are 8 different byte arrays - with three different methods too them.

- fireworks are the first arrays, honestly I am not sure how this one works - but it does work.

next there is a mouth - this doesn't really work quite right, the mouth is laying the wrong way for one, and trying to make any changes just makes it worse. (learning what works and what doesn't is half the fun)

Followed by the first marioImg - this is too big for the display, and I think this is where the off set comes into play - I used it here, and you can see the front of mario, if you change the offset to 1 you'll see the back of him. (thou I can't really tell you why or what the offset does. It appears to shift the image but why 2 shifts it so you can see the front of him and why 1 shifts the other direction I can't tell you)

IMAGES - byte array is a @ sign I made - it looks like what I made using the tool at https://xantorohara.github.io/led-matrix-editor

pic1 byte array also looks like what I was trying to make, only it's smaller than I was trying - what it is I can not say, but I can say generally it looks like what I was doing in the editor.

mario2Img - this is my own version of the larger Mario made for a 8x8 screen size - and thou there one or two pixels out of place (my fault, not the displays) it does look like a small Mario (sorta).

invader1 and invader2 - both my idea for a space invader. they turned out pretty good, and by putting the images on top of each other, I'm able to create the effect of feet moving.

There are two fireworks sketches in the directory, each is a little different, and worth trying out.

One has the fireworks moving across the screen, so a little more/different animation...the other has two fireworks displayed at the same time

There are also three "invaders" sketches, each one is a little different, one has the invader moving across the screen, and you can look at how I did that - (there maybe better ways to do it, I don't know)

Even More: There are some sketches in the testing directory of the repository - most of these didn't work quite the way I wanted, or were ideas that I want to do, but didn't work the way I wanted. I've left them because someone my get some ideas *(I did make a small "shield" with a WS2812 pixel on it for use with the ISS display, but I connected it to the 3v line, and just didn't have enough power with the LED Matrix running as well, the pixel worked fine, without the LED Matrix thou, so there is still something that I might do with it)*

There is also a directory called "More Examples" - these are variations on the some of the project sketches, either I something was added or removed, or changed in some way. For these, they work - they just aren't the final project. So I left them again someone might get something useful out them. (Maybe)

I hope you enjoyed this instructable as much as I enjoyed making these projects :-)

Description:

This project was sponsored and supported by DF Robot. Please use the links below for the products:

Firebeetle ESP32 - https://www.dfrobot.com/product-1590.html

Firebeetle Cover 24x8 LED Matrix - https://www.dfrobot.com/product-1590.html

My Code Repository: https://www.dfrobot.com/product-1590.html

If you find this or any of my projects useful or enjoyable please support me. Anything I do get goes to buy more parts and make more/better projects.

https://www.patreon.com/kd8bxp
https://ko-fi.com/lfmiller

NTPClient Library https://github.com/arduino-libraries/NTPClient

ArduinoJson.h https://github.com/bblanchon/ArduinoJson

ESP8266 Weather Library https://github.com/ThingPulse/esp8266-weather-stat...

Json-Streaming-Parser Library https://github.com/ThingPulse/esp8266-weather-stat...


YOU MIGHT ALSO LIKE