A microcontroller is basically a computer on a chip. It contains a processing unit (CPU), memory (ROM and RAM), serial communication ports, analog to digital converters (ADC); they are called microcontroller because they are small and they allow to control actuators (motors and other devices).
In this example I learned to use the AnalogRead and AnalogWrite functions to measure and apply different levels of voltage to a LED respectively and how to use the serial monitor of Arduino. I used a potentiometer, that is a variable resistor, a LED's and a 220 ohms resistor. The effect of using a potentiometer to control the brightness level of a led is showed in the next video.
Serial Kscan3d 30
The Serial Peripheral Interface bus (SPI) is a synchronous serial communication interface specification used for short distance communication, primarily in embedded systems. SPI devices communicate in full duplex mode using a master-slave architecture with a single master. The master device originates the frame for reading and writing. Multiple slave devices are supported through selection with individual slave select (SS) lines.
The integrated system connects a sensor board with a photoresistor with a stepper motor through a controller board. The final code can be found here . The code starts by setting an analog pin for the sensor to read serial values. The next parameters are "apertura" and "diferencia". Apertura is the amount of rotations the motor makes to open the structure mapping the serial values in ranges of 20 from 0-1024. The value diferencia is set so that the structure closes but not entirely when there a small changes in light intensity. It uses an "if/else" command to control the direction of the rotations the motor makes. Finally, the code controls the speed of the stepper motor. I realized that slower speed=stronger movement and vice-versa
Description: The assignment for this week was to measure something: add a sensor to a microcontroller board that you have designed and read it. This was an important assignment for the development of my project because I learned how to read data from a photoresistor (LDR). The LDR works by sensing the intensity of light in its environment. The data it collects is desplayed in serial values from 0-1024. This values are classified in ranges that are used to program my output device: a stepper motor. Softwares: Arduino IDETerminal (MacOSX) Materials: Microcontroller Board (Fabduino 328)BreadboardPhotoresistor10K ohm ResistorWiresUSB cablePower Source (computer) Downloads: Reference Download Files
After connecting the LDR with the microcontroller board, I copied a code to read serial values into the Arduino Ide. This programs the LDR to read values from 0-1024 depending on the amount of light it senses. After that, I used Terminal to read the information from the USB port the board was connected to. It read higher values when the light was brightest and lower ones when the light was low.
The sensor board I designed contains a photoresistor (LDR), 10k Ohm resistor and an output pin to connect to the controller board. The sensor measures light intensity through a serial value read by the controller board. The cut files to make the routes of the board can be found here
The sensor board works through an analog pin (AO). Since it's only function is monitor changes in light through serial values, the code to program the board is very simple. The setup needs a the command "serial.begin(9600)" to begin to monitor. The loop has an analogRead command through pin A0 in this case, Serial.println(val) to start printing values from the serial monitor, and finally a delay of 10 between each serial value read
Description: The assignment for this week was to add an output device to a microcontroller board you've designed and program it to do something. This was an important assignment for the development of my project because I learned how to control a stepper motor. I used an EasyDriver to drive the motor because it has to move a structure with a considerable weight. This weight demands a higher voltage than the 5V that my microcontroller can handle. The stepper motor is the main part of my project because it moves the structure to react accordingly to the solar patterns. One full rotation of the motor equals 1cm of vertical movement. I had to make a code that combines two variables: serial values (light intensity) and motor rotations (movement). Softwares: Arduino IDETerminal (MacOSX) Materials: Microcontroller Board (Fabduino 328)Cables(female/female)Power source (12V)Positive/Negative CablesEasy DriverStepper Motor Downloads: Reference DOWNLOAD FILES
The code is split in two parts: the master code and the slave code. The master board sends a serial value to a specific address in the slave board. The value the master code sends is set in a range of 0 to 5. Every time the slave board reads the set value, all devices with the same address will receive the transmission.
Description: Assignment: write an application that interfaces with an input &/or output device that you made. I combined my previous assignments into a single code to run a stepper motor according to the intensity of light read by a sensor. Softwares: Arduino IDE Materials: Microcontroller Board (Fabduino 328)Cables(female/female)Power source (12V)Positive/Negative CablesEasy DriverBreadboardPhotoresistor10K ohm ResistorWiresUSB cablePower Source Downloads: Download Files Programming The code is composed of two parts: motor and sensor. The input(senor) code is shorter than the larger output(motor) code therefore, merged into it. The variables the final code has relates the amount of rotations from the motor to a serial value read from the photoresistor. Two extra variables are added to the code: apereture/diference.Motor Code (left) Sensor Code (right)
I used Processing to graph the serial values read by the sensor board (input devices). This assignment helped me understand how to change data from serial values into graphic information using this software. I am detecting changes in light with a photo-resistor in the form of voltage differences. I am then attempting to graph the change in voltage over time. My code is coming from a tutorial on how to graph. 2ff7e9595c
Comentarios