Friday, January 31, 2014

Serial communication from Matlab to Arduino and vice versa

Matlab2Arduino


  1. Download the arduino file: http://adf.ly/cqoDu and load into Arduino.
  2. Download the matlab m file: http://adf.ly/cqoq5 and open using matlab.
  3. Ensure that arduino is connected to the PC
  4. Run the matlab program.


Arduino2Matlab


  1. Download the arduino file: http://adf.ly/cqp2L and load into Arduino.
  2. Download the matlab m file: http://adf.ly/cqpC1 and open using matlab.
  3. Ensure that arduino is connected to the PC
  4. Run the matlab program.

Sunday, January 26, 2014

Setup SSH to virtualbox



  1. Select your vbox image that you want to add additional harddisk. Left click -> Settings -> Networking -> Change Attached adapter to Bridged Adapter
  2. Launch your virtualbox system
  3. Install open ssh server
  4. edit /etc/network/interfaces   -> edit to static ip                                                                                  auto eth1
    iface eth1 inet static
    address 192.168.6.108
    netmask 255.255.255.0
  5. /etc/init.d/networking restart  -> restart your network
  6. Use software such as putty or terminal ssh <username>@192.168.6.108
  7. Input your login name and password

Addding Harddisk to VirtualBox





  1. Select your vbox image that you want to add additional harddisk. Left click -> Settings -> Storage -> Add Hard Disk -> Create new disk -> VDI -> Dynamically allocated -> Select location and size
  2. Launch your virtualbox system
  3. ls /dev/sd* (the one without numbers is the new disk)
  4. su -
  5. fdisk /dev/sdb (depending on where your hdd is mounted)
  6. Enter c then u.
  7. Enter p
  8. Select your partition number
  9. Enter the sectors needed
  10. Enter w to write the changes
  11. ls /dev/sd* ( Your new harddisk will show up with number, i.e. sda1, sdb1, etc
  12. mkdir /backup
  13. mkfs.ext4 -L /backup /dev/sdb1
  14. mount /dev/sdb1 /backup
  15. mount ( look for your new drive)
  16. Add LABEL=/backup /backup ext4 defaults 1 2 to your /etc/fstab
  17. Reboot
  18. cd / (You should notice backup folder is created. Your new hard disk is mounted to it.
  19. You can start using the new drive.

Updating fedora EOL to latest



WARNING: Do it at your own risk!
  1. Edit fedora.repo to include http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/ repository.
  2. Yum update.
  3. Download and install the latest kernel, kernel-header,kernel-dev from rpmbone for your fedora version.
  4. rpm --import the_key__version_you_intend_to_upgrade_to
  5.  yum update
  6. yum clean all
  7. yum --releasever=version_you_intend_to_upgrade_to distro-sync

Fedora 16 -> Fedora 17
  1. There are a few problems with the packages: dhclient, dhcp, etc that are not updated resulting no internet connection
Solution
  1. Use live cd
  2. mount chroot /mnt/sysimage /bin/bash
  3. yum check all
  4. manually remove and reinstall the packages that reports the error
  5. yum update
Fedora 16 -> Fedora 20

 So far no problem. Data still intact except some software removed.

Wednesday, January 22, 2014

Logic Sniffer

dangerous prototype logic sniffer




Cubietruck Setup


Wifi:

1. Login to lubuntu: linaro/linaro
2. $sudo modprobe bcmdhd or add bcmdhd to /etc/modules (need to reboot)
3. Add nameserver 8.8.8.8 to /etc/resolv.conf ( without this, the system will be connected to the wifi but no internet access)
4. Reboot


Moving the rootfs to harddisk:
1. sudo su - root --> change to root user
2. mkdir /tmp/1 /tmp/target
3. mount /dev/nandb /tmp/1
4.fdisk -l -> to locate your drive, sda? sdb?
5.fdisk /dev/sda 
4. mkfs.ext4 /dev/sda1
5. mount /dev/sda1 /tmp/target
6. (cd /tmp/1; tar --backup -c *) |tar -C /tmp/target -xv
7. mount /dev/nanda /mnt/
8. vi /mnt/uEnv.txt  (Change root=/dev/sda1)
9. sync
10. unmount /mnt
11. reboot

Cubietruck Setup

Cubietruck Setup