ESP32 with Blynk – Lighting an LED over wifi

Recently, my friend Gector lent me a new microcontroller called the ESP32. They are fairly new to the market and have super cool wifi, bluetooth, and networking capabilities! Since I’ve been in the area of networking projects for the past few days, I thought I’d play around with one.

To set it up, I followed Sparkfun’s tutorial.

First, make sure you have the Arduino IDE installed on your OS.

Next, make a directory in your filesystem where you want all the ESP32 stuff to go.
Then run all these lovely instructions from this github documentation:
sudo usermod -a -G dialout $USER && \
sudo apt-get install git && \
wget https://bootstrap.pypa.io/get-pip.py && \
sudo python get-pip.py && \
sudo pip install pyserial && \
mkdir -p ~/Arduino/hardware/espressif && \
cd ~/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32 && \
git submodule update --init --recursive && \
cd tools && \
python get.py

Since I didn’t have Arduino.app installed in /Applications/ on my computer, I didn’t have to change some other aspects of my installation. But if you do have that setup, don’t forget to run this:
cd /Applications/Arduino_*/Contents/java/hardware/
mkdir -p espressif && \
cd espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32 && \
git submodule update --init --recursive && \
cd tools && \
python get.py

Once done, cd /esp32/tools and run python get.py.

Now you can connect your ESP32 to your computer!
In the Arduino IDE, under Tools, select ESP32 Dev Module as your board. Make sure you have the right Port selected, too.
My setup looks like this:
Screenshot from 2017-12-03 16-42-47.png

Once finished, I installed the Blynk app on my iPhone. Sign up with an email and password, and create a New Project.

Give your project a name, choose the ESP32 as the device and WiFi as the connection type. Tap create project when you’re finished!
This will direct you to a black screen. Tap anywhere to add a “widget”, where you’ll select the Button option. It’ll add the button to your screen. Tap on it to edit the settings.

In settings, in the empty PIN field, put Digital GP21. Save/Exit the settings, and you’re almost finished.

Before we can see any action, we’ve got to download the Blynk Arduino Library.
On the Blynk Github Page, you can clone the repo into your Arduino folder, or you can download the ZIP file and extract it into the Arduino folder.

In the Arduino IDE, go to Sketch > Include Library > Blynk and the library should be imported.

After that, download the sample code found in this tutorial: http://www.instructables.com/id/Use-ESP32-to-Control-LED-With-Blynk-Via-WiFi/

Then replace “Your auth token” with the authorization code sent to you in your email for the project in this code block:
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Your Auth Code Here";

And again in this line farther down in the file:
Blynk.begin("Your Auth Code Here", ssid, pass);

Near the beginning of the file, add your Network WIFI name and password where it says:
char ssid[] = "Network name";
char pass[] = "Network password";

Save the file and load it into the Arduino IDE as a sketch, but don’t run it yet.

Make sure your ESP32 is plugged into the computer. Now stick it into a breadboard and find an LED. Plug the LED’s long (anode) led into Pin 21 of the ESP32, and the short (cathode) leg into pin GND. There are GPIO charts you can find on the interwebs if there aren’t any names on your board.

The moment of truth comes…upload the code onto the ESP32 and open the Serial Monitor (Tools > Serial Monitor). If all goes well, your board should connect to your wifi and say something that looks like this:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:13076
entry 0x40078ad0
Connecting to HOME-D7EF-2.4
..WiFi connected
[1075] Connecting to HOME-D7EF-2.4
[1075] Connected to WiFi
[1075] IP: 10.0.0.175
[1075]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.5.0-beta on ESP32

[5001] Connecting to blynk-cloud.com:8442
[5241] Ready (ping: 116ms).

If you run into trouble, don’t worry. If it can’t upload the code due to permissions issues, open a terminal and run:
sudo chmod 666 /path/to/port

If you get an error about an invalid auth code like I did, make sure all your devices are on the same network as the ESP32, generate a new auth code, and double check your setup.
If you’re still having issues, take a look at Sparkfun’s tutorial I mentioned at the beginning of this article. They have a few resources I may not have mentioned.

In the Blynk app press the Play triangle in the top right hand corner. It should tell you whether or not the WiFi LED is connected or not, and once it is, go ahead and press your button, and the LED will light up!

So much excitement for something so small and cute, but it’s sure fun to play with.

{thallia}

Advertisements

4x4x4 Rainbow LED Cube (hardware)

Materials:

  • 64 LEDs – 3mm
  • Resistors (you can calculate the amount of resistance you need, I used 200ohm)
  • a through-hole generic PCB board
  • Wooden board (not huge, just big enough to stick the LEDs in to solder the layers)
  • Hookup wire
  • Male-to-male jumper wires
  • Craft wire (I used 0.8mm)
  • Jumper wires
  • Elegoo Uno (I bought the Elegoo knockoff of an Arduino since I didn’t have a ton of money, it works exactly the same!)
  • A LOT of solder

