Sunday, December 2, 2012

nRF24L01 2.4GHz RF Linux-Joystick Controlled Arduino Based Plane


How Transmitter Works:
Joystick -> Linux OS -> ardjoy Program -> Arduino 1 with TX code -> Transmits Joystick Info

How Receiver Works:
Receives Joystick Info -> Arduino 2 with RX code -> Controls Plane Servos and ESC

What you need:
  • 2 Arduino's
  • 2 nRF24L01 2.4Ghz RF devices
  • IDE cable (optional, to connect nRF24L01 to Arduino)
  • Linux OS with joystick support
  • USB/Serial Joystick that works with Linux


Downloading and Compiling Code
 mkdir -p ~/workspace
 cd ~/workspace
 git clone https://github.com/thomas41546/rc_plane_arduino_joystick.git
 make
 NOTE: the ardjoy code may need to be modified for joystick other than a ps2 controller.


Connect each nRF24L01 to each Arduino
Here is a  goodlink to help you do that:
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

Upload Arduino Code (Arduino Sketch files are found in the git repository above)
Setting up the transmitter 
  • Connect Joystick to Linux OS 
  • Verify that you have a /dev/input/js0 joystick device file
  • Connect the Arduino 1 to the Linux OS
  • Verify that you have a /dev/ttyUSB0 arduino device file
  • Run the following command "./ardjoy /dev/input/js0 /dev/ttyUSB0 115200"
  • Your Arduino should now be transmitting joystick information
Setting up the receiver (TODO, THIS IS INCOMPLETE)
  • Connect the Arduino 2 to the RC plane
  • Power the Arduino 2
  • You should now have the servo and ESC move in response to joystick inputs.

Monday, November 19, 2012

Compiling Nook Color Kernel


Setup and Building Nook Kernel

Setup working directory
mkdir ~/nc
cd ~/nc

Grab kernel and arm-toolkit
git clone https://github.com/CyanogenMod/android_kernel_bn_encore.git
git clone https://android.googlesource.com/platform/prebuilt

Copy config file from nook device to our kernel directory.
Make sure you nook is plugged into the computer via USB with ADB enabled.
cd ~/nc/android_kernel_bn_encore
adb pull /proc/config.gz .
gunzip config.gz
mv config .config

Setup environmental variable to for our ARM toolchain
export ARMTOOLCHAIN=~/nc/prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-

Run menuconfig and select your kernel options
make ARCH=arm CROSS_COMPILE=$ARMTOOLCHAIN menuconfig


