Ubuntu esp8266 serial port
#UBUNTU ESP8266 SERIAL PORT HOW TO#
#UBUNTU ESP8266 SERIAL PORT INSTALL#
#UBUNTU ESP8266 SERIAL PORT ZIP FILE#
#UBUNTU ESP8266 SERIAL PORT SERIAL#
#UBUNTU ESP8266 SERIAL PORT INSTALL#
Next, Install the esptool.py python module.
#UBUNTU ESP8266 SERIAL PORT ZIP FILE#
So I had to go with the older 1.6.2 that supported a 512 KiB + 512 KiB map.ĭownload your preferred firmware zip file, extract the zip file and navigate to. The ESP-01 by Ai Thinker only had 1 MB in total. ie, You need 2 MB of flash space on your board. The latest firmware at the time of writing this was 1.7.3 and as you can see from the description on the download page, that only supported a 1024 + 1024 KiB flash map. This requires some understanding of terminal and any wrong step here may brick your module. This the default tool which is provided by Espressif to flash firmware onto ESP chips. Using Esptool from the terminal (command line) After this, you can restart the ESP8266 after removing GPIO-0 from GND. After that press upload button as usual and your firmware will be flashed.
#UBUNTU ESP8266 SERIAL PORT SERIAL#
Now select the correct serial port and choose the Blink example. The installation of ESP8266 in Arduino IDE is done.Now close the Boards Manager window and select the Generic ESP8266 Module from the board selection list.Click the Install button to install the ESP8266 Board.Add the below-given link to Additional Boards Manager URLs.For flashing official firmware head on to next method The Arduino method is only flashing the user-written firmware. There are 2 ways to flash your firmware, the First one is using esptool which is a bit complicated process and the second one is using Arduino IDE which also uses esptool at backend abstracting all its complexities. When we restart the module, this setup will put it into bootloader mode. To put ESP8266 into bootloader mode we need to first pull GPIO-0 to GND.
#UBUNTU ESP8266 SERIAL PORT HOW TO#
USB-TTL ( learn how to use Arduino as USB-TTL adapter).
ESP8266 (obvious, but still needs a mention).
We need below-mentioned hardware components: This module has a powerful on-board processing and storage capability that allows it to be integrated with the sensors and other applications through its GPIOs. The other type by the generic manufacturers might just have 512 KiB flash (and their PCBs could be blue in color).ĮSP8266 comes pre-programmed with an AT command set firmware, meaning, you can simply hook this up to your Arduino device and get about as much WiFi-ability as a WiFi Shield offers. These have a flash memory of 1 Megabyte (aka 8 megabits). The AI-Thinker boards have a black PCB with the words “AI-CloudInside” printed near the PCB antenna. So to simplify the whole process and understanding of putting your firmware on ESP8266-01 (by AI-Thinker), we are writing this article. But sometimes it becomes a bit tedious task to flash your firmware onto it. This is why you can communicate with the board serially using a USB cable and the Serial Monitor feature of the Arduino IDE.We know that ESP8266-01 is an impressive, low cost and powerful module with networking capabilities. The Arduino UNO has its own FTDI chip whose function is to convert TTL signal levels to USB. The Arduino act as a USB serial bridge between the computer’s USB port and the MCU’s serial port. I always use this method to communicate with an ESP8266 module. Here we will learn how to use Arduino as a USB Serial converter. Or for some other reason, we need a USB to serial converter. There are always USB-TTL adapters available for Serial communication but sometimes we are in a dire need of these adapters but can’t find it. USB is the universally accepted port these days, and if you are into Microprocessor Programming you must be dealing with Serial communication to communicate with your device.
0 notes
Getting the ESP8266 Code Ready for C
Espressif chips are the sexy mcu’s these days. If you’re reading this, it’s more likely because you’re already familiar with their with what they’ve got to offer. They made their first splash - and I mean like the bombest cannonball you’ve ever seen - with the esp8266 which explorers spent some good time opening the SDK and even going so far as decapping and tracing the silicon. The chip came as an oddly shaped module with 8 pins (the ESP8266-01) then exploded into a bunch of others.
I’m here to convince you to get one if you haven’t and experiment with me because there’s a world of possibility with these. If qualitative statements don’t do it for ya, then check out these specs mostly from its wikipedia entry:
32-bit CPU (Tensilica Xtensa L106 operating at 80MHz
64KiB of instruction RAM and 96KiB of data RAM
802.11 b/g/n wifi with WPA/WPA2, WEP, and open security
2 GPIOs exposed to us (their MUXed functions aren’t great-GPIO 0 is muxed to SPI chip select and GPIO 2 is muxed to I2C SDA... ^^; buuut...)
Each GPIO can be configured for pull-up, can trigger interrupts, be configured as open drain or push-pull. Reportedly (from the datasheet), we can also do PWM but it says in another breath that it is “software programmable” which I take to mean DIY.
500kB or 1MB external SPI flash on the module (not on the SoC)
Afraid you’re going to be spending too much to get all that? YOU CAN GET 4 FOR $14.00 SO NO EXCUSES!
Of course not all of the pins are exposed so that stinks and means we don’t get all of the functionality but we’ll see what we can do with what we’ve got and maybe I’ll do another blog entry if that’s what we’d like to do.
Anyway, I love these and think you should too. I wanted to share how to get as close to main() as possible, and how to make your own tiny programming jig so....let’s GO!
Hardware
Can’t start the software without a little hardware! We need to make a quick programming jig to move between “serial programming” and “run” mode.
I used parts-box parts but you can get similar parts from almost anywhere. Just in case, here’s an ingredients list:
3.3v FTDI cable/module
ESP8266-01
Push button switch (for the reset line which is active low. You’ll see I used a mouse button for some reason but if you use a push button, you’ll need a pull up resistor)
A latched push button (for power but I used another mouse button)
DPST/DPDT switch
Headers (both female and male)
Some perf board
Here are the pin configs for serial programming:
and so this is the schematic we’re after:
Again, I only had the parts I had so here’s the schematic with what I had:
And here’s a quick map of how the perfboard is laid out:
(The boxes and blue lines represent top-layer components and wires, the red lines represent solder mazes)
(Here’s the back side so you can basically put the parts in as in the first photo and solder the traces on the back like this photo)
When all is said and done, you end up with this:
Easy as pie and hardware part done!
Software
Alright, so next up let’s get the toolchain setup, upload the blinky code, modify, and upload again so we feel good and ready to move onto projects. I chose open-esp-sdk purely because others really liked it.
This process is pretty typical but here’s the idea:
Install Dependencies (apt-get) -> Clone the Repository (git) -> Build the Project (make) -> Globalize the Tools (assigning to a global)
Then it’s time to build the example and load it up on the ESP.
Build Blinky (make) -> Power Cycle the device in program mode -> Load the new binary to the board (esptool.py) -> drink beer in celebration
Setting up the Environment
Install the Dependencies - download and install all the programs that will help you build the environment, build the esp binaries and use the upload tools
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf flex \ bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial \ sed git unzip bash help2man wget bzip2 libtool-bin
Clone the repository - for those who are new to git (many at my company were when they came aboard, obviously me included) all this is is just copying a project that someone has posted to git down to your computer. Make sure you go to the directory where you want your project to reside and type:
`git clone --recursive https://github.com/pfalcon/esp-open-sdk.git`
Build the Environment - When it’s done, cd into the esp-open-sdk directory and make the project
cd esp-open-sdkmake STANDALONE=y
The “STANDALONE=y” ensures you get the xtensa toolchain and the esp SDK.
Depending on your hardware this may take a while. Just for shits and giggles I installed it on my Crubuntu laptop which took an hour (to be fair I was watching netflix on the Chrome side). If it goes off without a hitch, it will report
Espressif ESP8266 SDK is installed, its libraries and headers are merged with the toolchain
Pitfalls
I’ve encountered two errors when I tried this though - one was when I followed the github instructions and didn’t try to install libtools-bin (since it said you may not require it). For safety, I just put it in my apt-get command above.
The other was because I had played around a bunch on my computer and had the LD_LIBRARY_PATH variable set to which it complained
[ERROR] Don't set LD_LIBRARY_PATH. It screws up the build.
If that happens, make sure you clear your LD_LIBRARY_PATH environmental variable with
unset LD_LIBRARY_PATH
and try again.
Globalize the Tools - We’ll want to make it so that we can access the xtensa gcc toolchain (which we’ll use to compile link and convert our sourcecode to ELF) and the esptools (which we’ll use to convert to a binary and write to flash locations on the chip over serial) everywhere. To make that happen, we need to add the path to xtensa-lx106-elf-gcc and esptool.py to the ~/.bashrc - the file that loads every time we load a terminal session.
There should have been a line above the success message that says
Xtensa toolchain is built, to use it:
export PATH=[your_path_to_esp_open_sdk]/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
Go ahead and do that - type:
export PATH=[your_path_to_esp_open_sdk]/esp-open-sdk/ xtensa-lx106-elf/bin:$PATH
But let’s also add it to our ~/.bashrc which controls what happens when we open a new terminal:
echo “export PATH=[your_path_to_esp_open_sdk]/esp-open-sdk/ xtensa-lx106-elf/bin:$PATH” >> ~/.bashrc
and then we’re good! To test if that worked, cd to the esp-open-sdk directory and then do
cd examples/blinky
and type
make
If that went through well (i.e. it didn’t throw any complaints to you), you’ve properly configured your environmental path variable. Now remove the blinky binaries (make seems to make different binary locations than those used in make flash and make clean)
rm -f blinky blinky.o blinky-0x00000.bin blinky-0x10000.bin
Testing with blinky.c
Our next goal is to run blinky on the board.
Test the Serial Port
First let’s make sure we have access to the serial port so we can program the device. Connect your FTDI programmer to your USB port and type
dmesg | grep FTDI
It should list a line like this to tell you which /dev the FTDI connected to like
usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
Next, send something like (where ttyUSB0 is the device you got)
echo -ne “\r\n” > /dev/ttyUSB0
If you just get another prompt pop up immediately after, you shouldn’t have anything to worry about and can move to the next section. If you get the Permission Denied message, you need to add yourself to the same group as your FTDI port. Let’s find out which group we need to be a part of. Type:
ls -l /dev/ttyUSB0
and you should get something like:
crw-rw---- 1 root serial 188, 0 Jun 19 02:52 /dev/ttyUSB0
Many sites online just say to add to “dialout” but you see that my port is connected to the group “serial.” I can add myself to that group with:
sudo usermod -a -G serial alexmo
and then log out and log back in.
Now when you’re back in, if you retype
echo -ne “\r\n” > /dev/ttyUSB0
you shouldn’t see the permission denied message.
Build
Build with
make
You’ll see a few new files. The binaries marked blinky-0x00000.bin and blinky-0x10000.bin tell you where they should be written.
Program
Now let’s program the device with the binaries. If you see blinky-0x00000.bin and blinky-0x10000.bin, just type
esptool.py write_flash 0 blinky-0x00000.bin 0x10000 blinky-0x10000.bin
It will work on it:
esptool.py v1.2
Connecting...
Auto-detected Flash size: 4m
Running Cesanta flasher stub...
Flash params set to 0x0000
Writing 36864 @ 0x0... 36864 (100 %)
Wrote 36864 bytes at 0x0 in 3.2 seconds (91.5 kbit/s)...
Writing 196608 @ 0x10000... 196608 (100 %)
Wrote 196608 bytes at 0x10000 in 17.1 seconds (92.1 kbit/s)...
Leaving...
and then start blinking!
0 notes
Meet the Microbit a Hacker’s dream come to life
The micro:bit is a small ARM microcontroller developed by the BBC, along with a gaggle of technology giants, to give away to children in the United Kingdom to help them learning computing. The device was released to teachers in early 2016.
As a hardware hacker, I was curious about how this board compared to an Arduino or Raspberry Pi. As always, I also wanted to see how the micro:bit might play with a Linux notebook and if it had a place in the Off-The-Shelf hacker’s tool box.
The device is interesting and has some cool features. Let’s take a look.
Hardware Overview
The board fields a 16 MHz, 32-bit Arm Cortex-MO micro-controller, 256 KB of flash and 16 KB of static RAM. It also has a Bluetooth Low Energy radio onboard for local networking with a super phone or other Bluetooth-equipped device. There’s an additional ARM microcontroller that handles the USB connection and external power management. As an Inter-Integrated Circuit (I2C), it includes an NXP/Freescale MMA8652 three-axis accelerometer and a NXP/Freescale MAG3110 three-axis magnetometer. The front-end user interface is a 25 surface-mounted LED array (arranged in a 5 X 5 matrix) and two push buttons. The back side of the board has the micro-USB connector, a power/upload status LED, a reset button and an external 3.0-volt connector.
There’s also a 23-pin edge connector and 5-ring connectors. You can connect alligator clips or banana plugs to the ring connectors for simple projects.
The two right ring connectors are for +3.0 volts and ground. Pins 0, 1 and 2 serve as analog inputs, while the remaining 23 connectors function as GPIO, analog in, power, and ground pins. Some of the pins are shared with the onboard LEDS. Various pins also support I2C and SPI buses.
There’s a convenient help page describing the pins in much greater detail.
How about Software?
Recall that the Raspberry Pi is a multi-user, multi-tasking system. In contrast, the micro:bit is similar to the Arduino microcontroller. It’s doesn’t have a Linux operating system or micro-SD card. There isn’t a WiFi stack, either. Don’t let that put you off, it’s a nice little package with plenty of power and capabilities. Code development is handled on a notebook and uploaded to the micro:bit as firmware.
The micro:bit uses web-based applications for editing and uploading code. Of course, using web-based tools means you’ll need a WiFi or Ethernet connection on your Linux notebook.
Don’t have WiFi? No problemo, use your super-phone. Download the Android app and pair the micro:bit with your phone over Bluetooth. The web-based applications work via the phone, as well. In an upcoming article, we might cover using the Android app with the micro:bit.
Several of the editors are visual-based, “slide the parts together” apps quite suitable and intuitive for children and beginners. They include:
MicroSoft PXT: Supports block-based editing and JavaScript.
Block Editor: Supports drag-and-drop code blocks.
Javascript: Code Kingdom is a drag-and-drop editor for JavaScript.
I prefer traditional text editors, so fortunately, there are a couple of those, as well:
Python: Text-based editor that has a collection of pre-built code snippets for use in your projects
Microsoft Touch Develop: An editor that’s designed for building mobile applications with a touchscreen
I’m somewhat familiar with Python, so that’s the one I used during this review. Here’s a screenshot of the requisite “Hello, World” script, with some additional code I snarfed from the reference manual.
The MicroPython documentation is easy to use, comprehensive and full of useful code snippets. Start with the tutorial introduction page. There’s a handy index along the left side of the screen, that will take you to the various topics.
Once the code was finished, I simply clicked the “Download” button to compile everything into a .HEX file. The file then showed up in my /home/rob/Downloadsdirectory. I used the provided USB cable to connect the micro:bit board to my Linux notebook and copied the file into the /media/rob/MICROBIT directory. Using the Thunar file manager application on Linux makes handling files a breeze.
After copying the file (uploading) to the MICROBIT directory, the board will reboot and run the script. If there is an error, a message will scroll across the LED array, pointing to the offending line in the code.
Slick!
Going Further
Even if you are used to working in the Arduino IDE ecosystem, I think the micro:bit shows a lot of promise as an easy-to-program micro-controller platform. Python is gaining in popularity on nano-sized systems. You may have already used Python with the Raspberry Pi.
And, I like the idea that you can simply compile the program and use a simple file copy to upload the firmware to the board. That’s a heck of a lot easier than the standard Arduino upload, particularly to ESP8266 boards.
While we didn’t get into general purpose input/output (GPIO) capabilities today, the micro:bit is a solid product and I’ll likely cover other details and features, in future articles.
This product is not available in the US and is currently sold in the UK and when more information is available on how you can get you hands on one our blog will be updated. “Stay tune”
Read More Cyber New’s Visit Our Facebook Page Click the Link : https://www.facebook.com/pages/Cyber-crew/780504721973461
Read More Cyber New’sVisit Our Twitter Page Click the Link : https://twitter.com/Cyber0Crew
~R@@T @CCE$$~
0 notes