Wednesday, September 5, 2018

MeArm v1.0 安裝說明, Laser Cut AI / PDF

Laser Cut:
Original
Download AI
Download PDF

Layout Size: 300mm x 200mm
Please leave  comment to support us if you found it's useful.
這留言支持。





Parts Required:
  • Nut x 11
  • 6mm x 7
  • 8mm x 15
  • 10mm x 5
  • 12mm x 8
  • 20mm x 4
Hardware Required (Arduino):
  • Arduino Uno R3 x1
  • Sensor Shield x1
  • Servo x4
  • 2-Axis Joystick x2

Hardware Required (Micro:Bit + Robot:Bit)
  • Robot:Bit + Micro:Bit x1
  • Servo x4
  • 2-Axis Joystick / Micro:Bit


Reference
https://www.thingiverse.com/thing:993759

Tutorial:

MeArm Robot Arm - Your Robot - V1.0: 13 Steps (with Pictures)
https://www.instructables.com/id/MeArm-Robot-Arm-Your-Robot-V10/

MeArm.Joystick DIY En: 18 Steps
https://www.instructables.com/id/meArmJoystick-DIY/

中文教學:

仁濟醫院靚次伯紀念中學
http://www.lcp.edu.hk/STEM/media.php

仁濟醫院靚次伯紀念中學 - PCM - 製作MeArm 機械臂(一)http://www.lcp.edu.hk/media/20170608_PCM/PCM_1252.pdf

仁濟醫院靚次伯紀念中學 - PCM - 製作MeArm 機械臂(二)http://www.lcp.edu.hk/media/20170608_PCM/PCM_1253.pdf

仁濟醫院靚次伯紀念中學 - PCM - 製作MeArm 機械臂(三)http://www.lcp.edu.hk/media/20170608_PCM/PCM_1254.pdf

仁濟醫院靚次伯紀念中學 - PCM - 製作MeArm 機械臂(四)http://www.lcp.edu.hk/media/20170608_PCM/PCM_1255.pdf

芭蕉葉上聽雨聲: [meArm] 機械手臂組裝說明
http://pizgchen.blogspot.com/2018/03/mearm.html

EduMakerLab STEAM 實驗室: MeArm的組裝紀實
http://edumakerlab.blogspot.com/2014/10/mearm.html

MeArm.Joystick Software: 38 Steps
https://www.instructables.com/id/MeArm-software/

MeArm 安裝說明
http://www.7gp.cn/archives/59


MeArm 教學包下載
https://drive.google.com/open?id=1bRqa4gUlQL-tPxGq8aMq5wm3rnLny-7N






licensed under a Creative Commons Attribution-ShareAlike 4.0 International License


Wednesday, July 25, 2018

SOLUTION: RESET MYSQL root password

PROBLEM:
-PHPMYADMIN SHOW "NO" FOR GRANT PRIVILEGES FOR ROOT USER
-CANNOT GRANT PRIVILEGES FOR USERS
-RASPBIAN / DEBIAN


SOLUTION:
  1. STOP MYSQL
    sudo service mysql stop     OR      sudo killall mysqld
  2. START MYSQL SKIPPING PRIVILEGES sudo mysqld_safe --skip-grant-tables &
  3. CHANGE PASSWORD FOR ROOT USER
    SET PASSWORD FOR 'root'@'localhost' = PASSWORD("newPassWD");
  4. FLUSH PRIVILEGES
    FLUSH PRIVILEGES;
  5. STOP AND RESTART MYSQLD
     sudo killall mysqld | sudo service mysQL start





SOLUTION: mysql root cannot grant privileges for database


PROBLEM:
-PHPMYADMIN SHOW "NO" FOR GRANT PRIVILEGES FOR ROOT USER
-CANNOT GRANT PRIVILEGES FOR USERS
-RASPBIAN / DEBIAN


SOLUTION:
  1. STOP MYSQL
    sudo service mysql stop     OR      sudo killall mysqld
  2. START MYSQL SKIPPING PRIVILEGES sudo mysqld_safe --skip-grant-tables &
  3. GRANT PRIVILEGES for root user
    UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
  4. FLUSH PRIVILEGES
    FLUSH PRIVILEGES;
  5. STOP AND RESTART MYSQLD
     sudo killall mysqld | sudo service mysQL start


Saturday, July 14, 2018

STEM LAB IDEA

https://www.lib.polyu.edu.hk/makerspace/iot

Sunday, July 8, 2018

MAC Shortcut Key to Convert to Simplified Chinese / Traditional Chinese




To Simplified Chinese:
Shift Control Option Command C

To Traditional Chinese
Shift Control Command C

Sunday, June 10, 2018

SG90 / MG90S / MG995 Tutorial

Arduino IDE Reference:

https://www.arduino.cc/en/Reference/servo



Sample Code for Arduino:

GND - GND

Vcc - 5V

Orange - D9




Friday, June 8, 2018