Tools:

  • Soldering station
  • Drill (with 3mm OR 1/8in drill bit)
  • Wire cutters and strippers
  • Round nose pliers
  • crocodile clips (very, very useful)

 

Step 1: Measure out equidistant holes in your wooden board. It’s really important that they’re as equal as you can get it, or else your LEDs are going to stand all wonky, and it’ll be hard to solder them all together.

I measured the holes about 1/2in apart.

Step 2: Drill the holes!
img_5054.jpg
It helps to have an LED right next to you to make sure it’ll fit nicely in each hole.

Step 3: Solder the LED strips.
Take all the LEDs and bend the cathode (the short, negative lead) in such a way that it doesn’t touch the anode (the longer lead), and make sure when you fit them into the holes on your wooden board that the cathodes overlap each other so you can solder them together, like so:

Once you solder all the strips, lay them out in each set of holes, (with all the cathodes pointing the same way), and….

Step 4: Cut some craft wire and solder it across the LED strips to make it a square!

At this point I recommend using a 9V battery with a resistor on the positive (red) lead, and with the black lead touching the craft wire, go through and test all the LEDs to see if any burnt out or aren’t working. Trust me, it’ll save a LOT of time if you have to replace one now rather than later.

Step 5: Solder the layers!
Line the layers up on top of each other (one at a time), and remember that you’re *only soldering the leads pointing up*.

img_5061
If you’re having a bit of trouble keeping the cube upright or the layers stable, the crocodile clips come in handy to steady the design.

img_5058
The above picture was actually a mistake, I accidentally flipped the layer around the wrong way and had to desolder it because all the cathodes weren’t pointing the right way. (The cathodes being the shorter leads that you bent earlier) I wanted to show an example of the crocodile clips, though.

Once that’s completed, you can turn the cube right side up!

img_5062
You can trim all the excess craft wire off. As for the cathodes sticking out on the sides, I cut them in a stepping-stone fashion like this tutorial said, which will make things easier once we hook the LEDs up to a PCB.

Step 6: Get the right PCB

img_5063
I bought this PCB kit for…about $11, I think. It was a really good deal, these PCBs seem to work very nicely. They weren’t as big as they needed to be, though, so I hot glued two of them together.

This was probably the trickiest part of the whole project: getting 16 LED leads into tiny holes all at the same time. Round nose pliers were my best friend when I did it. Once you get them all in, solder all the joints at the bottom so all your hard work will stay in place!
img_5064

Step 7: Put the resistors in.

Round nose pliers were super handy for this step as well. I chopped the leads of the resistors to be tinier than usual, then with some pliers I stuck them in the holes and soldered them in.

img_5065img_5066
With the leftover resistor leads I used them as mini hookup wire to connect the resistors to the LEDs on the bottom of the board.
img_5067

Step 8: Cut up some more craft wire and solder it to the negative stepping-stone leads, and wire them down to the PCB. img_5069img_5070
Step 9: Get some hookup wire, strip the ends, and pull them all towards the oval pads to connect to the jumper wire GPIO thingies.
img_5075

I would recommend starting with the smaller hookup wires, I found it hard to solder around the bigger ones already in place without almost melting the insulation stuff. img_5077

Step 10: Solder the jumper wires to the board!img_5078
As you can see, I color coded the wires based on which resistor it was connected to. That way, I’ll have an easier time connecting the jumper wires to the GPIO pins on the Uno.

I still have to get some small wire or just use solder to connect the hookup wire to the actual resistors and GPIOs, so the signals will actually flow through the circuit. But otherwise, the big job is finished.

And that’s it! I followed this tutorial the whole time: http://www.makeuseof.com/tag/how-to-make-a-pulsating-arduino-led-cube-that-looks-like-it-came-from-the-future/

Next time, I’ll put up a post on the Uno, loading the code, and getting it all to run.

{thallia}

Introducing: nucleo

Don’t you love getting exciting packages in the mail that are full of electronic cool stuff?

I know I do.

Today, thanks to Arrow’s free overnight shipping (with a purchase of $20 or more), I received my STM32F042K Nucleo. Check out this cutie:


Isn’t he adorable?

 

My mentor, fouric, introduced me to the nucleo a while ago, but I haven’t been able to buy one until now (yay for no money!).

I found a few projects by a cool dude named fduignan on GitHub, who played around with doing some cool LED programming that’s similar to a project I’m wanting to start soon. What better way to learn a device, a new programming language, and how to build things than to play with cute microcontrollers?

I’ve teamed up with one of my friends, he helped me co-captain our improv team, and we’re going attempt building a laminar jumping water fountain. They look something like this. We eventually want to include RGB LEDs into it, so it’ll change colors, and then get those colors to change based on music that’s playing. It’ll be a challenge for sure, but we’re going to learn lots, and that’s the fun of it. I’m hoping to get the LEDs to work with the nucleo, if not, I’ll use my raspberry pi.

