5108 views|15 replies

32

Posts

0

Resources
The OP
 

Some questions about using MicroPython with NodeMCU [Copy link]

 
 Let me first talk about why I want to play with nodemcu. I am a junior student in an ordinary second-tier university. I am about to choose a graduation project topic. I want to make a graduation project similar to a wifi probe. Because I have participated in electronic competitions before, I have some knowledge of esp8266, and then I also learned some unclear things by looking for resources on the Internet. I used arduino ide for esp8266 for development before, but my personal ability is limited and I have no understanding of the bottom layer. I can only mess around according to the information. In the end, I barely made a wifi controlled car to play with. Then I never touched it again. Recently, I learned about micropython by self-studying python. I looked at the few nodemcu I bought and started the preliminary information search with a try mentality. But after a few days of Baidu information, I am still confused. And there are very few information tutorials. Now I will talk about the few things I don’t understand. I hope that a big guy can answer them. In fact, I was forced to try it because I also looked through this forum and felt that there are not too many active people. 1. How to program the nodemcu after burning the official micropython firmware? Can I directly write a python file and pass it in? 2. Based on the programming ability, the WiFi probe needs to obtain the information sent by each terminal (mainly MAC) in AP mode. This information acquisition requires the understanding of the underlying functions. How to program it? 3. For the obtained MAC address, I need to store it permanently, that is, it needs to be stored on the flash. Is it in the form of a file or directly store data? And how to program it? 4. The most important point is that I found that the port of my computer's device manager is gone. The nodemcu can't read the port number at all when it is plugged in, which makes me stagnant now. I have basically tried all the methods on Baidu, but there is still no port. I have updated the ch340 cp210 motherboard driver, except for the reinstallation system mentioned on the Internet. PS: It's been too long since I used it. Even the hardware doesn't care about me. 2 and 3 are just the places where I have no ideas in my graduation ideas. I just post them to relieve my depression. The most important 1 and 4 are very troubling to me now. I haven't fully figured out this micropython for esp8266. After burning the firmware, can it execute the written py file? And is there a file system? Another thing that frustrates me is that I want to understand this hardware, but I can't find a way to get started, such as understanding its underlying structure and function implementation. I also need to understand the principles of code execution, but my English ability is limited and I am not good enough to read the official documentation, so I am probably confused.


Latest reply

The returned is not a binary string, but a bytes object, which is the mac address. If you want to convert it into aa:bb:cc, just convert it into a string yourself  Details Published on 2018-5-30 12:44
 
 

32

Posts

0

Resources
2
 
To be honest, my mind was a mess when I typed these words, and some parts may not be expressed clearly. If there is really an expert who is willing to guide me, I would be very grateful.
 
 
 

1297

Posts

2

Resources
3
 
1. yes 2. You don't need to understand the underlying functions, just call the method 3. Just the file 4. Go to someone else's computer and try to see if you can see it. Or find another good cp210x USB to serial converter and plug it into your own computer to try.

Comments

Regarding the second question, let's not talk about the bottom layer. Just like calling methods are tools, now I can only copy the tools (other people's codes) used by others, but what I want more is to know how many tools there are (all calling methods) and the purpose of each tool, that is, to understand these methods systematically.  Details Published on 2018-5-28 19:03
 
 
 

1w

Posts

25

Resources
4
 
There is a "MicroPython Chinese Tutorial 2.0" in the forum, which contains detailed instructions for using MicroPython for ESP8266, as well as previous activity posts. There are many posts with content for reference. You can basically master the usage by following them. There is also a book "MicroPython Getting Started Guide", which organizes these contents in a more systematic way.
 
 
 

1w

Posts

25

Resources
5
 
Unlike STM32, ESP8266 has only one USB to serial port, so programming and downloading are all done through this USB serial port. If the serial port cannot be found, it is probably a system driver problem. You can check the system's device manager. Most ESP8266 modules have 4Mbyte flash. In addition to the firmware, there is about 3M space for saving files and data. Micropython has a file system, which is used in the same way as PC python. It can create, modify, and rewrite files. Micropython has made many network modules for ESP8266, which can easily implement various network functions.
 
 
 

32

Posts

0

Resources
6
 
johnrey posted on 2018-5-28 09:47 1. yes 2. You don't need to understand the underlying functions, just call the method 3. The file is fine 4. Go to someone else's computer to see if you can see it. Or find another...
After changing a few cables, the port finally came out. I guess it's a cheap Android cable without a data cable. I'm trying to figure it out by myself for now. Please give me some advice.
 
 
 

32

Posts

0

Resources
7
 
dcexpert posted on 2018-5-28 12:52 There is a "MicroPython Chinese Tutorial 2.0" in the forum, which contains detailed instructions for using MicroPython for ESP8266, as well as previous activity posts, with quite a few...
I downloaded the PDF from the forum, but the layout is really not good, so I decided to buy a physical book. Thanks for the guidance. By the way, are these two books written by you, Mr. Shao? This is the first time I feel that a great man is so close to me.

