Skip to content

HUST_SMARTLAMP #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions arc_design_contest/2018/HUST_SmartLamp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
----
**Smart-Lamp**
====
----
# **Content**
* [Introduction](#introduction)
* [Function](#function)
* [System Architecture](#architecture)
* [System Config](#config)
* [Hardware](#hardware)
* [Software](#software)
* [Hardware Connection](#connection)
* [User Manual](#usermanual)
* [Video](#video)
----
# **Introduction** <div id='introduction'/>
This project designed a smart lamp which was based on ARC EM Starter Kit. The lamp can detect whether the user is using to turn on or off, automatically connect the server to report the real-time status, and manually and automatically adjust the brightness, remotely be controled by the APP console, record the user's usage time. The follow-up will add the functions of detecting the unhealthy work schedule of the user and correcting the user's incorrect sitting habits, which can help the user to effectively get rid of the health hazards brought by the high pressure of modern life, develop a good working habit, and keep your body and eyes healthy.<br>
## **Function** <div id='function'/>
* **automatic switch**<br>
When the human body is located at a distance of about 15cm from the infrared transceiver port and keeps the occlusion time for more than 3 seconds, the lamp can normally illuminate and enter the auto dimming mode by default. Similarly, the lamp will automatically turn off 3 seconds after the person leaves the lamp, avoiding the occasional behavioral instability of the user and causing the desk lamp to be frequently turned off.
* **automatic sign in**<br>
After restarting the lamp and the network, the lamp can automatically re-launch within 5 seconds.
* **automatic adjust brightness**<br>
The lamp can realize stepless natural dimming in 8 different light intensity ranges, and there is no phenomenon that the user feels uncomfortable due to the light intensity jump and stroboscopic. In the automatic dimming mode, the lamp can adapt to the change of light intensity in the environment, and adjust the brightness in time, with better sensitivity.
* **remote control**<br>
The APP can support the frequent operation of the user, and there is no problem of wrong operation or invalid operation under the high-intensity round-trip conversion test.
## **System Architecture** <div id='architecture'/>
<img src="https://github.com/tyhucosiii/smart-lamp/blob/master/pictures/system.png" width = "500" alt="图片名称" align=center /> <br>

----
# **System Config** <div id='config'/>
## **Hardware** <div id='hardware'/>
* EMSK V2.2 ARCEM7D Starter Kit
* ESP8266 WIFI
* Infrared Ray Sensor
* Touchpad
* CM3232 Ambient Light Sensor <br>
<img src="https://github.com/tyhucosiii/smart-lamp/blob/master/pictures/esp8266.jpg" height = "150" alt="图片名称" align=center /><img src="https://github.com/tyhucosiii/smart-lamp/blob/master/pictures/ir.jpg" height = "150" alt="图片名称" align=center /><img src="https://github.com/tyhucosiii/smart-lamp/blob/master/pictures/touchpad.jpg" height = "150" alt="图片名称" align=center /><img src="https://github.com/tyhucosiii/smart-lamp/blob/master/pictures/cm3232.jpg" height = "150" alt="图片名称" align=center />

## **Software** <div id='software'/>
* ARC GNU Toolchain
* embARC Open Software Platform (OSP) 201709
* Serial Port Terminal eg. XCOM
* APP for Android
* Mini Program of Wechat
## **Hardware Connection** <div id='connection'/>
<img src="https://github.com/tyhucosiii/smart-lamp/blob/master/pictures/all.jpg" height = "500" alt="图片名称" align=center /><br>
* ESP8266 connected to UART1 through PMOD1 of ARC EMSK
* CM3232 connected to I2C through PMOD3 of ARC EMSK
* Touchpad connected to UART emulator through PMOD3 of ARC EMSK
* Infrared Ray Sensor connected to GPIO through PMOD2 of ARC EMSK

----
# **User Manual** <div id='usermanual'/>
* The user configures the current network for the lamp through the APP and connects to the server.
* In the automatic control mode, the lamp can enter the automatic dimming while the user is nearby, which will automatically adjust the brightness according to the ambient light intensity.
* In manual control mode, the user can manually adjust the brightness of the lamp through the touchpad button and exit the automatic mode.
* The user can remotely control via mobile client

----
# **[Video](https://v.youku.com/v_show/id_XMzcxMzE0NzA0NA==.html?spm=a2h3j.8428770.3416059.1) <div id='video'/>**
----
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions arc_design_contest/2018/HUST_SmartLamp/src/FreeRTOS/.cproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802.1345793231" name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.825739829" name="GNU Toolchain for ARC EM" superClass="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base">
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.processor.1811627101" name="ARC EM (-mcpu)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.processor"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.endiannes.1129633308" name="Endianness" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.endiannes"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.mpyem.1605451943" name="Multiply instructions (ARC EM)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.mpyem"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.fpuem.2013546615" name="FPU Type (ARC EM)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.fpuem"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.level.709108968" name="Debug level" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.level"/>
<option id="org.eclipse.cdt.cross.arc.gnue.em.linux.option.debugging.format.1714736645" name="Debug format" superClass="org.eclipse.cdt.cross.arc.gnue.em.linux.option.debugging.format"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.other.1648359137" name="Other debugging flags" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.other"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.prof.128692680" name="Generate prof information (-p)" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.prof"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.gprof.1361291954" name="Generate gprof information (-pg)" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.debugging.gprof"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.addtools.printsize.1766062606" name="Print Size" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.addtools.printsize"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.barrelshifter.1435615685" name="Barrel shifter (-mbarrel-shifter)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.barrelshifter"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.codedensity.1613250636" name="Code density (-mcode-density)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.codedensity"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.divide.1676239353" name="Integer divide instructions (-mdiv-rem)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.divide"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.normalize.152338421" name="Bitscan instruction (-mnorm)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.normalize"/>
<option id="org.eclipse.cdt.cross.arc.gnu.linux.option.target.swap.13774742" name="Swap instruction (-mswap)" superClass="org.eclipse.cdt.cross.arc.gnu.linux.option.target.swap"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.tcf.1522278691" name="TCF" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.tcf"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.filefortcf.1103773725" name="TCF path" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.filefortcf"/>
<option id="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.maptcf.131857403" name="Use memory map from TCF" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.option.target.maptcf"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="org.eclipse.cdt.cross.arc.gnu.em.linux.platform.base.1729935104" isAbstract="false" name="All Platform" osList="linux,win32" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.platform.base"/>
<builder id="org.eclipse.cdt.cross.arc.gnu.em.linux.builder.base.1471964444" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GNU Make Builder for ARC" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.builder.base"/>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.assembler.base.144302178" name="ARC ELF32 GCC Assembler" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.assembler.base">
<inputType id="org.eclipse.cdt.cross.arc.gnu.em.linux.assembler.base.input.1287093178" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.assembler.base.input"/>
</tool>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.c.compiler.base.479171352" name="ARC ELF32 GCC C Compiler" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.c.compiler.base">
<option id="org.eclipse.cdt.cross.arc.gnu.c.compiler.option.include.paths.711922986" name="Include paths (-I)" superClass="org.eclipse.cdt.cross.arc.gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\os&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\options&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\device&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\board&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\example\freertos\FreeRTOS\app&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\example\freertos\FreeRTOS\appinc&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\embarc_osp-master\example\freertos\FreeRTOS\hardware&quot;"/>
</option>
<inputType id="org.eclipse.cdt.cross.arc.gnu.em.linux.c.compiler.base.input.1382159257" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.c.compiler.base.input"/>
</tool>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.compiler.base.406797488" name="ARC ELF32 GCC C++ Compiler" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.compiler.base">
<inputType id="org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.compiler.base.input.127208712" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.compiler.base.input"/>
</tool>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.c.linker.base.1944035711" name="ARC ELF32 GCC C Linker" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.c.linker.base"/>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.linker.base.1242428325" name="ARC ELF32 GCC C++ Linker" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.linker.base">
<inputType id="org.eclipse.cdt.cross.arc.gnu.cpp.linker.input.593887588" superClass="org.eclipse.cdt.cross.arc.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.archiver.base.1418276882" name="ARC ELF32 GCC Archiver" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.archiver.base"/>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.createflash.base.1623139453" name="ARC ELF32 GNU Create Flash Image" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.createflash.base"/>
<tool id="org.eclipse.cdt.cross.arc.gnu.em.linux.createlisting.base.939243005" name="ARC ELF32 GNU Create Listing" superClass="org.eclipse.cdt.cross.arc.gnu.em.linux.createlisting.base"/>
<tool id="org.eclipse.cdt.cross.arc.gnu.linux.printsize.base.298163480" name="ARC ELF32 GNU Print Size" superClass="org.eclipse.cdt.cross.arc.gnu.linux.printsize.base"/>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="os|device|crc32|app|options|inc|hardware|appinc|obj_emsk_22/gnu_arcem7d/device|board" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="app"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="appinc"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="board"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="device"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="hardware"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="options"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="os"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="FreeRTOS.null.667303404" name="FreeRTOS"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802;org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802.1345793231;org.eclipse.cdt.cross.arc.gnu.em.linux.c.compiler.base.479171352;org.eclipse.cdt.cross.arc.gnu.em.linux.c.compiler.base.input.1382159257">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.cross.arc.gnu.ARC_GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="0.1282533133">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802;org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802.1345793231;org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.compiler.base.406797488;org.eclipse.cdt.cross.arc.gnu.em.linux.cpp.compiler.base.input.127208712">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.cross.arc.gnu.ARC_GCCManagedMakePerProjectProfileCXX"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802;org.eclipse.cdt.cross.arc.gnu.linux.toolchain.base.1704381802.1345793231;org.eclipse.cdt.cross.arc.gnu.em.linux.assembler.base.144302178;org.eclipse.cdt.cross.arc.gnu.em.linux.assembler.base.input.1287093178">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.cross.arc.gnu.ARC_GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>
54 changes: 54 additions & 0 deletions arc_design_contest/2018/HUST_SmartLamp/src/FreeRTOS/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FreeRTOS</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>board</name>
<type>2</type>
<location>C:/embarc_osp-master/board</location>
</link>
<link>
<name>device</name>
<type>2</type>
<location>C:/embarc_osp-master/device</location>
</link>
<link>
<name>inc</name>
<type>2</type>
<location>C:/embarc_osp-master/inc</location>
</link>
<link>
<name>options</name>
<type>2</type>
<location>C:/embarc_osp-master/options</location>
</link>
<link>
<name>os</name>
<type>2</type>
<location>C:/embarc_osp-master/os</location>
</link>
</linkedResources>
</projectDescription>
Loading