So I just underwent a rather large step….
Many updates to follow.
Please note that this is more for my sake. To mount a hard drive in raspbian do the following: Make sure you have ntfs-3g installed by running:
1 |
sudo apt-get install ntfs-3g |
Then mount the drive read/write with the following command:
1 2 |
sudo mkdir /media/USBHDD sudo mount -t ntfs-3g /dev/sda1/ /media/USBHDD/ |
And it shout be mounted. /dev/sda1 is the location of your hard drive. Now to configuring minidlna. Location of minidlna.conf file and access command:
1 |
sudo vi /etc/minidlna.conf |
This is the file I’m running right now. As I type this i’m successfully streaming to my Kindle Fire HD (the reason why I’ve decided to really make this thing work) but I’m not sure if it’s stable. It’s also able to stream to VLC as of now.
It’s time to face facts, minidlna and XBMC won’t run at the same time in Raspbmc. The basic UPNP included in Raspbmc won’t work consistently and Raspmc and is not nearly as stable as minidlna. OpenELEC is fast enough, but does not have the expandability of a full linux OS. I need to restart this project.
First thing’s first I’m going to straight up speed this thing up as much as I can. At the base level, this begins with the SD card. I’m going to go from a junk 4gb standard speed SD card to a 8gb SanDisk Ultra 30mb/s SDHC. On this I’m going to install the latest version of Raspian and overclock it to the maximum 1GHz.
I’ll keep you posted on how I progress.
First of all, here’s a video of this device in action.
So things are really starting to take shape with the plane (still unnamed…) and I’ve got a really solid framework for an auto-balancing system. Basically the program below maps the x value given from the ADXL335 to a value from 1-180 on the servo. A lot of this code is for debug, but that portion can be switched off.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
</pre> #include <Servo.h> Servo myservo; int raw_val; int ref_val; int mid_val = 336; int left_tilt = 260; int rght_tilt = 405; int min_switch = 2; int max_switch = 3; int mid_switch = 5; int mode_switch = 4; int debug_switch = 6; int bounds_LED = 10; int mid_LED = 11; int debug_LED = 7; int normal_LED = 8; void setup(){ pinMode(min_switch, INPUT); pinMode(max_switch, INPUT); pinMode(mid_switch, INPUT); pinMode(debug_switch, INPUT); pinMode(mode_switch, INPUT); pinMode(bounds_LED, OUTPUT); pinMode(mid_LED, OUTPUT); pinMode(debug_LED, OUTPUT); pinMode(normal_LED, OUTPUT); Serial.begin(9600); myservo.attach(9); } void loop(){ if (digitalRead(debug_switch) == HIGH) { digitalWrite(debug_LED, HIGH); digitalWrite(normal_LED, LOW); raw_val = analogRead(0); if (digitalRead(mode_switch) == HIGH) { digitalWrite(bounds_LED, HIGH); digitalWrite(mid_LED, LOW); Serial.print("BOUNDS MODE: "); ref_val = map(raw_val, left_tilt, rght_tilt, 0, 180); myservo.write(ref_val); if (digitalRead(min_switch) == HIGH){ Serial.print("LEFT HGH"); left_tilt = raw_val; } if (digitalRead(min_switch) == LOW){ Serial.print("LEFT LOW"); } Serial.print(" , "); if (digitalRead(max_switch) == HIGH){ Serial.print("RGHT HGH"); rght_tilt = raw_val; } if (digitalRead(max_switch) == LOW){ Serial.print("RHGT LOW"); } Serial.print(" , "); Serial.print("Left Tilt: "); Serial.print(left_tilt); Serial.print("Rght Tilt: "); Serial.print(rght_tilt); } if (digitalRead(mode_switch) == LOW) { Serial.print("MID MODE:"); if (digitalRead(mid_switch) == HIGH){ mid_val = raw_val; } int MLeft_val = mid_val - 75; int MRght_val = mid_val + 75; ref_val = map(raw_val, MLeft_val, MRght_val, 0, 180); myservo.write(ref_val); digitalWrite(bounds_LED, LOW); digitalWrite(mid_LED, HIGH); Serial.print(" , "); Serial.print("Left Most Value: "); Serial.print(MLeft_val); Serial.print(" , "); Serial.print("Rght Most Value: "); Serial.print(MRght_val); Serial.print(" , "); Serial.print(mid_val); } Serial.print(" , "); Serial.print("Raw Value: "); Serial.print(raw_val); Serial.print(" , "); Serial.print("Current Servo Value: "); Serial.print(ref_val); Serial.println(""); } if (digitalRead(debug_switch) == LOW) { digitalWrite(debug_LED, LOW); digitalWrite(normal_LED, HIGH); raw_val = analogRead(0); if (digitalRead(mode_switch) == HIGH) { digitalWrite(bounds_LED, HIGH); digitalWrite(mid_LED, LOW); ref_val = map(raw_val, left_tilt, rght_tilt, 0, 180); myservo.write(ref_val); if (digitalRead(min_switch) == HIGH){ left_tilt = raw_val; } if (digitalRead(max_switch) == HIGH){ rght_tilt = raw_val; } } if (digitalRead(mode_switch) == LOW) { if (digitalRead(mid_switch) == HIGH){ mid_val = raw_val; }<a href="http://192.168.1.37/wp-content/uploads/2012/12/2012-12-27_14-20-51_644.jpg"> </a> int MLeft_val = mid_val - 75; int MRght_val = mid_val + 75; ref_val = map(raw_val, MLeft_val, MRght_val, 0, 180); myservo.write(ref_val); digitalWrite(bounds_LED, LOW); digitalWrite(mid_LED, HIGH); } } } |
Sorry for the lack of comments in this code, it’s pretty intuitive though, at it’s core its all about the map command.
Here’s a picture of what my desk looks like:
1 2 |
<a href="https://www.esologic.com/wp-content/uploads/2012/12/2012-12-27_14-20-51_644.jpg"><img alt="" src="https://www.esologic.com/wp-content/uploads/2012/12/2012-12-27_14-20-51_644.jpg" width="705" height="397" /> </a> |
Here’s a picture of the fritzing document, which can be found: here
Thanks for reading!
So although I haven’t written about it yet, right now I’ve gotten a Raspbmc Server up and running along with Minidlna. It works great for about an hour at a time and then it really bogs down. This seems to be caused by a combination of Raspbmc and the hard drive spinning down. My solution is to try OpenELEC, overclock the Raspberry Pi, and change out the SD card for one with a faster read/write speed.