Pillar movement was not smooth or reliable, and part of the problem was my code. Another factor was the hardware. One issue which I thought was the software turned out to be the magnet. I assumed the problem was that my magnet field was too large and it reset the segment counter to zero so often that it created a dead spot. To challenge this, I rewrote the homing routine so it would only recognize the home signal when the magnet sensor first saw the magnet, which was a wise choice but the size had another effect which triggered the switch twice at both extremes of its field. A smaller magnet, with the tip of its domain, barely reaching the sensor, fixed this and I ended up with a robust homing program.
Now that the homing routine was reliable, I made some more changes that would recognize the home position and keep spinning while counting the segments so I could determine how many black-white transitions existed on the encoder. This number was not consistent, so I would have to put in a stand-in number. After running the routine for a while, the number 96 came up the most often, and it was also the median number in the list.
I still wanted to make some kind of game, and I thought a Tetris-like game with a long narrow path might be fun. I already cobbled an arcade controller out of stuff in my apartment and a monitor riser from the surplus store. From my stock, I took another Arduino Pro Mini and connected it to the switches.
I managed to move a colored light from one LED to the next, and even jump the gap without trouble. At this point, I was not turning off lights when the pointer moved, but I proved it was possible to send relevant commands to the controller. No movement yet. At this point, I decided, for now anyway, that I did not want to spend my time making a game. Not even Tetris.
Since I had workable hardware, our team captain called a meeting where the goal was to get a Raspberry Pi talking to the central controller. One of my professional coworkers was a little disappointed that we got that working but nothing regarding gameplay. I was delighted that we got communication established.
Despite all the work on the homing routine and hardware, the pillar would spin erratically every two or three minutes. I figured this was a problem with the position data coming from the clock module, but when I looked at the raw data, it seemed all right. I tried a few things to make it run smoothly, and nothing hurt, but nothing helped either. It ran perfectly when I added another magnet to the homing magnets at the base. The problem seemed to arise when the pillar approached the home position, but the switch did not close, and the system kept seeing more segments than existed. A $0.02 magnet fixed the problem.
The rest of the summary posts have been arranged by date.
First time here?
Completed projects from year 1
Completed projects from year 2
Completed projects from year 3
Completed projects from year 4
Completed projects from year 5
Completed projects from year 6
Disclaimer for http://24hourengineer.blogspot.com and 24HourEngineer.com
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All information on this blog, or linked by this blog, is not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property, or similar, is the responsibility of those involved in the replication.
All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by Brian McEvoy, cannot be used to claim property or assets.
Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim property or assets based on their post.
This blog, including pictures and text, is copyright to Brian McEvoy.
Upgraded homing magnets
Now that the homing routine was reliable, I made some more changes that would recognize the home position and keep spinning while counting the segments so I could determine how many black-white transitions existed on the encoder. This number was not consistent, so I would have to put in a stand-in number. After running the routine for a while, the number 96 came up the most often, and it was also the median number in the list.
Getting an accurate count of the segments around the pillar
I still wanted to make some kind of game, and I thought a Tetris-like game with a long narrow path might be fun. I already cobbled an arcade controller out of stuff in my apartment and a monitor riser from the surplus store. From my stock, I took another Arduino Pro Mini and connected it to the switches.
Microcontroller inside an arcade controller
I managed to move a colored light from one LED to the next, and even jump the gap without trouble. At this point, I was not turning off lights when the pointer moved, but I proved it was possible to send relevant commands to the controller. No movement yet. At this point, I decided, for now anyway, that I did not want to spend my time making a game. Not even Tetris.
Controlling lights with an arcade joystick and buttons
Since I had workable hardware, our team captain called a meeting where the goal was to get a Raspberry Pi talking to the central controller. One of my professional coworkers was a little disappointed that we got that working but nothing regarding gameplay. I was delighted that we got communication established.
Team meeting
Despite all the work on the homing routine and hardware, the pillar would spin erratically every two or three minutes. I figured this was a problem with the position data coming from the clock module, but when I looked at the raw data, it seemed all right. I tried a few things to make it run smoothly, and nothing hurt, but nothing helped either. It ran perfectly when I added another magnet to the homing magnets at the base. The problem seemed to arise when the pillar approached the home position, but the switch did not close, and the system kept seeing more segments than existed. A $0.02 magnet fixed the problem.
Twenty-six-second video of the clock spinning
The rest of the summary posts have been arranged by date.
First time here?
Completed projects from year 1
Completed projects from year 2
Completed projects from year 3
Completed projects from year 4
Completed projects from year 5
Completed projects from year 6
Disclaimer for http://24hourengineer.blogspot.com and 24HourEngineer.com
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All information on this blog, or linked by this blog, is not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property, or similar, is the responsibility of those involved in the replication.
All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by Brian McEvoy, cannot be used to claim property or assets.
Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim property or assets based on their post.
This blog, including pictures and text, is copyright to Brian McEvoy.
Comments
Post a Comment