Friday, June 30, 2017

Spartan Superway 2017 Summer - Week 5

June 26 - June 30

This week, I fine tuned the code for running the bogie. I put the steering code into the magnet interrupt so that the bogie will switch/steer itself right away, once the magnet is detected. For the future, the timing of the bogie running forward/reverse has to be calibrated for the track. Such that the bogie has enough time to go up the slope, reach the magnet, switch, go across the top track, reach the other magnet, switch, and go down the slope. Ideally, we would want the bogie to do everything without having to hardcode the delays for going to its positions. For example, we have the bogie moving forward for 10 seconds, and we hope it encounters the magnet once it's at the junction. Then it will switch and move backwards on the top track for 20 seconds, and etc.

Also, I soldered the low pass filters to a protoboard so we don't have to use a large breadboard anymore. The smaller protoboard makes the electronics neater and we can easily position the protoboard anywhere that's convenient for us. Next week, I will solder the hall effect sensor circuit to a small protoboard.

Currently, the 1/2 scale team is waiting for parts to be machined before we can start assembling the two bogies and running tests on the track with it.
I will continue to do improvements on the electronics and hopefully design/print a 3D printed case for them.

Friday, June 23, 2017

Spartan Superway 2017 Summer - Week 4

June 19 - June 23

This week, I completed the code for using eight limit switches and the hall effect sensor. I uploaded the code to our team's github, and then Joey used the code in his test rig. The test rig consists of 2 small DC motors, a small stepper motor, eight limit switches, and a hall effect sensor. The test rig will help us debug the code to make sure it'll definitely work on the completed bogie. Joey continued to make necessary changes to the code, and I helped him adjust the code to achieve what we expect the bogie to do.

However, the new code is having trouble with the timing and conditions for steering/activating the stepper motor. The stepper motor moves when it's not supposed to when certain limit switches are pressed. We will continue working on the code next week, and hopefully fix all the problems. After the code is finished, we will test the code on the actual stepper and dc motor for the bogie. 

In the future, we are expecting to receive a rotary encoder which will be used to map the track. Hopefully it will help in initiating steering at very precise locations. 

Friday, June 16, 2017

Spartan Superway 2017 Summer - Week 3

June 12 - June 16

This week, I learned how to properly wire the limit switches such that they won't accidentally affect the Hall Effect sensor. What happened was that when a switch was pressed, the signal it generated bounced from 5V to 0V in a couple milliseconds. The I/O pins on the arduino are sensitive to that change, and the bouncing signal can trigger the interrupt pin connected to the Hall Effect Sensor. 

In order to debounce the signal, I had to attach an RC circuit to the COM pin of the limit switches. With a resistor of 100k Ohms and a capacitor of .1uF, it would stabilize the signal for 10ms. This was enough time for the signal to be stable and not trigger the interrupt. 
From there, I continued testing the limit switches to make sure they worked correctly and then soldered jumper cables to the pins for easier and consistent placement on the arduino and breadboard. 

With the team, we discussed about the braking system and failsafe system. These systems are important for the safety of the passengers in case of emergencies. Next week, we will continue looking into different ways we can implement braking and preventing the bogie from falling off during switching.

Friday, June 9, 2017

Spartan Superway 2017 Summer - Week 2

June 5 - June 9

This week, I started testing the hall effect sensor in the main code for running the bogie. The interrupt created by the sensor worked half of the time. This was due to the fact that there were too many delay functions in the code. The delay function in the arduino IDE is a blocking function, which means that as long as the delay is running in milliseconds, everything else on the processor is waiting. Although interrupts are supposed to work during delay(), I observed that the variable in charge of detecting the magnet didn't change all the time.

To solve this, I replaced most of the delays (longer than 2 seconds) with if statements. These if statements did quick calculations of the time without holding up other processes and allowed optimization of the timing of the codes. However, another problem came up with the LCD keyboard shield and the Arduino Mega.

When the right button is pressed, it changed the variable that represented a magnet was detected, even though there wasn't a magnet present. This is problem for the switching mechanism because the arduino won't properly know if it's supposed to switch the steering arms or not. However, this isn't a big problem as long as we do not use the manual mode with switching. For example, we only manually drive the bogie up the sloped track, and back down the sloped track.

Finally, I found limit switches in the shop, and started testing them and learning how to wire them correctly. Next week I will connect all eight limit switches and check if they change the booleans of the steering arms. These booleans check if the right or left arm is properly engaged when either all right or left switches are pressed. When the booleans are checked and the magnet is sensed, then the stepper motor will turn the arms in their correct position. In the future, I need to check the pin connections from the arduino to the H-bridges in order to control the motors correctly.

Friday, June 2, 2017

Spartan Superway 2017 Summer - Week 1

This summer, my partner, Adhi, and I are working on the mechatronics for the 1/2 scale bogie. The mechatronics for the bogie involve using an arduino to control the two DC motors and two stepper motors. The DC motors are for moving along the track and the stepper motors are used to control the steering and switching mechanisms. The last team successfully built the 1/2 scale bogie and demonstrated it at Maker Faire. This summer, we have to improve the code and simplify the electronics.

For the first week, May 31-June 2, we read up on the last team's final report and future recommendations, and then we brainstormed improvements and additional requirements. Starting with the old code, we realized that switching hasn't been implemented yet. To steer the bogie onto its intended track in a timely manner, we thought about using Hall Effect Sensors. I started researching about Hall Effect Sensors and found an example online that detects a magnet and another one that reads the strength of a magnet. By detecting the magnet, we can send an interrupt to the arduino and initiate the stepper motors to steer the bogie.

However, the last year's team warned us about the arms of the steering not pressing limit switches on the bogie. The limit switches are there so the arms don't go too far and to check if the arms are properly engaged. Since the arms weren't always parallel to press the switch, the drive shaft used for one of the stepper motors continued turning, and eventually bent. Therefore, my partner and I decided we should add six more limit switches and code for the bogie to stop if the proper switches aren't pressed before switching.

Finally, my partner and I are researching motor driver ICs to replace some of the relays and H-bridges built by the previous team. This will decrease the size and wires of the electronics.

Next week, I will work on the code and testing the hall effect sensor more. In the near future, we will start testing the improved code with the motors, switches, and sensors.