CN110415502A - A kind of spectrum sensor module drive based on ESP32 and Wi-Fi transmission device and method - Google Patents
A kind of spectrum sensor module drive based on ESP32 and Wi-Fi transmission device and method Download PDFInfo
- Publication number
- CN110415502A CN110415502A CN201910423074.9A CN201910423074A CN110415502A CN 110415502 A CN110415502 A CN 110415502A CN 201910423074 A CN201910423074 A CN 201910423074A CN 110415502 A CN110415502 A CN 110415502A
- Authority
- CN
- China
- Prior art keywords
- esp32
- module
- spectrum sensor
- ccd
- client
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001228 spectrum Methods 0.000 title claims abstract description 58
- 238000000034 method Methods 0.000 title claims abstract description 34
- 230000005540 biological transmission Effects 0.000 title claims abstract description 26
- 230000010354 integration Effects 0.000 claims abstract description 14
- WHXSMMKQMYFTQS-UHFFFAOYSA-N Lithium Chemical compound [Li] WHXSMMKQMYFTQS-UHFFFAOYSA-N 0.000 claims abstract description 10
- 229910052744 lithium Inorganic materials 0.000 claims abstract description 10
- 230000003595 spectral effect Effects 0.000 claims abstract description 5
- 230000006870 function Effects 0.000 claims description 40
- 238000006243 chemical reaction Methods 0.000 claims description 19
- 230000003068 static effect Effects 0.000 claims description 12
- 238000004088 simulation Methods 0.000 claims description 8
- 238000012544 monitoring process Methods 0.000 claims description 7
- 238000004891 communication Methods 0.000 claims description 6
- 230000003993 interaction Effects 0.000 claims description 6
- 230000002159 abnormal effect Effects 0.000 claims description 3
- 230000008676 import Effects 0.000 claims description 3
- 230000007246 mechanism Effects 0.000 claims description 3
- 238000012217 deletion Methods 0.000 claims description 2
- 230000037430 deletion Effects 0.000 claims description 2
- 230000009977 dual effect Effects 0.000 claims description 2
- 241000208340 Araliaceae Species 0.000 claims 1
- 235000005035 Panax pseudoginseng ssp. pseudoginseng Nutrition 0.000 claims 1
- 235000003140 Panax quinquefolius Nutrition 0.000 claims 1
- 239000000284 extract Substances 0.000 claims 1
- 235000008434 ginseng Nutrition 0.000 claims 1
- 238000001514 detection method Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000004611 spectroscopical analysis Methods 0.000 description 1
- 230000000087 stabilizing effect Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01J—MEASUREMENT OF INTENSITY, VELOCITY, SPECTRAL CONTENT, POLARISATION, PHASE OR PULSE CHARACTERISTICS OF INFRARED, VISIBLE OR ULTRAVIOLET LIGHT; COLORIMETRY; RADIATION PYROMETRY
- G01J3/00—Spectrometry; Spectrophotometry; Monochromators; Measuring colours
- G01J3/28—Investigating the spectrum
-
- G—PHYSICS
- G08—SIGNALLING
- G08C—TRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
- G08C17/00—Arrangements for transmitting signals characterised by the use of a wireless electrical link
- G08C17/02—Arrangements for transmitting signals characterised by the use of a wireless electrical link using a radio link
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/02—Details
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/163—In-band adaptation of TCP data exchange; In-band control procedures
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Physics & Mathematics (AREA)
- Signal Processing (AREA)
- Spectroscopy & Molecular Physics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
A kind of spectrum sensor module drive and Wi-Fi transmission device, built-in lithium battery and circuit board based on ESP32, meets the power requirement of all modules and chip;Using high-performance microprocessor built in ESP32, sample states machine adds timer to come the timing of Collaborative Control sensor and ADC chip, the time of integration, completes the data acquisition function of spatial distribution, is added in MicroPython firmware;Using register ()/unregister method, regular expression and dictionary of the poll object of uselect module, the session management of data transmission is realized.And provide a kind of spectrum sensor module drive based on ESP32 and WiFi transmission method.The present invention, which not only solves, executes that Python code speed is too slow, is not able to satisfy spectral detection and the problem of analysis requires, and provides session management, realizes and mobile phone/computer wireless data transmission.
Description
Technical field
The present invention relates to the Timing driver of CMOS spectrum sensor module, analog-to-digital conversion in a kind of spectrometer and pass through net
The device of network transmission, the device and method of the acquisition and WiFi transmission of specifically a kind of spectroscopic data.
Background technique
In the spatial distribution scene of some test LED light, need that spectrum sensor is driven to obtain 340nm to 780nm wave
The analog signal of long spectrum, and digital quantity is converted by modulus conversion chip (ADC), then intelligent hand is uploaded to by WiFi
Machine.Conventional way is to need a piece of mould ADC, a high performance microprocessor and a WiFi module.In microprocessor
Control under, analog quantity and is converted into digital quantity by ADC, then passes through WiFi by timing needed for generating spectrum sensor
It is sent to server.
WiFi module (such as: the stronger microprocessor of processing capacity the ESP32 of Le Xin company) has been embedded in itself, and has been assisted
View stack only takes up less than half resource of microprocessor.Using WiFi module embed microprocessor come drive spectrum sensor and
ADC chip eliminates the additional microprocessor of unnecessary addition, thus reduce small product size, reduce cost, improve reliability and
Extend battery service life.
Summary of the invention
In order to overcome the biggish deficiency of higher cost, small product size of existing spectrum sensor, in order to reduce cost, reduce
Small product size, the present invention provide it is a kind of by terminal devices such as smart phone or computers, using the WiFi function of ESP32 module,
And module its embedded high performance microprocessor, it adopts and shows a C language spectrum sensor and ADC chip driver program, add
It is added in MicroPython firmware;Python code is write, realizes data acquisition and the WiFi transfer function of spatial distribution.
The technical solution adopted by the present invention to solve the technical problems is:
A kind of spectrum sensor module drive and Wi-Fi transmission device based on ESP32 module, built in described device main body
Lithium battery and circuit board, the lithium battery boost to stable 5V by charge and discharge integrated module and provide power supply, charge and discharge for device
Electric integrated module is lithium battery charging by circumscribed USB mouth;The circuit board is using ESP32 module as core, external GPIO cause for gossip
The timing of existing spectrum sensor module and the time of integration, so that spectrum sensor exports suitable spatial distribution analog signal;Institute
The ADC chip for stating the external SPI interface of ESP32 module realizes analog-to-digital conversion to the analog signal of spatial distribution;The ESP32 mould
High-performance microprocessor built in block is adopted and shows a C language spectrum sensor and ADC chip driver program, is added to
In MicroPython firmware;Microprocessor built in the ESP32 module writes Python code, and firmware is called to realize spectrum
The acquisition of distributed data, and by Transmission Control Protocol, it realizes and the interaction of smart phone/computer.
Further, the ESP32 module, built-in Xtensa 32-bit LX6 super low-power consumption, up at 240MHz double-core
Device and the space 32MB size Flash are managed, there is the I/O mouth of expansion in module.The data of spatial distribution are acquired with transmission
Through enough, without adding additional microcontroller, save the cost and space.
Further, the ESP32 module using C language program, according to spectrum sensor (such as C12666MA) when
The requirement of sequence and the time of integration, generates suitable logic level on GPIO pin, and driving sensor exports 340nm to 780nm
The spectral simulation amount of wavelength;According to the timing of ADC chip (such as ADS8326), spectrum sensor timing and slew rate requirement,
Spectral simulation amount is converted into corresponding digital quantity at the time of suitable;Driving is added in MicroPython firmware, In
Main.py calls the function in firmware to complete corresponding function.
Further, it is described based on ESP32 module spatial distribution data acquisition driving using timer add state machine come
The timing data acquisition of Collaborative Control spectrum sensor and ADC chip.ESP32 timer with set time value (such as
Interruption 20us) is generated, in interrupting service function, the clock CLK pin of spectrum sensor is overturn, guarantees wanting for 50% duty ratio
It asks;The two neighboring failing edge time difference on spectrum sensor ST pin determines the time of integration of pixel;ST failing edge is opened
Begin, every 4 CLK clocks, exports the analog signal of 1 pixel;State machine combination counter, to control the product of spectrum sensor
Between timesharing, the Serial output of each pixel simulation amount, ADC chip start conversion, end is converted, and the simulation after conversion
In amount deposit array.
Further, the firmware of the spatial distribution data acquisition driving based on ESP32 module provides MicroPython
Interface.The customized structural body including spectrum sensor and ADC chip pin, state, SPI interface, the time of integration etc.
machine_ccd_obj_t;Extern const mp_obj_type_tmachine_ is added in modmachine.h file
ccd_type;Subclass table STATIC constmp_rom_map_elem_t machine_ in modmachine.c file
In module_globals_table [] array, { MP_ROM_QSTR (MP_QSTR_Ccd), MP_ROM_PTR (& are added
machine_ccd_type)};In the modularity function dictionary STATIC constmp_rom_map_ of driving file modcd.c
In elem_t machine_ccd_locals_dict_table [] array, it is added to { MP_ROM_QSTR (MP_QSTR_ccd_
), read MP_ROM_PTR (&machine_ccd_read_obj) } interface function;In driving file modcd.c, spectrum is read
The variable element interface function of distributed data is defined as STATIC mp_obj_tmachine_ccd_read (mp_uint_t n_
Args, const mp_obj_t*pos_args, mp_map_t*kw_args) and STATIC MP_DEFINE_CONST_FUN_
OBJ_KW(machine_ccd_read_obj,1,machine_ccd_read).In this way, can pass through in main.py program
From machine import Ccd load Ccd driving, then Ccd.read () can call driver, realize spectrum
The acquisition of distributed data.
A kind of spectrum sensor module drive based on ESP32 module and WiFi transmission method, ESP32 module work in AP
A wireless access point is used as under mode, client device connects this AP, and host and client carry out TCP communication, and host passes through
Select mechanism management communicating pair socket, communicating pair provide that a kind of message and command format carry out communication interaction data,
Realize data transmission.
Further, AP object ap is created, active () function of ap object is called, creates wireless aps, activates AP hot spot, if
The essid for setting AP is that a fixed character serially adds behind the address mac of AP 3, and the password of AP is arranged;Create host
Socket binds socket and host address, monitors client connection, connections dictionary is created, for saving client
socket。。
Further, the method for session management is taken to manage the connection of each client.Session increases addSession,
The connection that a client is received using the accept () function of uscoket module, obtains client socket and address, will
Socket is saved in connections dictionary, using uselect module poll object registration client socket and bind
Monitoring event;DelSession is deleted in session, is nullified client using the poll object of uselect module and is connected, closes client
Socket is held, client socket is deleted in connections dictionary;All socket closeall are closed, are traversed
Each client socket is nullified and closed to connections dictionary, empties connections dictionary, nullifies and close master
Machine socket.
Further, poll object poll_obj is obtained using uselect module poll () method, is infused using poll_obj
It is POLLIN and POLLHUP that monitoring event, which is arranged, in volume host socket simultaneously, exits mark exitflag and is set as False, benefit
Event object events is obtained with poll_obj object poll () method, traversal event object obtains wherein socket, if it is
Host socket then executes and increases session addSession, client socket is otherwise obtained from connections dictionary,
Client message msg is received using usocket module recv () method, executes deletion session if message m sg is sky
DelSession, otherwise simultaneously using the set message format of search () function of ure module and regular expression matching both sides
Command string cmdstr is obtained, then Shu Benci is recycled if it is sky knot, is otherwise obtained order therein and is divided with comma
It is order cmd to parameter list arglist, arglist [0], arglist latter element is the corresponding parameter of cmd, and cmd is gone
The set order of both sides, the checking parameter if successful match are matched, if parameter verification success, carries out corresponding operating and send
For data to client, verification failure then sends parameter error information to client, if the success of none commands match to
Client sends order error message, and traversal finishes events object and then judges whether exitflag is True, if if true,
It executes closeall and closes all socket, otherwise continue to obtain event object events
Beneficial effects of the present invention are mainly manifested in:
1, the present invention makes full use of ESP32 as in the function and chip interior SPI function and module of microcontroller
I/O resource is avoided using additional microcontroller, save the cost and saving space.
2, the present invention utilizes MicroPython firmware, and addition data acquire drive module into MicroPython firmware,
Python code can call directly drive module and obtain spatial distribution data.
3, the present invention provides an AP using the WiFi function of ESP32, and client connects this AP, and the two passes through Transmission Control Protocol
Carry out communication interaction data.Monitor socket event using select mechanism in ESP32 module, to the connection request of client,
It disconnects, abnormal and sending and receiving data is managed.Simultaneously, it is specified that a kind of message, command format, client is according to agreement
Format sends different request commands, and server-side resolve command simultaneously provides corresponding service, returns to the data of JSON format to visitor
Family end.
Detailed description of the invention
Fig. 1 is general hardware architecture figure.
Fig. 2 is spatial distribution data acquisition state figure.
Fig. 3 is timer interrupt service program ISR flow chart.
Fig. 4 is data transmission initialization procedure figure.
Fig. 5 is data transmission stream journey figure.
Specific embodiment
The present invention is described further with reference to the accompanying drawing.
Referring to Fig.1~Fig. 5, a kind of spectrum sensor module drive and Wi-Fi transmission device based on ESP32, described device
Main body built-in lithium battery and circuit board, the lithium battery boost to stable 5V by charge and discharge integrated module and provide electricity for device
Source, charge and discharge integrated module are lithium battery charging by circumscribed USB mouth;5V power supply is that ESP32 module mentions by LDO voltage stabilizing chip
For 3.3V voltage;For the circuit board using ESP32 module as core, external GPIO cause for gossip shows the timing and product of spectrum sensor module
Between timesharing, so that spectrum sensor exports suitable spatial distribution analog signal;The ADC of the external SPI interface of ESP32 module
Chip realizes analog-to-digital conversion to the analog signal of spatial distribution.
Xtensa 32-bit LX6 super low-power consumption built in the ESP32 module, up to 240MHz dual core processor and
32MB size Flash is adopted as the microcontroller of spectrum sensor and ADC chip and is shown a C language drive code set in space, and
It is added in MicroPython firmware;Wireless aps are provided using the WiFi function of module itself, smart phone/computer is connected into this
AP carries out data interaction using TCP communication agreement and defined message format, realizes data transport service.
Referring to shown in Fig. 2, for the state machine diagram of spectrum sensor data acquisition.In idle state, all controls are initialized
The pin of spectrum sensor and ADC chip, to integrate and conversion is ready;Starting integral, so that spectrum sensor enters product
Isloation state, the time of integration of each pixel are the time difference of 2 adjacent falling edges on ST pin;The time of integration arrives, each pixel
Analog signal successively serially remove, be then converted into digital quantity by ADC.Herein, the ADC chip of 16,5V are had chosen
Rather than the AD peripheral hardware built in ESP32, this is because the essence of the voltage of the analog signal of spectrum sensor output and analog-to-digital conversion
Degree requirement has been more than the performance that AD peripheral hardware built in ESP32 can be provided.According to the timing diagram of spectrum sensor, when every 4 CLK
Clock serially removes the analogue value of a pixel, only when analog quantity is effective, opens ADC conversion, and the number after conversion
Amount is saved in array.
Timer interrupt service program ISR process is shown referring to Fig. 3.When first entering ISR, spectrum sensor is initialized
With all pins of ADC chip, it is ready for subsequent movement.The time of integration of each pixel is managed by spectrum sensor ST
The time difference of 2 adjacent falling edges on foot controls, therefore is starting to integrate the moment and integrating finish time, in ST pin
Upper generation failing edge.When entering reading pixel status, the analog quantity of a pixel is serially removed from spectrum sensor, is needed
4 CLK clocks namely 4 high level, 4 low levels are wanted, totally 8 ISR are interrupted.Kth interrupt, if K=3, at this time certain
The analog quantity of a pixel is effectively exported in the Video pin of spectrum sensor, and the piece choosing that ADC is arranged effectively, is done for AD conversion
Prepare;In K=4, starting ADC conversion, namely starting SPI function;In K=7, AD conversion is over, after conversion
Digital quantity is write in array and is saved;Then judge whether all pixels all remove and AD conversion finishes, if
It is that spectrum sensor and ADC chip, and Off Timer are then resetted in next ISR.
It needs to call timer_init () function initialization timer, timer_set_counter_ in this process
The value of value () function setup counter, the alarm clock alarm value of timer_set_alarm_value () function setup timer,
Timer_enable_intr () function enables timer interruption, timer_isr_register () function registration timer ISR
Function, timer_start () function opening timing device call timer_pause () function to stop timer, call esp_
Intr_free () function discharges ISR function.
The firmware of spatial distribution data acquisition driving based on ESP32 module provides MicroPython interface.It is customized
Structural body machine_ccd_ including spectrum sensor and ADC chip pin, state, SPI interface, the time of integration etc.
obj_t;Extern const mp_obj_type_tmachine_ccd_type is added in modmachine.h file;In
STATIC constmp_rom_map_elem_t machine_module_globals_ in modmachine.c file
In table [] array, addition MP_ROM_QSTR (MP_QSTR_Ccd), MP_ROM_PTR (&machine_ccd_type) };
In the STATIC const mp_rom_map_elem_tmachine_ccd_locals_dict_ of driving file modcd.c file
In table [] array, { MP_ROM_QSTR (MP_QSTR_ccd_read), MP_ROM_PTR (&machine_ccd_ are added to
Read_obj) } interface function;In driving file modcd.c file, the variable element interface function of spatial distribution data is read
It is defined as STATIC mp_obj_tmachine_ccd_read (mp_uint_t n_args, const mp_obj_t*pos_
Args, mp_map_t*kw_args) and STATIC MP_DEFINE_CONST_FUN_OBJ_KW (machine_ccd_read_
obj,1,machine_ccd_read).In this way, from machine import Ccd can be passed through in main.py program
Load Ccd driving, then Ccd.read () can call driver, realize spatial distribution data acquisition.
Referring to shown in Fig. 4, data transmit initialization procedure are as follows: creation ESP32AP object ap calls the active of ap object
() function activates AP hot spot;The essid that AP is arranged is that a fixed character serially adds behind the address mac of AP 3, this is in order to anti-
Only essid is repeated;The password of AP is set;Main socket is created, and is bound with host address;Monitor client connection;Wound
Connections dictionary is built, for saving client socket.
Referring to Figure 5, data transmission procedure are as follows: obtain poll object poll_ using uselect module poll () method
Obj, POLLIN the and POLLHUP event of main socket is monitored using register () method of poll_obj object, and setting is moved back
Mark exitflag is false out.Event object events is obtained using the poll () method of poll_obj object, traverses thing
Wherein socket then illustrates to be newly-increased session part object acquisition if it is main socket, executes addSession () method,
The socket of new user and address are saved in dictionary connections, and add new socket in poll_obj object
POLLIN and POLLHUP event monitoring;If not main socket, then client is obtained from connections dictionary
Socket receives the message m sg sent out in client using usocket module recv () method.Ure module is utilized from message
Search () function and the set message format of regular expression matching both sides, order and parameter are extracted, if it is legal
, then execute corresponding function;If it is illegal, then command/parameter error message is sent to client.Traversal finishes
Events object, then judge whether exitflag is true, if if true, calling the unregister () of poll_obj object
Otherwise method and the socket for actively disconnecting all clients continue monitor event object events.When network occur it is abnormal or
DelSession () method is called when person's client exits, and cancels event monitoring from poll_obj object, and delete from dictionary
Except the socket of the user.
Claims (9)
1. a kind of spectrum sensor module drive and Wi-Fi transmission device based on ESP32, it is characterised in that: described device main body
Built-in lithium battery and circuit board, the lithium battery boost to stable 5V by charge and discharge integrated module and provide power supply for device,
Charge and discharge integrated module is lithium battery charging by circumscribed USB mouth;The circuit board is using ESP32 module as core, external GPIO
Cause for gossip shows timing and the time of integration of spectrum sensor module, so that spectrum sensor exports suitable spatial distribution simulation letter
Number;The ADC chip of the external SPI interface of ESP32 module realizes analog-to-digital conversion to the analog signal of spatial distribution;It is described
High-performance microprocessor built in ESP32 module is adopted and shows a C language spectrum sensor and ADC chip driver program, is added to
In MicroPython firmware;Microprocessor built in the ESP32 module writes Python code, and firmware is called to realize spectrum
The acquisition of distributed data, and by Transmission Control Protocol, it realizes and the interaction of smart phone/computer.
2. the spectrum sensor module drive based on ESP32 and Wi-Fi transmission device, feature exist as described in claim 1
In the ESP32 module, built-in Xtensa 32-bit LX6 super low-power consumption, up to 240MHz dual core processor and 32MB
The space size Flash has the I/O mouth of expansion in module.
3. spectrum sensor module drive and Wi-Fi transmission device based on ESP32 as claimed in claim 1 or 2, feature
Be: the ESP32 module is programmed using C language, according to the timing of spectrum sensor and the requirement of the time of integration, is managed in GPIO
Suitable logic level is generated on foot, driving sensor exports the spectral simulation amount of 340nm to 780nm wavelength;According to ADC chip
Timing, spectrum sensor timing and slew rate requirement, spectral simulation amount is converted into corresponding number at the time of suitable
Amount;Driving is added in MicroPython firmware, calls the function in firmware to complete corresponding function in main.py.
4. spectrum sensor module drive and Wi-Fi transmission device based on ESP32 as claimed in claim 1 or 2, feature
Be: the spatial distribution data acquisition driving based on ESP32 module adds state machine come Collaborative Control spectrum using timer
The timing data acquisition of sensor and ADC chip.ESP32 timer generates interruption with the time value set, takes interrupting
It is engaged in function, overturns the clock CLK pin of spectrum sensor, guarantee the requirement of 50% duty ratio;On spectrum sensor ST pin
The two neighboring failing edge time difference determine time of integration of pixel;ST failing edge starts, every 4 CLK clocks, output
The analog signal of 1 pixel;State machine combination counter, to control time of integration of spectrum sensor, each pixel simulation amount
Serial output, ADC chip start conversion, terminate conversion, and after conversion analog quantity deposit array in.
5. spectrum sensor module drive and Wi-Fi transmission device based on ESP32 as claimed in claim 1 or 2, feature
Be: the firmware of the spatial distribution data acquisition driving based on ESP32 module provides MicroPython interface;It makes by oneself
Justice is including spectrum sensor and ADC chip pin, state, SPI interface, the structural body machine_ccd_ including the time of integration
obj_t;Extern const mp_obj_type_t machine_ccd_type is added in modmachine.h file;In
Subclass table STATIC const mp_rom_map_elem_t machine_module_ in modmachine.c file
In globals_table [] array, { MP_ROM_QSTR (MP_QSTR_Ccd), MP_ROM_PTR (&machine_ccd_ are added
ty pe)};In the modularity function dictionary STATIC const mp_rom_map_elem_t of driving file modcd.c
In machine_ccd_locals_dict_table [] array, be added to MP_ROM_QSTR (MP_QSTR_ccd_read),
MP_ROM_PTR (&machine_c cd_read_obj) } interface function;In driving file modcd.c, spatial distribution is read
The variable element interface function of data is defined as STATIC mp_obj_t machine_ccd_read (mp_uint_t n_
Args, const mp_obj_t*pos_args, mp_map_t*kw_args) and STATIC MP_DEFINE_CONST_FUN_
OBJ_KW (machine_ccd_read_obj, 1, machine_ccd_read), in this way, passing through from main.py program
Machine import Ccd load Ccd driving, then Ccd.read () can call driver, realize spatial distribution
The acquisition of data.
6. the method that the spectrum sensor module drive based on ESP32 and Wi-Fi transmission device are realized as described in claim 1,
It is characterized by: the work of ESP32 module is used as a wireless access point under ap mode, client device connects this AP, host
TCP communication is carried out with client, host provides a kind of message by select mechanism management communicating pair socket, communicating pair
Communication interaction data are carried out with command format, realize data transmission.
7. method as claimed in claim 6, it is characterised in that: creation AP object ap calls active () function of ap object
Activate AP hot spot;The essid that AP is arranged is that a fixed character serially adds behind the address mac of AP 3;The password of AP is set;
Main socket is created, socket and host address are bound, monitors client connection;Connections dictionary is created, for saving
Client socket and IP address.
8. method according to claim 6 or 7, it is characterised in that: utilize the register of the poll object of uselect module
POLLIN the and POLLHUP event of () method monitoring socket;Event pair is obtained using the poll () method of poll_obj object
As;Client socket simultaneously binds monitoring event;When there is new client to be added, newly-increased session addSession () is executed
Method is saved in the socket and IP address of new user in dictionary connections, and with poll_o bj object
Register () method adds the monitoring of the POLLIN and POLLHUP event of new socket;When having Network Abnormal or client
When actively exiting connection, session del the Session () method of deletion is executed, the unregister () of poll_obj object is utilized
Method nullifies client connection, closes client socket, client socket and IP are deleted in connections dictionary
Location.
9. method according to claim 6 or 7, it is characterised in that: receive client using usocket module recv () method
Message m sg extracts life using the message format that search () function of ure module and regular expression matching both sides are set
Order and parameter.If message be it is legal, execute corresponding function;If it is illegal, then order/ginseng is sent to client
Miscount false information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910423074.9A CN110415502A (en) | 2019-05-21 | 2019-05-21 | A kind of spectrum sensor module drive based on ESP32 and Wi-Fi transmission device and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910423074.9A CN110415502A (en) | 2019-05-21 | 2019-05-21 | A kind of spectrum sensor module drive based on ESP32 and Wi-Fi transmission device and method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110415502A true CN110415502A (en) | 2019-11-05 |
Family
ID=68357769
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910423074.9A Pending CN110415502A (en) | 2019-05-21 | 2019-05-21 | A kind of spectrum sensor module drive based on ESP32 and Wi-Fi transmission device and method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110415502A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111773692A (en) * | 2020-07-02 | 2020-10-16 | 北京思明启创科技有限公司 | MicroPython-based hardware driving method, equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2011103165A1 (en) * | 2010-02-16 | 2011-08-25 | Astrotech Corporation | Remotely controlling a chemical detector |
CN204359682U (en) * | 2014-12-25 | 2015-05-27 | 江西出入境检验检疫局检验检疫综合技术中心 | A kind of textile fibres based on WiFi technology measures near infrared spectrometer |
CN106345055A (en) * | 2016-09-19 | 2017-01-25 | 天津大学 | Gait recognition-based functional electrical muscular stimulation walking aid |
-
2019
- 2019-05-21 CN CN201910423074.9A patent/CN110415502A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2011103165A1 (en) * | 2010-02-16 | 2011-08-25 | Astrotech Corporation | Remotely controlling a chemical detector |
CN204359682U (en) * | 2014-12-25 | 2015-05-27 | 江西出入境检验检疫局检验检疫综合技术中心 | A kind of textile fibres based on WiFi technology measures near infrared spectrometer |
CN106345055A (en) * | 2016-09-19 | 2017-01-25 | 天津大学 | Gait recognition-based functional electrical muscular stimulation walking aid |
Non-Patent Citations (6)
Title |
---|
ANSHUMAN J.DAS: "Ultra-portable,wireless smartphone spectromenter for rapid,non-destructive testing of fruit ripeness", 《SCIENTIFIC REPORTS》 * |
DAMIEN P. GEORGE等: "《MicroPython Documentation》", 25 January 2019 * |
HAMAMATSU: "《C12666MA技术手册》", 31 March 2014 * |
ZHANGJUN62: "《https://blog.csdn.net/zhangjun62/article/details/85012091》", 20 December 2018 * |
乐鑫信息科技: "《ESP32-Azure IoT Kit硬件设计指南》", 31 October 2018 * |
张聪: "基于手机的光谱仪信号采集与处理系统的设计", 《中国优秀硕士论文全文数据库·工程科技Ⅱ辑》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111773692A (en) * | 2020-07-02 | 2020-10-16 | 北京思明启创科技有限公司 | MicroPython-based hardware driving method, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN202632283U (en) | Mobile equipment | |
WO2015101067A1 (en) | Rfid reader/writer and rfid system | |
US10725949B2 (en) | Slave-to-slave direct communication | |
CN108259599B (en) | File data transmission system | |
CN109525012A (en) | Charging unit, charge control method, charge control system and storage medium | |
CN110569737A (en) | Face recognition deep learning method and face recognition acceleration camera | |
CN104597790A (en) | Serial port controller and awakening method for micro-controller system based on the same | |
CN103116939A (en) | On-line top-up system and on-line top-up method of radio frequency card mobile phone | |
CN110415502A (en) | A kind of spectrum sensor module drive based on ESP32 and Wi-Fi transmission device and method | |
CN109448181A (en) | A kind of antitheft access control system | |
CN108877185A (en) | A kind of Bluetooth remote control method and circuit | |
CN107729860B (en) | Recognition of face calculation method and Related product | |
US11595902B2 (en) | Electronic device for filtering packet and method for operating same | |
US11131787B2 (en) | Electromagnetic sensor and mobile device including the same | |
CN204578637U (en) | Small-sized rotor patrol flight device visually-perceptible system | |
CN106773948A (en) | A kind of multipurpose low power consumption control device and method for dynamic characteristic test | |
CN205608921U (en) | It changes electronic payment device to pay in cash | |
Naik | Smart wireless authenticating voting machine | |
CN111819778A (en) | Power conversion apparatus and method | |
CN201965906U (en) | Speech signal processing device for digital watermark technology | |
CN114445067A (en) | Gate entry and exit payment method and system based on face recognition of two-dimensional code | |
CN211349445U (en) | Bluetooth access control circuit compatible with Wiegand protocol | |
CN208768204U (en) | Portable image object detecting device | |
CN202876317U (en) | Solid electric checkerboard system based on general packet radio service (GPRS) | |
CN209723917U (en) | Shopping cart electronic lock circuit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191105 |
|
RJ01 | Rejection of invention patent application after publication |