Challenge of the week
This week our tech challenge was to use a motor in conjunction with a sensor of our choice. Unfortunately for me I could not find any examples that furnished code for a project like this that used the same components that came with my starter kit. I tried working with sensors alone & was able to successfully make them work using the information furnished with the kit. When I would combine the sensor code with the motor code something got scrambled, and nothing would work.
To at least have a project to turn in, I opted to do the motor without the sensor. This sounds relatively simple, but it was more involved than I expected. Attaching the motor directly to the Arduino causes a threat of damaging the Arduino board. For this reason a power supply module must be placed on the breadboard. Although the instructions said I could provide power from the Arduino directly to the power supply board I was unable to do it. Evidently it requires a cable that I did not receive in my kit, so I ended up providing power to it with the furnished 9 Volt battery and its provided cable. The power supply module has a convenient, built in on/off switch. The power feeds through the L293D IC (integrated circuit). There is a long drawn out description of how this IC works, but I will not bore you with all the technical mumbo jumbo. It simply helps make the circuit work properly.
 |
Power Supply Module
|
 |
Power Supply Module Mounted on Breadboard
|
 |
L293D Pin Configuration
|
 |
| Motor Project Schematic |
 |
| Motor Wiring Diagram |
 |
Top View of Motor Assembly
|
This particular project reminded me of rigging power supply fans to use as desk fans when the air conditioning would go out in the summer. But I think this project was a little more difficult.
This is the code that the kit furnished for use on this project. I did not make any adjustments to it. Every time I changed something the program quit working. I know what I did wrong was most likely simple, but without someone to double check my work I could not understand what it was.
/************************
Exercise the motor using
the L293D chip
************************/
#define ENABLE 5
#define DIRA 3
#define DIRB 4
int i;
void setup() {
//---set pin
direction
pinMode(ENABLE,OUTPUT);
pinMode(DIRA,OUTPUT);
pinMode(DIRB,OUTPUT);
Serial.begin(9600);
}
void loop() {
//---back and forth
example
Serial.println("One way, then reverse");
digitalWrite(ENABLE,HIGH); // enable on
for
(i=0;i<5;i++) {
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(500);
digitalWrite(DIRA,LOW); //reverse
digitalWrite(DIRB,HIGH);
delay(500);
}
digitalWrite(ENABLE,LOW); // disable
delay(2000);
Serial.println("fast Slow example");
//---fast/slow stop
example
digitalWrite(ENABLE,HIGH); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(3000);
digitalWrite(ENABLE,LOW);
//slow stop
delay(1000);
digitalWrite(ENABLE,HIGH); //enable on
digitalWrite(DIRA,LOW); //one way
digitalWrite(DIRB,HIGH);
delay(3000);
digitalWrite(DIRA,LOW); //fast stop
delay(2000);
Serial.println("PWM full then slow");
//---PWM example, full speed then slow
analogWrite(ENABLE,255); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,50); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,255); //half speed
delay(2000);
digitalWrite(ENABLE,LOW); //all done
delay(10000);
}
Maker Space Presentation
We were also tasked this week with making a presentation about our desired Maker Space. The purpose of this is to have a convincing presentation to use in hope of getting the school district and/or solicit outside funding.
This has been a very difficult week for my school job and Grad School work. Sometimes I question how any of us are able to keep up with the work at our school jobs and still remain sane enough to get our assignments done. I tried so hard to get the code to work with the sensors and the motor at the same time. It took up the majority of my week, and I finally got so frustrated that I only completed the motor alone. For me to understand coding I believe I would have to take a class in nothing but that and not be working to distract me from learning. At least I was able to get the motor assembly to work. The instructions said I could power it with the Arduino, but I could not find a cable to make that happen. I ended up using the 9 Volt battery and its cable to connect to the power supply module to power the project. I left the project assembled because I want to figure out how to use the power from the Arduino to make it work.
This project is a good example of how ventilation fans can be controlled, and of how the cooling fans in computers work. Additionally, the cooling fans for the radiators in our cars are now controlled by computers and not simply turning when the motor is on.
The presentation for the Maker Space was a little time consuming. I had to track down information for a Maker Space I had seen in Conroe a couple of years ago. I wanted to show what could be accomplished when students put their minds to it. I wish I could have found better pictures of the inside of the building, but I could not find them for all angles. I hope there are enough to tweak your interest so you will look up the news articles.