Don't wanna be here? Send us removal request.
Text
LEGO Crane Final Project Pics


Here are a couple pictures of my LEGO crane. An Arduino Uno and breadboard are located inside the container, which is made entirely from LEGO bricks. Using a servo motor compatible with LEGO bricks I’m able to control the horizontal movement of the crane, allowing it to spin 360 degrees in rotation.
See my next post for a video of my crane in action
Below is the code I’m using to do this:
Code for Processing:
import processing.serial.*; import cc.arduino.*; import controlP5.*; ControlP5 controlP5; Arduino arduino;
int DC_speed = 150; // 0-255 void setup() {
size(400,400);
println(Arduino.list()); arduino = new Arduino(this, "/dev/cu.usbmodem14201", 9600);
for (int i = 0; i <= 13; i++) arduino.pinMode(i, Arduino.OUTPUT);
controlP5 = new ControlP5(this); controlP5.addSlider("DC_speed",0,255,DC_speed,20,10,255,20);
} void draw() { arduino.analogWrite(9, DC_speed);
}
___________________________________
Code for Arduino:
#include <Firmata.h>
byte analogPin = 0;
void analogWriteCallback(byte pin, int value) { if (IS_PIN_PWM(pin)) { pinMode(PIN_TO_DIGITAL(pin), OUTPUT); analogWrite(PIN_TO_PWM(pin), value); } }
void setup() { Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION); Firmata.attach(ANALOG_MESSAGE, analogWriteCallback); Firmata.begin(9600); }
void loop() { while (Firmata.available()) { Firmata.processInput(); } // do one analogRead per loop, so if PC is sending a lot of // analog write messages, we will only delay 1 analogRead Firmata.sendAnalog(analogPin, analogRead(analogPin)); analogPin = analogPin + 1; if (analogPin >= TOTAL_ANALOG_PINS) analogPin = 0; }
0 notes
Photo



FINAL PROJECT UPDATE
for my final project i will be sticking with the LEGOs and building a crane. this crane will use three 360 degree servo motors that are compatible with LEGO bricks. one servo for horizontal 360 degree motion, one for up and down movement of the arm, and the third for closing a claw to grab and drop LEGO bricks. i will continue to use the compartment i built to house the arduino and breadboard, constructing the crane on top. this crane will be completely interactive with 3 potentiometer knobs controlling each servo. i have built the control panel that holds the potentiometers. waiting for servo motors in the mail. steps after that are wiring it together, coding, and play testing.
0 notes
Photo










MIDTERM PROGRESSION PICS
I have built a nice compact home for my arduino and breadboard. the wires are flowing nicely through my project. i included little windows around the structure as well. the door is a bit flimsy but works well enough. I actually changed my original idea of the door swinging open vertically to open up horizontally. i thought this would put less stress on the servo, even though this one is a bit stronger than the servo motor that came with the arduino starter kit. Whats next? i need to wire up my rgb led light and make sure that the code is properly working to truly make this a stormtrooper rave. below is my current code:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
const int redLEDPin = 11; const int greenLEDPin = 10; const int blueLEDPin = 6;
// Variables will change: int ledState = LOW; // ledState used to set the LED
int redValue = 0; int greenValue = 0; int blueValue = 0;
int knob = A0; // analog pin used to connect the potentiometer int val; // variable to read the value from the analog pin
unsigned long previousMillis = 0; // will store last time LED was updated
// constants won't change: const long interval = 1000; // interval at which to blink (milliseconds)
void setup() { Serial.begin(9600); myservo.attach(9); // attaches the servo on pin 9 to the servo object pinMode(redLEDPin, OUTPUT); pinMode(greenLEDPin, OUTPUT); pinMode(blueLEDPin, OUTPUT);
}
void loop() { val = analogRead(knob); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 25, 450, 120, 130); // scale it for use with the servo (value between 0 and 180) myservo.write(val); // sets the servo position according to the scaled value
RGB_color(255, 0, 0); // Red //delay(1000); RGB_color(0, 255, 0); // Green //delay(1000); RGB_color(0, 0, 255); // Blue //delay(1000); RGB_color(255, 255, 125); // Raspberry //delay(1000); RGB_color(0, 255, 255); // Cyan //delay(1000); RGB_color(255, 0, 255); // Magenta //delay(1000); RGB_color(255, 255, 0); // Yellow //delay(1000); RGB_color(255, 255, 255); // White //delay(1000);
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) { // save the last time you blinked the LED previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa: if (ledState == LOW) { ledState = HIGH; } else { ledState = LOW; }
// set the LED with the ledState of the variable: digitalWrite(11, ledState); digitalWrite(10, ledState); digitalWrite(6, ledState); } } void RGB_color(int red_light_value, int green_light_value, int blue_light_value) { analogWrite(redLEDPin, red_light_value); analogWrite(greenLEDPin, green_light_value); analogWrite(blueLEDPin, blue_light_value); }
0 notes
Photo





Building a LEGO home for my Arduino. There is a slot to plug in usb and I can install an LED next to it to indicate if there is power or not. There is also a tiny home for my servo motor, which I’m planning to have open a door.
Next Steps:
- Figure out how to wire it up with or w/o breadboard
- Make space for motion sensor/ temperature sensor
- Design and create door and attach it to servo motor
- Design and create area behind door
- Write code and test along the way to see if everything works properly
0 notes
Video
tumblr
LEGO CLONE RAVE WITH ARDUINO
Using a servo motor, a few LED lights and some simple code, I was able to make a small party of one LEGO Clone Trooper. Maybe his friends will join him later.
Code:
#include <Servo.h>
Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object pinMode(3, OUTPUT); //red pinMode(4, OUTPUT); //green pinMode(5, OUTPUT); //blue }
void loop() { for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(1); // waits 1ms for the servo to reach the position } for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(1); // waits 1ms for the servo to reach the position } digitalWrite(4, HIGH); digitalWrite(3, HIGH); delay(200); digitalWrite(3, LOW); delay(100); digitalWrite(5, HIGH); delay(200); digitalWrite(5, LOW); delay(100);
}
1 note
·
View note
Photo

This week we were tasked to find a creative application for digital input and output. Wiring up the LCD screen that came with my Arduino kit, along with a potentiometer, I was able to code (see below) this message to send to my family. There are many wires in this one, so knowing where each wire goes and securely connecting them is very important.
Code:
#include <LiquidCrystal.h> // includes the LiquidCrystal Library LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Creates an LCD object. Parameters: (rs, enable, d5, d4, d3, d2) const int switchPin = 6; int swittchState = 0; int prevSwitchState = 0; int reply;
void setup() { lcd.begin(16, 2); // set up the LCD's number of columns and rows lcd.print("Enjoy Florida!"); lcd.setCursor(0, 1); lcd.print("Love, Daniel <3");
}
void loop() { // Turn off the display: lcd.noDisplay(); delay(300); // Turn on the display: lcd.display(); delay(2000); }
0 notes
Video
tumblr
After some fiddling around (safely of course), and a bit of trial and error i was able to make this simple circuit to power one LED light bulb. It uses a 9 volt battery along with a resistor and a momentary switch to turn it on and off.
0 notes
Photo






LEGO STAR WARS HOLOPROJECTOR. MY OWN CREATION (MOC)
This particular holoprojector is made completely out of LEGO bricks. This one, however, is not handheld, but a stationary device that is installed inside a ship or an office to send and receive, display and communicate through holograms. Complete with its own power supply system and a state of the art control panel, this holoprojector also has built in speakers. With more galactic credits, this holoprojector can be upgraded to display the subject in full color, with no filters or scan lines visible.
A holoprojector is a device that could record, send, receive, and/or display holograms. Traditionally, these images were used for communication, but some holoprojectors were also designed as tools for entertainment and academic purposes. Holoprojectors projected an organized arrangement of light to create a 3-D replica of the subject. Most holoprojectors were equipped with sound so that the user could hear the subject talk in perfect sync. Holoprojectors come in various sizes. Holoprojectors could also be within a droid, or even attached to the gauntlet of the user as well as a comlink.
- Wookieepedia
0 notes