Build the kernel to uImage format (replace -jX where X is the number of CPU's you have)
make ARCH=arm CROSS_COMPILE=$ARMTOOLCHAIN -j4 uImage

You will now have built a kernel, the uImage is located at ~/nc/android_kernel_bn_encore/arch/arm/boot/uImage

Installing Kernel uImage

Grab a kernel-update zip file, such as the 1.2GHZ overclock kernel update zip below.
You can use a nightly update zip as well, it doesn't really matter as long as there is a ./kernel file to replace in the zip archive.
mkdir -p ~/nc/update
Download update zip from here: https://docs.google.com/open?id=0B471Nt_V1052eHpuS05oWTIzZ3M and place it into ~/nc/update
unzip *.zip
rm kernel
cp ~/nc/android_kernel_bn_encore/arch/arm/boot/uImage kernel
zip -r update.zip kernel MLO ramdisk.img u-boot.bin META-INF/
adb push ./update.zip /sdcard/update.zip

Installing Update
Boot into recovery mode and install the /sdcard/update.zip

Conclusion
You should now be running a custom compiled kernel, you now have complete control of your device. 

Other repositories:
https://github.com/thomas41546/android_kernel_bn_encore - Here is the github of my over-clocked and stable 1.2ghz kernel, a note of caution I used 1.4v overvolt -- which should be fine but I am not liable for any damages.

https://github.com/dalingrin/nook_kernel/commits/encore-32 - Here is the github of the dalingrin kernel for CM7, you can use this information to port features in your kernel. 







Sunday, August 5, 2012

Electric Bike (Ebike made with Ecrazyman Controller and Crystalite Motor)

 

So I've been recently playing around with Electric Bikes --- they are awesome! I highly recommend that if you have some free time and about a $1000 dollars lying around that you make your own 50kph (32mph) Electric Bike.

 

Parts for Electric Bike:

  • Crystalite HS3540R Brushless Hub Motor (1500W)
  • Cycle Analyst (for measuring speed and current draw)
  • Hobbyking Lithium Polymer 150W Batteries  (2x)
  • Ecrazyman Brushless  Controller (72v @ 45A)
  • Brat Broodie Bike Used (Any used Bike Frame with Front Suspension)

Monday, April 16, 2012

Arch Linux LXDE /w Xorg Mouse Keyboard on Nook Color Android Tablet

by Thomas Polasek



My goal was simple, install a full linux os on my Nook Color tablet. I was surprised to find out that nobody has bothered to run an Xorg server on the android device itself, practically all solutions went through VNC to access the Xorg server.

I will show you how to boot up an Arch Linux distro with mouse and keyboard support that runs the Xorg server on the linux framebuffer (/dev/graphics/fb0). 





Part 1.

Root your Nook Color

Install Clockwork Recovery Mod

Install the Nook Color Cm7.2-RC1 MiRaGe rom
 http://forum.xda-developers.com/showthread.php?t=1344873

Install the Nook Tweaks app from the google market
 https://play.google.com/store/apps/details?id=com.dalingrin.nookcolortweaks&hl=en

Install the SSHDroid app (optional) from the google market
https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en

Part 2. (Linux OS)

Plug in 4GB+ MicroSD Card (with an Ext4 partition)

Mount the SD Card on your OSX or Linux OS
mkdir -p /mnt/sdcard
mount /dev/sdb1 /mnt/sdcard (Replace /dev/sdb1 with your sdcard device)
Download and Extract Arch Linux distro for ARM7 OMAP to your SD Card
          cd /mnt/sdcard
          mkdir arch
          cd arch
tar xvzf ArchLinuxARM-omap-smp-latest.tar.gz
rm -f ArchLinuxARM-omap-smp-latest.tar.gz

Part 3. 
Connect the MicroSD to your Nook Color Tablet

Run the SSHDroid app or connect via adb shell

Connect to your Nook Color via SSH from your linux machine and make sure our SDCard is writeable/executable
su
bash
cd /mnt/sdcard (this is the mounted directory of your MicroSD card with arch linux on it, yours might be different)
mount -o remount,rw,exec /mnt/sdcard

Chroot into your arch linux distro (you should probably make this a script)
If you need additional/supplementary information here is a good link
http://www.mayrhofer.eu.org/debian-on-android

export mnt=/mnt/sdcard/arch (This is your Arch Linux distro location)

# mount linux essentials to our chroot environment
mount -o bind /dev $mnt/dev
mount -t devpts devpts $mnt/dev/pts
mount -t proc none $mnt/proc
mount -t sysfs sysfs $mnt/sys

# export environmental variables for our chroot
export PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:$PATH
export TERM=xterm
export HOME=/root
export USER=root

#chroot into our arch linux distro
chroot $mnt /bin/bash

Part 4. (in your arch chroot environment)

Setup our DNS (only have to do this once)
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 4.2.2.2" >> /etc/resolv.conf

Update arch
pacman -Syu

Install Xorg and LXDE on your Arch Linux Chroot
pacman -S xorg-xinit xf86-video-fbdev xf86-input-evdev lxde

Edit your /etc/X11/Xorg.conf file
cd /etc/X11
rm Xorg.conf
sudo wget http://y.uk.to/files/xorg.conf (or try http://pastebin.com/raw.php?i=8CM7NKhd)
You may need to edit the device references for the keyboard and mouse in Xorg.conf! (/dev/input/event5 and /dev/input/event4 might be different)
More information is found below

Go on your Nook Tablet and Run the Nook Tweaks app
Turn on USB-Settings ---> USB Host Mode
Turn on USB-Settings ---> External VBus

Connect your USB devices to your Nook Color Tablet
Obtain a female to female usb connector
Connect a hub to one side of the female connector
Connect a usb keyboard/mouse to the hub
Connect a mini-usb to the nook and then to the other side of the female connector

If you need to figure out what devices your keyboard and mouse are on, then
cd /dev/input

run the cat command on each input* .... and check if your keyboard/mouse input results in a change on the output from cat
for example, when I press a key on my keyboard cat /dev/input/event5  outputs some binary characters.

Now we will setup our linux framebuffer (****UPDATE 1****)

           pikpok sent me this suggestion in the comments section.
You can use "setprop ctl.stop media & setprop ctl.stop zygote" in adb shell to kill zygote server and media, if you want to return to android you can replace stop with start and run again, it's much better than chmod :)
Now we will setup our linux framebuffer (hack)
Try pikpok's suggestion first, if it doesn't work then try out this hack of mine.
Temporary hack to stop the android system from accessing the frame buffer device. I plan on writing a patch that toggles access to this framebuffer from linux. But right now what I do is
I change permissions on the framebuffer and then wait for the android system to lose connection to the framebuffer device.
Once android loses the connection I run the Xorg server on the framebuffer, it hijacks the graphics output.
If anyone has any idea on a better way to this please feel free to post on the comments section.
Eventually (again this is a hack) the android system will appear to freeze (the screen stops updating)
cd /dev/graphics
chmod 000 /dev/graphics/fb0
chown root:root /dev/graphics/fb0
If the graphics don't freeze right away, then keep running and killing the xorg server over and over until it does.
Start LXDE session (starts Xorg Server)
xinit /usr/bin/lxsession &

If everything is configured good, you will get a full LXDE desktop with mouse and keyboard support.
For any xorg server problems, have a look at the /var/log/Xorg*.log file

To stop the xorg server you can run  (not the safest way but it doesn't really matter for this)
         killall X 

BAM. Fully working linux system using the linux framebuffer with mouse/keyboard support.

In addition to support the USB keyboard and mouse, it is possible for other USB devices that are support ed by linux to be connected. Example of devices such as USB-DVI, USB-SERIAL, Arduino, etc...

Notes about the SD Card and EMMC:
It is possible to chroot into any part of the filesystem of Nook as long as you have rwx access. For my personal usage I chroot into the 8th partition on the EMMC (~4GB) of space and run Arch Linux from there, I find the EMMC runs faster than the SD Card.
****UPDATE 1****
Working on making a full bootable Arch Linux image with the Android Kernel, and without all the Android system fluff.