發表文章

目前顯示的是 2013的文章

Using atmel JTAGICE3 to burn code into arduino

圖片
Need Atmel Studio on PC. the connection is as following, the target board need to be powered. then open the avr studio, you can find Device programming under tools.. select tool and device interface, then must press Apply pread read on device signature and target voltage will show you the target chip status. Go to Memory,  then select desired hex file in the flash area, here I choose arduino bootloader Then press program, it will start...the speed depends on the selection on interface settings. the ISP clock should be lower than 1/4 of device frequency We can also use arduino IDE for development and burn the hex in to chip with JTAG, in this case, we skip the bootloader. There will be no more bootloader once we load the complied hex into chip. Then, Where is the hex file in arduino IDE after verfy(complied)?? The answer is in the file "preferences.txt" under :C:\Program Files\Arduino\lib .open it with word pad,

Install Network Time Protocol(NTP) on BeagleBone with Angstrom linux and set local time zone

Referenced from : http://cwraig.id.au/?p=513 1. Update your Package List opkg update 2. Get the ntp Package opkg install ntp ntpdate Update 2014/07/03 for the latest beaglebone image(2013-06-20) with kernel 3.8.12, after this installation,  system will add to service list, so only need to change time zone 3. Now we need to stop the ntpd service so we can request a manual update /etc/init.d/ntpd stop manual update ntpdate pool.ntp.org type in date, you should see the date is changing to current date and time, but the time zone is not corrected. The time zone info is contained in /etc/localtime , use this to remove it: rm /etc/localtime before link up our time zone, look into /usr/share/zoneinfo folder for your timezone. I did not find taiwan in asia, not plan to use hong_kong, but there is still: /usr/share/zoneinfo/Etc/GMT-8 now we make the link with ln command ln -s /usr/share/zoneinfo/Etc/GMT-8 /etc/localtime now type date again to check, should ha

Gdata spreadsheet on beaglebone

圖片
The target is to use gdata service to upload data from beaglebone to a existing google drive spreadsheet... since beaglebone has already comes with python 2.7, this will be easier to do it. AlL my reference comes from: eduardo simioni first following the installation guide here: https://developers.google.com/gdata/articles/python_client_lib down load the gdata here : https://code.google.com/p/gdata-python-client/downloads/list Find the path of down load file, then use wget, example: wget https://gdata-python-client.googlecode.com/files/gdata-2.0.18.tar.gz you can also down load to PC and the transfer to beaglebone with SCP. untar the file with : tar -zxvf yourfile.tar.gz go into the gdata fold: cd gdata-2.0.18 then run : sudo python setup.py install wait for the installation. for testing, change to /tests/ and try: python run_data_tests.py it should process a serie of testing to see if there is any fault.. The other example for testing is to go to /samples/

Auto start a Python service on beaglebone angustrom

after making several python web service, I wish to have the web service starts when power on beaglebone, this link is the reference: http://stackoverflow.com/questions/11152657/angstrom-start-up-processes-beaglebone example: Go in to /lib/systemd/system/ and open  the bone101.service, this is a service file for 101 stuff. so we have to create our service I have a PyBBIO web service stuff named as u4glass_tank.py saved as glass_tank.service [Unit] Description=Python glass tank web service [Service] WorkingDirectory=/home/root/PyBBIO/examples ExecStart=/usr/bin/python u4glass_tank.py [Install] WantedBy=multi-user.target Then go to terminal do the following: systemctl enable glass_tank.service To start the service, you can reboot or execute systemctl start glass_tank.service To check if the service is running and get the latest outputs from the script: root@beaglebone:~# systemctl status glass_tank.service in terminal it would return like this: glas

blue tooth low energy

Idea is to use TI2541 chip module source: 1. in Taiwan, but don't see and firmware http://www.joybien.com/download/DATASHEET_EN(UART)A.pdf 2.BLE112 Bluetooth Low Energy Breakout http://www.inmojo.com/store/jeff-rowberg/item/ble112-bluetooth-low-energy-breakout/ http://www.bluegiga.com/BLE112_Bluetooth_low_energy_module BGlib: https://github.com/jrowberg/bglib/tree/master/Arduino how to Programming the BLE112 using BGScript: http://blog.bluetooth-smart.com/2012/09/16/programming-the-ble112-using-bgscript/ Programming the BLE112 with C code using IAR: http://blog.bluetooth-smart.com/2012/09/11/programming-the-ble112-with-c-code-using-iar/#more-213 another BLE112 based shield: source:http://www.mkroll.mobi/?p=517 http://www.mkroll.mobi/?page_id=386 well documented: https://github.com/michaelkroll/BLE-Shield redbear BleFirmata using CC2540 USB interface one http://redbearlab.com/bleshield/ with central support BLEmini SDK http://redbearlab.com/blemini#SDK

low pass filter for arduino PWM control to reach 10V Analog control

Arduino PWM control frequency is about 488Hz for pin 3,9,10,11.. and 977Hz for P5,6, in order to make it analog out put. we selected a low pass RC filter where R=4.7K, C=3.3uF, which result a cut off frequency at about 10Hz...response time about 0.1-0.2 sec. then we need to amplify it to 10V http://arduino.cc/forum/index.php/topic,12135.0.html 2 ways are considered: lpf 5v pwm and switch up tp 10V http://www.3reef.com/forums/i-made/arduino-pwm-0-5v-0-10v-121705.html using 10V source and MOSFET then lpf http://www.reefcentral.com/forums/showthread.php?t=1995554

python periodic doing something

10 is the interval in second...foo is the function to run. >>> import time, threading >>> def foo(): ... print(time.ctime()) ... threading.Timer(10, foo).start() ... >>> foo() Thu Dec 22 14:46:08 2011 >>> Thu Dec 22 14:46:18 2011 Thu Dec 22 14:46:28 2011 Thu Dec 22 14:46:38 2011

How to out put HEX array with Pyserial

import serial import array ser=serial.Serial('COM3',38400,timeout=1) """ To turn on all LED on 255 FF FF 00 01 FF FF FF FF FF FF FF 0D To turn on at half FF FF 00 01 7F 7F 7F 7F 7F 7F 00 0D To turn off FF FF 00 01 00 00 00 00 00 00 00 0D """ LedOn=[0xFF,0xFF,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0D] Test=[0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x50,0x51,0x0D] ser.write(array.array('B',LedOn).tostring()) ser.close() the command array can still be a 0x type to indicate hex array. but for pyserial, it take char, if you want to print out hex it need to be \x41 (which is an "A") if you have an arry say: My=[0x41,0x42,0x43] need to pass to pyserial write as '\x41\x42\x43' good thing is there is a array function to do so: array.array('B', My.tostring() which will out put '\x41\x42\x43'

Arduino based DMX library

Arduino based DMX ArtNet-Node I tried severail library for DMX, most of them modify the serial hardware setting on 168/328. 250000bps is supported, 2 stop bits are also supported. the first start 88us is using 115200 bps to send 0x00. But when I wish to run them on mega, most lib does not support. although we know we can modify the lib to fit mega, but this one claim to support mega, and able to do 4 universe. I'm going to try it!! but this lib only runs on 0023 version. I tried this Arduino based DMX ArtNet-Node v0.2 lib in 0022 version, it's pretty good, no need for modify hardwareserial.cpp and it works great on mega... Installation Instructions: Copy the folder “Dmx” included in the package to the folder arduino-0023/libraries/ Copy the folder “artnet_node” to Arduino sketches folder, in my case “Arduino” Now we can open the sketch of the “artnet_node”, compile the code and upload to Arduino. it seems if you don't use artnet function, it could work