When we start the process, I’ll update here with pictures and the process. Hopefully I’ll get my breadboard and RGB LEDs from Sparkfun soon so I can start playing with the code.

Until next time!

Spaced Repetition Learning Systems

lá maith, good day!

Spaced Repetition Systems…what are those? SRS for short, Spaced Repetition Systems are tools to help you memorize anything you wish to have embedded in your brain for a good long while. Be it the nouns and verbs of a new language, definitions of terms from a class you are taking, mathematical equations, or the periodic table of elements, this is a great way to get started memorizing all those details.

When taking a new class and learning all of this new material, you take notes and mentally exclaim, “I am totally going to remember all this!”
Yet, three days later, you’ve forgotten most of that new knowledge (if you haven’t made an effort to retain it). While people say there’s a big learning curve to new subjects, there’s also a large forgetting curve that happens 24-36 hours after you have been presented with new information.

Spaced Repetition Systems take the efficiency of memorizing via flashcards and spread the memorization out effectively over shortened periods of time, allowing the information to seep into your brain at a non-overwhelming speed and increase the rate of retention.

I use the Leitner System, a simple implementation of the SRS concept. I wanted to get down and dirty with the project, so I built my own system out of cardboard and decked it out with washi tape when I finished, to make it look happy.

image

Not too shabby, eh?

It’s pretty shabby.

In case you don’t like the idea of making your own Leitner system, there is an online version by the name of Anki that works just as well.

As you can see, I marked each compartment with a “c1, c2, c3, …cN”, giving me seven mini-boxes. In a Spaced Repetition System, you start out with all your flash cards in the first compartment. Those cards you review every day. When you get a definition or concept right, you’re allowed to move that flashcard to the next compartment, where you review those card every three days. If and when you get them right again, you move those cards to the next section, where you review them every five days. If you get a concept or definition wrong, though, you have to move the card back to the previous compartment.
When you finally get to the end of the compartments and have reviewed those cards at least 5 times, they can be put into the retired deck to be reviewed once a month.

Here’s a visual:

vocabulary-leitner-system

I initially began using the Leitner System for simple definitions and words with a one sentence answer. As I began to realize its efficiency, I added more complicated subjects onto my flashcards; concepts that required me to explain them out loud like I was teaching this new idea to a five year old. This extended my ability not only to remember the concepts, but pushed me to create new ways to explain and understand what information I was conveying.

I have successfully memorized over 400 definitions, concepts, and programming instructions with the Leitner System. It only takes me, at most, five to ten minutes a day to complete. This is extremely useful when you’re venturing into a new and daunting field that requires you to remember hundreds of definitions on the spot, such as biology or engineering. The Leitner System and SRSs are an incredible tool to help learn a new language, memorize some babe’s phone number, self-teach programming concepts or terms, remember dates for history finals, teach yourself guitar chords, there are no limits. Anything can be put into this, and, if you put in enough effort, you’ll have a bunch of neat things embedded in your mind for any situation you find yourself in.

Happy learning!
{thallia}

thallia’s tree; a branch of knowledge

céad míle fáilte,  a hundred thousand welcomes!

I am thallia, a young and aspiring engineer. Electrical engineering and computer engineering have been my focus for almost a year now, alongside programming, mathematics, science, and a little dabble of natural medicine.

Soon I will be shipped off to college to pursue my career in electrical engineering–with that I want to further the research and technology to aid in naturopathic and other natural medical care.

The reason I chose to start a blog is due partially from influence of my mentor. I am a part of a team called Under the Wire, a small group of individuals with a passion for learning and, hopefully someday, we want to reinvent technology.

One of the concepts provided to us by our mentor is called infinity learning. A bit dramatic, I know, that’s what makes it fun. The concept of infinity learning is, ideally, where you are able to train yourself to remember the majority of anything you ever learn. A tool helpful to accomplish this is a blog.

The blogging format gives you a place to, “review, clarify, and document your experiences and learnings” (fouric, 2017). As you learn concepts, run into problems, or discover new things, a skilled way of making sure you understand it completely and correctly is to teach it to someone else; in this case, write it out and explain it to others reading the blog. When you have a limited understanding of a concept, sharing it with someone else requires you to have a fuller knowledge of whatever you’re trying to teach them, therefore pushing you to understand a concept to its full potential.

Using a blog format also gives you a copy of what you know, a frame of reference for if you forget a concept or piece of knowledge in the future.

With that in mind, this blog is where I’ll be posting things that I learn, projects that I’m working on, or problems I run into in the process of learning. I hope some of these posts will teach you a thing or two, provide you with things to think on, or serve as entertainment in general.

If you ever have any questions or comments, feel free to contact me! There’s a form you can fill out in the menu, located in the top left corner of this blog. If you want to read more about who I am and how I got interested in these subjects, you can go here!

Thank you for stopping by!
{thallia}