Analog / Digital Sample Code

Sample Code for Arduino using Any Analog / Digital Sensor



Because all analog input sensor use 0-1023 to represent data between 0V - 5V (or 3.3V), digital sensor use threshold level,

these code simply display the value it reads into serial monitor and LCD 1602 I2C display.



Connect

  • Vcc - 5V

  • GND   - GND

  • A0 - A0

  • D0 - D1   (Don't use D0 Pin in Arduino, otherwise "avrdude stk500_getsync() not in sync resp=0x30" error occured)



Code To Display Using Serial Monitor:






Thursday, June 7, 2018

MQ Sensor Sample Code

MQ Sensor Sample Code for Arduino





MQ-2 煙霧氣敏傳感器 (甲烷/液化氣/可燃氣體)

MQ-3 酒精乙醇傳感器模塊 酒精氣敏檢測報警

MQ-4 天然氣、甲烷傳感器模塊

MQ-5 液化氣 天然氣 城市煤氣傳感器模塊 氣體傳感器

MQ-6 丙烷 / 丁烷 / 液化氣傳感器模塊

MQ-7 一氧化碳 / 氣敏傳感器檢測報警模塊

MQ-8 氫氣傳感器檢測報警模塊

MQ-9 一氧化碳 可燃氣體傳感器檢測報警模塊

MQ-135 空氣質量傳感器模塊 有害氣體檢測傳感器報警模塊 空氣污染



Connect

  • Vcc - 5V

  • GND   - GND

  • A0 - A0



Code To Display Using Serial Monitor:






Code To Display Using I2C LCD 1602



Sunday, April 29, 2018

Powershell Resource

Tutorial
https://ithelp.ithome.com.tw/articles/10027836
https://code.tutsplus.com/tutorials/say-hello-to-powershell--net-32056
https://ramblingcookiemonster.wordpress.com/2013/07/20/learning-and-exploring-powershell/



Online
https://docs.microsoft.com/en-us/powershell/scripting/powershell-scripting?view=powershell-6
https://www.manning.com/books/windows-powershell-in-action-second-edition?
https://www.manning.com/books/learn-windows-powershell-in-a-month-of-lunches-second-edition?




Printed
http://shop.oreilly.com/product/0636920024491.do
http://shop.oreilly.com/product/0636920024132.do

Saturday, April 28, 2018

Create Shortcut Key to Zoom-In, Zoom-Out in Microsoft Word using Macro

Developer Tab - Macro

-Type "MyZoomIn"
-Create
-Paste following code:
Sub MyZoomIn()
    Dim ZP As Integer
    ZP = Int(ActiveWindow.ActivePane.View.Zoom.Percentage * 1.1)
    If ZP > 200 Then ZP = 200
    ActiveWindow.ActivePane.View.Zoom.Percentage = ZP
End Sub
Sub MyZoomOut()
    Dim ZP As Integer
    ZP = Int(ActiveWindow.ActivePane.View.Zoom.Percentage * 0.9)
    If ZP < 10 Then ZP = 10
    ActiveWindow.ActivePane.View.Zoom.Percentage = ZP
End Sub



Make Shortcut Key :
File - Option - Customize Ribbon
in "Keyboard shortcuts" - "Customize"
in Categories - "Macro", you should find MyZoomIn , MyZoomOut
Assign "Ctrl - 0" into MyZoomIn
Assign "Ctrl - 1" into MyZoomOut



The shortcut key should be created



Ref: https://word.tips.net/T001734_Zooming_with_the_Keyboard.html






Thursday, April 19, 2018

MQ 系列傳感器

Buy 選購請按此


Arduino Sample Code


MQ-2 for Methane, Butane, LPG, smoke.

MQ-3 for Methane, Butane, LPG, smoke.

MQ-4 for Methane, CNG Gas

MQ-5 for Natural gas, LPG

MQ-6 for LPG, butane gas

MQ-7 for Carbon Monoxide

MQ-8 for Hydrogen Gas

MQ-9 for Carbon Monoxide, flammable gasses.

MQ-135 for Benzene, Alcohol, smoke.

 

MQ-2


Sensitive for Methane, Butane, LPG, smoke.
This sensor is sensitive for flamable and combustible gasses.
The heater uses 5V.
The MQ-2 at seeed: http://www.seeedstudio.com/wiki/Grove_-_Gas_Sensor%28MQ2%29

Search for datasheet: http://duckduckgo.com/?q=%22mq-2%22+gas+sensor+filetype%3Apdf


MQ-3


Sensitive for Alcohol, Ethanol, smoke
The heater uses 5V
The Arduino blog about the "breathalyzer" using a MQ-3 : http://arduino.cc/blog/2010/09/23/arduino-breathalyzer-calibrating-the-mq-3-alcohol-sensor/
The MQ303A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-3%22+gas+sensor+filetype%3Apdf

MQ-4


Sensitive for Methane, CNG Gas
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq-4%22+gas+sensor+filetype%3Apdf

MQ-5


Sensitive for Natural gas, LPG
The heater uses 5V.
The MQ-5 at seeed: http://www.seeedstudio.com/wiki/Electronic_brick_-_Gas_sensor%28MQ5%29 and http://www.seeedstudio.com/wiki/Gas_Sensor_-_MQ5

Search for datasheet: http://duckduckgo.com/?q=%22mq-5%22+gas+sensor+filetype%3Apdf

MQ-6


Sensitive for LPG, butane gas
The heater uses 5V.
The MQ-6 at seeed: http://www.seeedstudio.com/wiki/Electronic_brick_-_Gas_sensor%28MQ6%29
The MQ306A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-6%22+gas+sensor+filetype%3Apdf

MQ-7  一氧化碳感測器模組


Sensitive for Carbon Monoxide
The heater uses an alternating voltage of 5V and 1.4V.
A library for the MQ-7 : http://thesis.jmsaavedra.com/prototypes/software/mq-7-breakout-arduino-library/
The MQ307A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-7%22+gas+sensor+filetype%3Apdf

MQ-8


Sensitive for Hydrogen Gas
The heater uses 5V.

Search for datasheet: http://duckduckgo.com/?q=%22mq-8%22+gas+sensor+filetype%3Apdf

MQ-9


Sensitive for Carbon Monoxide, flammable gasses.
The heater uses an alternating voltage of 5V and 1.5V. It depends on the gases how to use that alternating voltage. If only Carbon Monoxide is tested, the heater can be set at 1.5V.
The MQ309A (also on this page) is like this sensor, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq-9%22+gas+sensor+filetype%3Apdf

MQ131


Sensitive for Ozone
The heater uses 6V.

The load-resistor is 100k...200k, which is a lot higher than for other sensors. This sensor is also very sensitive. It measures in ppb (parts per billion) where other sensors measure in ppm (parts per million).

Search for datasheet: http://duckduckgo.com/?q=%22mq131%22+gas+sensor+filetype%3Apdf

MQ135


For Air Quality
Sensitive for Benzene, Alcohol, smoke.
The heater uses 5V.
An example how to use it: http://wiring.org.co/learning/basics/airqualitymq135.html

An example with calculation of the CO2 value: http://davidegironi.blogspot.it/2014/01/cheap-co2-meter-using-mq135-sensor-with.html

Search for datasheet: http://duckduckgo.com/?q=%22mq135%22+gas+sensor+filetype%3Apdf

MQ136


Sensitive for Hydrogen Sulfide gas.
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq136%22+gas+sensor+filetype%3Apdf

MQ137


Sensitive for Ammonia.
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq137%22+gas+sensor+filetype%3Apdf

MQ138


Sensitive for Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde gas, Hydrogen gas.
The heater uses 5V.
Search for datasheet: http://duckduckgo.com/?q=%22mq138%22+gas+sensor+filetype%3Apdf

MQ214


Sensitive for Methane, Natural gas.
The heater uses 6V.
Search for datasheet: http://duckduckgo.com/?q=%22mq214%22+gas+sensor+filetype%3Apdf

MQ216


Sensitive for Natural gas, Coal gas.

Search for datasheet: http://duckduckgo.com/?q=%22mq216%22+gas+sensor+filetype%3Apdf

MQ303A


Sensitive for Alcohol, Ethanol, smoke (just like the MQ-3)
The heater uses 0.9V
An example for the MQ302A http://insapio.com/2011/12/27/mq3-or-mq303a-alcohol-sensor/
It detects the same gasses as the MQ-3, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq303a%22+gas+sensor+filetype%3Apdf

MQ306A


Sensitive for LPG, butane gas
The heater uses 0.9V.
It detects the same gasses as the MQ-6, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq306a%22+gas+sensor+filetype%3Apdf

MQ307A


Sensitive for Carbon Monoxide
The heater uses an alternating voltage of 0.2V and 0.9.
It detects the same gasses as the MQ-7, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq307a%22+gas+sensor+filetype%3Apdf

MQ309A


Sensitive for Carbon Monoxide, flammable gasses.
The heater uses an alternating voltage of 0.2V and 0.9V. It depends on the gases how to use that alternating voltage.
It detects the same gasses as the MQ-9, but uses a lower heater voltage.

Search for datasheet: http://duckduckgo.com/?q=%22mq309a%22+gas+sensor+filetype%3Apdf

MG811


Sensitive for Carbon Dioxide (CO2).
The heater uses 6V.
The signal from this gas sensor can be connected to the Arduino, but it's better to amplifly the signal with a OpAmp.
An example of this sensor (without an OpAmp) : http://itp.nyu.edu/physcomp/sensors/Reports/MG811

Search for datasheet: http://duckduckgo.com/?q=%22mg811%22+gas+sensor+filetype%3Apdf

AQ-104


For air quality

Search for datasheet: http://duckduckgo.com/?q=%22aq-104%22+gas+sensor+filetype%3Apdf

AQ-2


Sensitive for Flamable gasses, smoke

Search for datasheet: http://duckduckgo.com/?q=%22aq-2%22+gas+sensor+filetype%3Apdf

AQ-3


Sensitive for Alcohol, Benzine

Search for datasheet: http://duckduckgo.com/?q=%22aq-3%22+gas+sensor+filetype%3Apdf

AQ-7


Sensitive for Carbon Monoxide

Search for datasheet: http://duckduckgo.com/?q=%22aq-7%22+gas+sensor+filetype%3Apdf


 

Source: https://playground.arduino.cc/Main/MQGasSensors

VI Cheat Sheet

a  Append after cursor

h-j  left-right
k-l up-down

dd delete line


/keyword   forward search
?keyword  backward search

Copy / Cut and Paste  ( v ---- y/d --- p)
"v"
select text
d - cut, y - copy
"p"

Tuesday, April 17, 2018

IR Receive Arduino Code


  • Arduino GND --> Module pin -

  • Arduino +5V --> Module PLUS (middle pin)

  • Arduino Digital pin 11 --> Module S


 

[pastacode lang="c" manual="%23include%20%3CIRremote.h%3E%0A%0Aint%20RECV_PIN%20%3D%202%3B%20%2F%2F%20%E4%BD%BF%E7%94%A8%E6%95%B8%E4%BD%8D%E8%85%B3%E4%BD%8D2%E6%8E%A5%E6%94%B6%E7%B4%85%E5%A4%96%E7%B7%9A%E8%A8%8A%E8%99%9F%0AIRrecv%20irrecv(RECV_PIN)%3B%20%2F%2F%20%E5%88%9D%E5%A7%8B%E5%8C%96%E7%B4%85%E5%A4%96%E7%B7%9A%E8%A8%8A%E8%99%9F%E8%BC%B8%E5%85%A5%0Adecode_results%20results%3B%20%2F%2F%20%E5%84%B2%E5%AD%98%E8%A8%8A%E8%99%9F%E7%9A%84%E7%B5%90%E6%A7%8B%0A%0Avoid%20setup()%0A%7B%0A%20%20Serial.begin(115200)%3B%0A%20%20irrecv.blink13(true)%3B%20%2F%2F%20%E8%A8%AD%E7%82%BAtrue%E7%9A%84%E8%A9%B1%EF%BC%8C%E7%95%B6%E6%94%B6%E5%88%B0%E8%A8%8A%E8%99%9F%E6%99%82%EF%BC%8C%E8%85%B3%E4%BD%8D13%E7%9A%84LED%E4%BE%BF%E6%9C%83%E9%96%83%E7%88%8D%0A%20%20irrecv.enableIRIn()%3B%20%2F%2F%20%E5%95%9F%E5%8B%95%E6%8E%A5%E6%94%B6%0A%7D%0A%0Avoid%20loop()%20%7B%0A%20%20if%20(irrecv.decode(%26results))%20%7B%20%2F%2F%20%E6%8E%A5%E6%94%B6%E7%B4%85%E5%A4%96%E7%B7%9A%E8%A8%8A%E8%99%9F%E4%B8%A6%E8%A7%A3%E7%A2%BC%0A%20%20%20%20Serial.print(%22results%20value%20is%20%22)%3B%20%2F%2F%20%E8%BC%B8%E5%87%BA%E8%A7%A3%E7%A2%BC%E5%BE%8C%E7%9A%84%E8%B3%87%E6%96%99%0A%20%20%20%20Serial.print(results.value%2C%20HEX)%3B%0A%20%20%20%20Serial.print(%22%2C%20bits%20is%20%22)%3B%0A%20%20%20%20Serial.print(results.bits)%3B%0A%20%20%20%20Serial.print(%22%2C%20decode_type%20is%20%22)%3B%0A%20%20%20%20Serial.println(results.decode_type)%3B%0A%20%20%20%20irrecv.resume()%3B%20%2F%2F%20%E6%BA%96%E5%82%99%E6%8E%A5%E6%94%B6%E4%B8%8B%E4%B8%80%E5%80%8B%E8%A8%8A%E8%99%9F%0A%20%20%7D%0A%7D" message="" highlight="" provider="manual"/]

Monday, April 16, 2018

LCD I2C to Display A0 Voltage (0V - 5V)

[pastacode lang="c" manual="%23include%20%3CWire.h%3E%20%2F%2F%20Arduino%20IDE%20%E5%85%A7%E5%BB%BA%0A%2F%2F%20LCD%20I2C%20Library%EF%BC%8C%E5%BE%9E%E9%80%99%E8%A3%A1%E5%8F%AF%E4%BB%A5%E4%B8%8B%E8%BC%89%EF%BC%9A%0A%2F%2F%20bitbucket.org%2Ffmalpartida%2Fnew-liquidcrystal%2Fdownloads%0A%23include%20%3CLiquidCrystal_I2C.h%3E%0A%0A%2F%2F%20Set%20the%20pins%20on%20the%20I2C%20chip%20used%20for%20LCD%20connections%3A%0A%2F%2F%20addr%2C%20en%2Crw%2Crs%2Cd4%2Cd5%2Cd6%2Cd7%2Cbl%2Cblpol%0ALiquidCrystal_I2C%20lcd(0x27%2C%202%2C%201%2C%200%2C%204%2C%205%2C%206%2C%207%2C%203%2C%20POSITIVE)%3B%20%2F%2F%20%E8%A8%AD%E5%AE%9A%20LCD%20I2C%20%E4%BD%8D%E5%9D%80%0Afloat%20sensorValue0%20%3D%200.0%3B%0Afloat%20sensorValue1%20%3D%200.0%3B%0AString%20title%20%3D%20%22Output%20Voltage%22%3B%0A%0A%2F%2F%23define%20MIN_VALUE%200%3B%20%20%20%20%2F%2FINPUT%20RANGE%200-1023%0A%23define%20MAX_VALUE%201023.0%0A%0A%2F%2F%23define%20DISPLAY_MIN%200%3B%20%20%2F%2FDISPLAY%20RANGE%200V-5V%0A%23define%20DISPLAY_MAX%205.0%0A%0A%0A%0Avoid%20setup()%20%7B%0ASerial.begin(9600)%3B%20%2F%2F%20%E7%94%A8%E6%96%BC%E6%89%8B%E5%8B%95%E8%BC%B8%E5%85%A5%E6%96%87%E5%AD%97%0Alcd.begin(16%2C%202)%3B%20%2F%2F%20%E5%88%9D%E5%A7%8B%E5%8C%96%20LCD%EF%BC%8C%E4%B8%80%E8%A1%8C%2016%20%E7%9A%84%E5%AD%97%E5%85%83%EF%BC%8C%E5%85%B1%202%20%E8%A1%8C%EF%BC%8C%E9%A0%90%E8%A8%AD%E9%96%8B%E5%95%9F%E8%83%8C%E5%85%89%0A%0A%2F%2F%20%E9%96%83%E7%88%8D%E4%B8%80%E6%AC%A1%0Afor(int%20i%20%3D%200%3B%20i%20%3C%201%3B%20i%2B%2B)%20%7B%0Alcd.backlight()%3B%20%2F%2F%20%E9%96%8B%E5%95%9F%E8%83%8C%E5%85%89%0Adelay(250)%3B%0Alcd.noBacklight()%3B%20%2F%2F%20%E9%97%9C%E9%96%89%E8%83%8C%E5%85%89%0Adelay(250)%3B%0A%7D%0Alcd.backlight()%3B%0A%0A%2F%2F%20%E8%BC%B8%E5%87%BA%E5%88%9D%E5%A7%8B%E5%8C%96%E6%96%87%E5%AD%97%0Alcd.setCursor(0%2C%200)%3B%20%2F%2F%20%E8%A8%AD%E5%AE%9A%E6%B8%B8%E6%A8%99%E4%BD%8D%E7%BD%AE%E5%9C%A8%E7%AC%AC%E4%B8%80%E8%A1%8C%E8%A1%8C%E9%A6%96%0Alcd.print(%22HK%20STEM%20CLUB%22)%3B%0Alcd.setCursor(0%2C%201)%3B%20%2F%2F%20%E8%A8%AD%E5%AE%9A%E6%B8%B8%E6%A8%99%E4%BD%8D%E7%BD%AE%E5%9C%A8%E7%AC%AC%E4%BA%8C%E8%A1%8C%E8%A1%8C%E9%A6%96%0Alcd.print(%22hkstem.club%22)%3B%0Adelay(500)%3B%0A%0A%7D%0A%0Avoid%20loop()%20%7B%0A%20%20lcd.clear()%3B%0A%20%20int%20analog_value%20%3D%20analogRead(A0)%3B%0A%20%20sensorValue0%20%3D%20analog_value%20%2F%20MAX_VALUE%3B%20%2F%2F%20read%20the%20input%20on%20analog%20pin%200%3A%0A%20%20%0A%20%20%2F%2F%20print%20out%20the%20sensor%3A%0A%20%20lcd.setCursor(0%2C%200)%3B%0A%20%20lcd.print(sensorValue0%20*%20DISPLAY_MAX)%3B%0A%20%20Serial.println(analog_value%20%2F%201023.0)%3B%0A%0A%20%20lcd.setCursor(0%2C1)%3B%0A%20%20%2F%2Flcd.print(sensorValue1)%3B%0A%20%20lcd.print(title)%3B%0A%0A%20%20sensorValue1%20%3D%20sensorValue0%3B%0A%20%20%0A%20%20delay(300)%3B%20%20%20%20%20%20%20%20%2F%2F%20delay%20in%20between%20reads%20for%20stability%0A%0A%0A%7D" message="" highlight="" provider="manual"/]

I2C Scanner

[pastacode lang="c" manual="%2F%2F%20--------------------------------------%0A%2F%2F%20i2c_scanner%0A%2F%2F%0A%2F%2F%20Version%201%0A%2F%2F%20This%20program%20(or%20code%20that%20looks%20like%20it)%0A%2F%2F%20can%20be%20found%20in%20many%20places.%0A%2F%2F%20For%20example%20on%20the%20Arduino.cc%20forum.%0A%2F%2F%20The%20original%20author%20is%20not%20know.%0A%2F%2F%20Version%202%2C%20Juni%202012%2C%20Using%20Arduino%201.0.1%0A%2F%2F%20Adapted%20to%20be%20as%20simple%20as%20possible%20by%20Arduino.cc%20user%20Krodal%0A%2F%2F%20Version%203%2C%20Feb%2026%202013%0A%2F%2F%20V3%20by%20louarnold%0A%2F%2F%20Version%204%2C%20March%203%2C%202013%2C%20Using%20Arduino%201.0.3%0A%2F%2F%20by%20Arduino.cc%20user%20Krodal.%0A%2F%2F%20Changes%20by%20louarnold%20removed.%0A%2F%2F%20Scanning%20addresses%20changed%20from%200...127%20to%201...119%2C%0A%2F%2F%20according%20to%20the%20i2c%20scanner%20by%20Nick%20Gammon%0A%2F%2F%20http%3A%2F%2Fwww.gammon.com.au%2Fforum%2F%3Fid%3D10896%0A%2F%2F%20Version%205%2C%20March%2028%2C%202013%0A%2F%2F%20As%20version%204%2C%20but%20address%20scans%20now%20to%20127.%0A%2F%2F%20A%20sensor%20seems%20to%20use%20address%20120.%0A%2F%2F%20Version%206%2C%20November%2027%2C%202015.%0A%2F%2F%20Added%20waiting%20for%20the%20Leonardo%20serial%20communication.%0A%2F%2F%0A%2F%2F%0A%2F%2F%20This%20sketch%20tests%20the%20standard%207-bit%20addresses%0A%2F%2F%20Devices%20with%20higher%20bit%20address%20might%20not%20be%20seen%20properly.%0A%2F%2F%0A%0A%23include%20%3CWire.h%3E%0A%0Avoid%20setup()%0A%7B%0AWire.begin()%3B%0A%0ASerial.begin(9600)%3B%0Awhile%20(!Serial)%3B%20%2F%2F%20Leonardo%3A%20wait%20for%20serial%20monitor%0ASerial.println(%22%5CnI2C%20Scanner%22)%3B%0A%7D%0A%0Avoid%20loop()%0A%7B%0Abyte%20error%2C%20address%3B%0Aint%20nDevices%3B%0A%0ASerial.println(%22Scanning...%22)%3B%0A%0AnDevices%20%3D%200%3B%0Afor(address%20%3D%201%3B%20address%20%3C%20127%3B%20address%2B%2B%20)%0A%7B%0A%2F%2F%20The%20i2c_scanner%20uses%20the%20return%20value%20of%0A%2F%2F%20the%20Write.endTransmisstion%20to%20see%20if%0A%2F%2F%20a%20device%20did%20acknowledge%20to%20the%20address.%0AWire.beginTransmission(address)%3B%0Aerror%20%3D%20Wire.endTransmission()%3B%0A%0Aif%20(error%20%3D%3D%200)%0A%7B%0ASerial.print(%22I2C%20device%20found%20at%20address%200x%22)%3B%0Aif%20(address%3C16)%0ASerial.print(%220%22)%3B%0ASerial.print(address%2CHEX)%3B%0ASerial.println(%22%20!%22)%3B%0A%0AnDevices%2B%2B%3B%0A%7D%0Aelse%20if%20(error%3D%3D4)%0A%7B%0ASerial.print(%22Unknown%20error%20at%20address%200x%22)%3B%0Aif%20(address%3C16)%0ASerial.print(%220%22)%3B%0ASerial.println(address%2CHEX)%3B%0A%7D%0A%7D%0Aif%20(nDevices%20%3D%3D%200)%0ASerial.println(%22No%20I2C%20devices%20found%5Cn%22)%3B%0Aelse%0ASerial.println(%22done%5Cn%22)%3B%0A%0Adelay(5000)%3B%20%2F%2F%20wait%205%20seconds%20for%20next%20scan%0A%7D" message="" highlight="" provider="manual"/]

LCD1602 I2C Source Code To Display Serial Input to LCD Output

LCD 1602 I2C Source Code To Display Serial Monitor Input to LCD Output

 

[pastacode lang="c" manual="%23include%20%3CWire.h%3E%20%2F%2F%20Arduino%20IDE%20%E5%85%A7%E5%BB%BA%0A%2F%2F%20LCD%20I2C%20Library%EF%BC%8C%E5%BE%9E%E9%80%99%E8%A3%A1%E5%8F%AF%E4%BB%A5%E4%B8%8B%E8%BC%89%EF%BC%9A%0A%2F%2F%20https%3A%2F%2Fbitbucket.org%2Ffmalpartida%2Fnew-liquidcrystal%2Fdownloads%0A%23include%20%3CLiquidCrystal_I2C.h%3E%0A%0A%2F%2F%20Set%20the%20pins%20on%20the%20I2C%20chip%20used%20for%20LCD%20connections%3A%0A%2F%2F%20addr%2C%20en%2Crw%2Crs%2Cd4%2Cd5%2Cd6%2Cd7%2Cbl%2Cblpol%0ALiquidCrystal_I2C%20lcd(0x27%2C%202%2C%201%2C%200%2C%204%2C%205%2C%206%2C%207%2C%203%2C%20POSITIVE)%3B%20%2F%2F%20%E8%A8%AD%E5%AE%9A%20LCD%20I2C%20%E4%BD%8D%E5%9D%80%0A%0Avoid%20setup()%20%7B%0ASerial.begin(9600)%3B%20%2F%2F%20%E7%94%A8%E6%96%BC%E6%89%8B%E5%8B%95%E8%BC%B8%E5%85%A5%E6%96%87%E5%AD%97%0Alcd.begin(16%2C%202)%3B%20%2F%2F%20%E5%88%9D%E5%A7%8B%E5%8C%96%20LCD%EF%BC%8C%E4%B8%80%E8%A1%8C%2016%20%E7%9A%84%E5%AD%97%E5%85%83%EF%BC%8C%E5%85%B1%202%20%E8%A1%8C%EF%BC%8C%E9%A0%90%E8%A8%AD%E9%96%8B%E5%95%9F%E8%83%8C%E5%85%89%0A%0A%2F%2F%20%E9%96%83%E7%88%8D%E4%B8%89%E6%AC%A1%0Afor(int%20i%20%3D%200%3B%20i%20%3C%203%3B%20i%2B%2B)%20%7B%0Alcd.backlight()%3B%20%2F%2F%20%E9%96%8B%E5%95%9F%E8%83%8C%E5%85%89%0Adelay(250)%3B%0Alcd.noBacklight()%3B%20%2F%2F%20%E9%97%9C%E9%96%89%E8%83%8C%E5%85%89%0Adelay(250)%3B%0A%7D%0Alcd.backlight()%3B%0A%0A%2F%2F%20%E8%BC%B8%E5%87%BA%E5%88%9D%E5%A7%8B%E5%8C%96%E6%96%87%E5%AD%97%0Alcd.setCursor(0%2C%200)%3B%20%2F%2F%20%E8%A8%AD%E5%AE%9A%E6%B8%B8%E6%A8%99%E4%BD%8D%E7%BD%AE%E5%9C%A8%E7%AC%AC%E4%B8%80%E8%A1%8C%E8%A1%8C%E9%A6%96%0Alcd.print(%22HKSTEM.CLUB%22)%3B%0Adelay(1000)%3B%0Alcd.setCursor(0%2C%201)%3B%20%2F%2F%20%E8%A8%AD%E5%AE%9A%E6%B8%B8%E6%A8%99%E4%BD%8D%E7%BD%AE%E5%9C%A8%E7%AC%AC%E4%BA%8C%E8%A1%8C%E8%A1%8C%E9%A6%96%0Alcd.print(%22TEL%3A98511356%22)%3B%0Adelay(8000)%3B%0A%0A%2F%2F%20%E5%91%8A%E7%9F%A5%E4%BD%BF%E7%94%A8%E8%80%85%E5%8F%AF%E4%BB%A5%E9%96%8B%E5%A7%8B%E6%89%8B%E5%8B%95%E8%BC%B8%E5%85%A5%E8%A8%8A%E6%81%AF%0Alcd.clear()%3B%0Alcd.setCursor(0%2C%200)%3B%0Alcd.print(%22Use%20Serial%20Mon%22)%3B%0Alcd.setCursor(0%2C%201)%3B%0Alcd.print(%22Type%20to%20display%22)%3B%0A%7D%0A%0Avoid%20loop()%20%7B%0A%2F%2F%20%E7%95%B6%E4%BD%BF%E7%94%A8%E8%80%85%E6%89%8B%E5%8B%95%E8%BC%B8%E5%85%A5%E8%A8%8A%E6%81%AF%0Aif%20(Serial.available())%20%7B%0A%2F%2F%20%E7%AD%89%E5%BE%85%E4%B8%80%E5%B0%8F%E6%AE%B5%E6%99%82%E9%96%93%EF%BC%8C%E7%A2%BA%E8%AA%8D%E8%B3%87%E6%96%99%E9%83%BD%E6%8E%A5%E6%94%B6%E4%B8%8B%E4%BE%86%E4%BA%86%0Adelay(100)%3B%0A%2F%2F%20%E6%B8%85%E9%99%A4%E8%88%8A%E8%A8%8A%E6%81%AF%0Alcd.clear()%3B%0A%2F%2F%20%E8%AE%80%E5%8F%96%E6%96%B0%E8%A8%8A%E6%81%AF%0Awhile%20(Serial.available()%20%3E%200)%20%7B%0A%2F%2F%20%E5%B0%87%E8%A8%8A%E6%81%AF%E9%A1%AF%E7%A4%BA%E5%9C%A8%20LCD%20%E4%B8%8A%0Alcd.write(Serial.read())%3B%0A%7D%0A%7D%0A%7D" message="" highlight="" provider="manual"/]

Wednesday, January 17, 2018

OpenWRT /usr/lib/lua/luci/dispatcher.lua:582: bad argument #1 to 'pairs'

/usr/lib/lua/luci/dispatcher.lua:582: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
        [C]: in function 'pairs'
        /usr/lib/lua/luci/dispatcher.lua:582: in function 'createtree'
        /usr/lib/lua/luci/dispatcher.lua:230: in function 'dispatch'
        /usr/lib/lua/luci/dispatcher.lua:195: in function </usr/lib/lua/luci/dispatcher.lua:194>





Solution:

Login through ssh

rm -r /tmp/luci-indexcache

Saturday, January 13, 2018

Sapphire RX580 Nitro+ ETH Mining @31mh

 Sapphire RX580 Nitro+ ETH Mining @31mh

1. Mod RX580 BIOS rom to v1.rom
(Using ATIFLASH, Original Driver)

2. Uninstall Any Old Driver using DDU
3. Update ATI Driver to mining version
4.  Create clay.bay
EthDcrMiner64.exe -epool eu1.ethermine.org:4444 -ewal ETHEREUM_WALLET.WORKER_NAME -epsw x -dpool stratum+tcp://sia-eu1.nanopool.org:7777 -dwal SIA_WALLET.WORKER_NAME -dcoin sia -tstop 85 -tt 65 -fanmin 75 -fanmax 100 -cclock 1200 -mclock 2250 -cvddc 850 -mvddc 850 -dcri 18


1 of 6 gpu hang frequently
1 of 6 gpu keep frequently hang after run for 30 minutes which required restart by watchdog, so I underclock by decreast mclock to 2100 

EthDcrMiner64.exe -epool eu1.ethermine.org:4444 -ewal ETHEREUM_WALLET.WORKER_NAME -epsw x -dpool stratum+tcp://sia-eu1.nanopool.org:7777 -dwal SIA_WALLET.WORKER_NAME -dcoin sia -tstop 85 -tt 65 -fanmin 75 -fanmax 100 -cclock 1200 -mclock 2250,2100,2250,2250,2250,2250 -cvddc 850 -mvddc 850 -dcri 18


6 cards run below 900w (around 820w)


Update 20180203
It is quite unstable using the setting, so I downgrade all cclock to 1100, it decrease the Mining rate to 30mhs, but it is much more stable than max speed and I mine continuously for over 10 days.


EthDcrMiner64.exe -epool eu1.ethermine.org:4444 -ewal ETHEREUM_WALLET.WORKER_NAME -epsw x -dpool stratum+tcp://sia-eu1.nanopool.org:7777 -dwal SIA_WALLET.WORKER_NAME -dcoin sia -tstop 85 -tt 65 -fanmin 75 -fanmax 100 -cclock 1100 -mclock 2250,2100,2250,2250,2250,2250 -cvddc 850 -mvddc 850 -dcri 18

Thursday, January 11, 2018

sysbench result: Eeebox B202 Atom N270

Instruction : https://www.howtoforge.com/how-to-benchmark-your-system-cpu-file-io-mysql-with-sysbench

CPU Test


1 Thread
sudo sysbench --test=cpu --cpu-max-prime=20000 run
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1

Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000


Test execution summary:
    total time:                          190.2316s
    total number of events:              10000
    total time taken by event execution: 190.2139
    per-request statistics:
         min:                                 18.83ms
         avg:                                 19.02ms
         max:                                 30.35ms
         approx.  95 percentile:              19.06ms

Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   190.2139/0.00



4 Thread
sudo sysbench --num-threads=4 --test=cpu --cpu-max-prime=20000 --validate run
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 4
Additional request validation enabled.


Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000


Test execution summary:
    total time:                          126.3571s
    total number of events:              10000
    total time taken by event execution: 505.3316
    per-request statistics:
         min:                                 23.36ms
         avg:                                 50.53ms
         max:                                149.99ms
         approx.  95 percentile:              69.97ms

Threads fairness:
    events (avg/stddev):           2500.0000/17.94
    execution time (avg/stddev):   126.3329/0.02