Comments

The book was indeed written by me, you can refer to it. As for the use of tools and all methods, one can refer to the official documentation, and the other is to pay attention to the discussions of netizens on the forum. http://docs.micropython.org/en/latest/pyboard/  Details Published on 2018-5-28 21:04
 
 
 

32

Posts

0

Resources
8
 
johnrey posted on 2018-5-28 09:47 1. yes 2. You don’t need to understand the underlying functions, just call the methods 3. Just the file 4. Go to someone else’s computer and try to see if you can see it. Or find another...
Regarding the second question, let’s not talk about the underlying functions. Just like calling methods are tools, now I can only copy the tools used by others (other people’s codes), but what I want more is to know how many tools there are (all calling methods) and the purpose of each tool, that is, to understand these methods systematically. Where can I learn about this?

Comments

Go to the ESP8266 documentation of MicroPython, which is in pure English. The network part uses the network module, import it, and the whole STA. There are only a few functions in total. If you want to understand the system, then the premise is that you must first understand the WiFi connection process before you can match the function with your application needs.  Details Published on 2018-5-28 23:21
 
 
 

113

Posts

0

Resources
9
 
If you want to know all the details, this project is a bit large. You can go to mpy's github to see the source code.
 
 
 

1w

Posts

25

Resources
10
 
grey27 posted on 2018-5-28 19:00 I downloaded the PDF from the forum, but the layout is really not good. I decided to buy a physical book. Thanks for the guidance. Both books were written by you, Mr. Shao...
The book was indeed written by me, you can refer to it. As for the use of tools and all methods, one is to refer to the official documents, and the other is to pay attention to the discussions of netizens on the forum. http://docs.micropython.org/en/latest/pyboard/

Comments

Where can I download the firmware for the development board? I want to see the examples in it  Details Published on 2018-5-29 11:01
 
 
 

1297

Posts

2

Resources
11
 
grey27 posted on 2018-5-28 19:03 Regarding the second question, let's not talk about the underlying layer. It's like calling a method is a tool. Now I can only follow the tools (other people's codes) used by others...
Go and read the documentation of esp8266 of micropython, which is pure English. The network part uses the network module, which is imported, and the entire sta. There are only a few functions in total. You said that if you want to understand the system, then the premise is that you must first understand the WiFi connection process, so that you can match the function with your application needs. It is of no value to simply look at the API in a systematic way.

Comments

After looking at it, there are indeed very few functions, and I didn't see any function for obtaining the MAC address, which is really confusing.  Details Published on 2018-5-29 11:02
 
 
 

32

Posts

0

Resources
12
 
dcexpert posted on 2018-5-28 21:04 The book is indeed written by me, you can refer to it. Regarding the use of tools and all methods, one can refer to the official documentation, and the other is about...
Where can I download the firmware of the development board? I want to see the examples in it
 
 
 

32

Posts

0

Resources
13
 
johnrey posted on 2018-5-28 23:21 Go to read the documentation of esp8266 of micropython, which is in pure English. The network part uses the network module, import it, and the whole sta. There are not many functions in total...
I looked at it and found that there are indeed very few functions, and I didn’t see any function for obtaining the mac address, which is really a headache.

Comments

Using the scan function will return a lot of information, including the mac address. Anyway, you can try the function yourself. I feel that the help itself does not contain much information.  Details Published on 2018-5-29 12:27
 
 
 

1297

Posts

2

Resources
14
 
grey27 posted on 2018-5-29 11:02 I looked at it and found that there are indeed very few functions, and I didn’t see any function for obtaining the MAC address, which is really confusing
Using the scan function will return a lot of information, including the MAC address. Anyway, you can just try it yourself. I feel that the help itself does not contain much information.

Comments

How can I convert the returned binary string into the real MAC address? This is the MAC address of the hotspot searched under STA.  Details Published on 2018-5-29 15:21
 
 
 

32

Posts

0

Resources
15
 
johnrey posted on 2018-5-29 12:27 Using the scan function, a lot of information will be returned, including the mac address. Anyway, you can try the function yourself. I feel that the help itself...
How can the returned binary string be converted into the real mac address? And this is the mac of the hotspot searched under STA

Comments

What is returned is not a binary string, but a bytes object. This is mac. If you want to turn it into aa:bb:cc or something like that, just convert it to a string yourself.  Details Published on 2018-5-30 12:44
 
 
 

1297

Posts

2

Resources
16
 
grey27 posted on 2018-5-29 15:21 How can the returned binary string be converted into the real mac address, and this is the mac address of the hotspot searched under STA
The returned is not a binary string, but a bytes object, which is the mac address. If you want to convert it into aa:bb:cc, just convert it into a string yourself
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list