Hey Everyone~
While upgrading our network recently to support more computers over ethernet. I decided to buy a switch to extend our limited modem / router. Curiously it never worked at first and during a call to our ISP I was able to fix it while I was fiddling about (I told them how I fixed it but I doubt they will be suggesting the fix to others so I figured it would be helpful to post about it just in case).
For the life of me I can't imagine why this is a thing, but in the case of our modem which happens to be provided by our ISP; a Huwawei HG658 to be specific. The way I was able to get the switch to work was to plug it into the second port instead of the first. So if you happen to have the same problem (assuming this affects other modem / routers), just switch from LAN1 to any other port like LAN2 and it should work :)
Hope this helps people and if anyone knows the reason for this I would love to hear why!
Ashton.
Tuesday, July 16, 2019
Tuesday, April 9, 2013
Held back with no Good Reason
Hey Everyone,
You know when you have that moment where if you don't take a chance you could lose that moment forever? something you simply can't get back unless you had the convenience of a time machine? missing the last bus so to speak. Well there are many many things that we lose each day without any good reason due to a bizarre mentality from a bunch of callous, selfish and backwards people who can't seem to see what they have caused and continue to cause each day; they are their own enemy.
This mentality locks up knowledge that everyone should have the right to access without some kind of exuberant fee or VIP pass, knowledge like mathematics and many other fields that for some reason they don't want people to know, but them; possibly derived from an arrogant elitism: you can't copyright the laws that govern our universe and we would be far better off if such information was open to the public. Many, many things could be solved in our world if the right person sees the right information, at the right time and does something with it, it bothers me how many moments have been lost due to this keeping back of information and assuming that you need qualifications and a diploma to make a difference, how many diseases could have been cured and many lives saved or simply improved as a result if only the right mind was spurred with the right knowledge. Keeping it locked up only slows our development as a species and prevents creativity, involvement and competition to make our world a better place. Academics have lost their creativity and ability to think beyond the standard rules because they forget that the standards are simply a current approximation of known variables; it would be arrogant to think otherwise. What's worse is most of the people in control of the information are too close to the information to be able to think outside the square which happens to literally every field out there and they tend to forget this side effect of the human mind. There's a humming of potential just outside the doors, just open them and lets us in and watch the magic.
Some things that people might consider trivial are also effected, for example; they lock up games, music and movies, including many other things to the point of no recovery. The only reason we still have any today is due to a bunch of what should be hailed as heroes of the IT field; people who hack and crack DRM so that our cultural entertainment isn't lost to the void. Most companies bull**** this out of proportion; aka lie, in order to make them appear as the victims even though statistically the loss of money due to piracy is microscopic at best; usually only around a few percent or less and make substantial profit while destroying the image of a geographic who are saving our world from losing what we care about. These people are shunned for breaking the code and allowing us to enjoy our games and music again even though the companies have no desire to preserve them or to give us ownership of which we bought. The amount of talent and skill these people have is remarkable, they have so much experience within the IT field that any company would be foolish not to hire them, resulting in better software, better service to the user base. Everything simply improves including, ironically, the company's income.
Did you know that most people who pirate actually end up buying the products anyway? the irony is that piracy is one of the best forms of advertisement in the world but companies are too stubborn and arrogant to see it and prefer the more dishonest way while making enormous amounts of money in the process all the while making these amazingly talented people look bad.
The reason and cause behind the shoddy attempt to manhandle the internet, also known as SOPA and its continued remakes with just the name swapped for another acronym, was caused by these exact kinds of companies who only desire profit while not adapting to modern standards; they don't care about freedoms and are willing to sacrifice ours just so they can get an extra buck from the government or their own plans. What's worse is these people are living hypocrites who pirate software and music while trying to force a law against it, thanks to the Anonymous hackers we now know they did this. SOPA wasn't just for their agenda, it was also an excuse for the government to police society due to internal corruption which would violate any and all constitutional rights that many cultures have developed in developed areas; DRM for the internet basically. I can't even comprehend why these companies even try, all it shows is a clawing, desperate attempt to hold on because they seem completely incapable of adapting to the future and making money honestly while giving us quality products that we can hold and own ourselves.
DRM is completely and utterly useless, it costs thousands to maintain and all it does is cause suffering for many people as a result; even to the point of trying to take away our very freedoms which many many people had to fight off including myself; literally the internet fought back and showed how foolish the people are who tried to hold back society and how utterly ignorant they are of how the world is developing; the very thing they are meant to uphold and maintain the rights of.
Internet is one of those remarkable things that no one has the right to control; I can't even begin to formulate a sentence to describe just how important it is: literally as important as breathing air to be completely honest. It brings us together regardless of what language we speak or where we live; breaking the cultural barriers and destroying everything that is bad in society like racism, sexism, corruption etc. It give us a voice to speak out to the world and our governments without being pushed or shunned away, to share opinions and to find others like ourselves; it's fundamentally important to our way of life and for the future. It needs to become a freedom that everyone can enjoy without having to pay money, nothing is going to stop it and it's only going to get better and better and better.
Thanks for reading,
Ashton.
You know when you have that moment where if you don't take a chance you could lose that moment forever? something you simply can't get back unless you had the convenience of a time machine? missing the last bus so to speak. Well there are many many things that we lose each day without any good reason due to a bizarre mentality from a bunch of callous, selfish and backwards people who can't seem to see what they have caused and continue to cause each day; they are their own enemy.
This mentality locks up knowledge that everyone should have the right to access without some kind of exuberant fee or VIP pass, knowledge like mathematics and many other fields that for some reason they don't want people to know, but them; possibly derived from an arrogant elitism: you can't copyright the laws that govern our universe and we would be far better off if such information was open to the public. Many, many things could be solved in our world if the right person sees the right information, at the right time and does something with it, it bothers me how many moments have been lost due to this keeping back of information and assuming that you need qualifications and a diploma to make a difference, how many diseases could have been cured and many lives saved or simply improved as a result if only the right mind was spurred with the right knowledge. Keeping it locked up only slows our development as a species and prevents creativity, involvement and competition to make our world a better place. Academics have lost their creativity and ability to think beyond the standard rules because they forget that the standards are simply a current approximation of known variables; it would be arrogant to think otherwise. What's worse is most of the people in control of the information are too close to the information to be able to think outside the square which happens to literally every field out there and they tend to forget this side effect of the human mind. There's a humming of potential just outside the doors, just open them and lets us in and watch the magic.
Some things that people might consider trivial are also effected, for example; they lock up games, music and movies, including many other things to the point of no recovery. The only reason we still have any today is due to a bunch of what should be hailed as heroes of the IT field; people who hack and crack DRM so that our cultural entertainment isn't lost to the void. Most companies bull**** this out of proportion; aka lie, in order to make them appear as the victims even though statistically the loss of money due to piracy is microscopic at best; usually only around a few percent or less and make substantial profit while destroying the image of a geographic who are saving our world from losing what we care about. These people are shunned for breaking the code and allowing us to enjoy our games and music again even though the companies have no desire to preserve them or to give us ownership of which we bought. The amount of talent and skill these people have is remarkable, they have so much experience within the IT field that any company would be foolish not to hire them, resulting in better software, better service to the user base. Everything simply improves including, ironically, the company's income.
Did you know that most people who pirate actually end up buying the products anyway? the irony is that piracy is one of the best forms of advertisement in the world but companies are too stubborn and arrogant to see it and prefer the more dishonest way while making enormous amounts of money in the process all the while making these amazingly talented people look bad.
The reason and cause behind the shoddy attempt to manhandle the internet, also known as SOPA and its continued remakes with just the name swapped for another acronym, was caused by these exact kinds of companies who only desire profit while not adapting to modern standards; they don't care about freedoms and are willing to sacrifice ours just so they can get an extra buck from the government or their own plans. What's worse is these people are living hypocrites who pirate software and music while trying to force a law against it, thanks to the Anonymous hackers we now know they did this. SOPA wasn't just for their agenda, it was also an excuse for the government to police society due to internal corruption which would violate any and all constitutional rights that many cultures have developed in developed areas; DRM for the internet basically. I can't even comprehend why these companies even try, all it shows is a clawing, desperate attempt to hold on because they seem completely incapable of adapting to the future and making money honestly while giving us quality products that we can hold and own ourselves.
DRM is completely and utterly useless, it costs thousands to maintain and all it does is cause suffering for many people as a result; even to the point of trying to take away our very freedoms which many many people had to fight off including myself; literally the internet fought back and showed how foolish the people are who tried to hold back society and how utterly ignorant they are of how the world is developing; the very thing they are meant to uphold and maintain the rights of.
Internet is one of those remarkable things that no one has the right to control; I can't even begin to formulate a sentence to describe just how important it is: literally as important as breathing air to be completely honest. It brings us together regardless of what language we speak or where we live; breaking the cultural barriers and destroying everything that is bad in society like racism, sexism, corruption etc. It give us a voice to speak out to the world and our governments without being pushed or shunned away, to share opinions and to find others like ourselves; it's fundamentally important to our way of life and for the future. It needs to become a freedom that everyone can enjoy without having to pay money, nothing is going to stop it and it's only going to get better and better and better.
Thanks for reading,
Ashton.
Labels:
Analytical,
Arrogance,
Backwards,
Companies,
Corruption,
Creativity,
Curiosity,
DRM,
Education,
Fault,
Government,
Knowledge,
Lost,
Mathematics,
Philosophical,
Rant,
Science
Saturday, January 5, 2013
Repaired my Laptop's Power System Today
Hey Everyone,
There's nothing worse than a computer failure especially if the computer itself is fine but you can't recharge it and turn the thing on.
Recently my laptop stopped accepting energy from the power supply; lasted a good year and a half before this. It took a lot of fiddling to get the recharge light to turn on so I could use it but after a little while even that stopped working, I tried to De-oxidize the connection surface by cleaning it with some alcohol but even then it still didn't work.
There's nothing worse than a computer failure especially if the computer itself is fine but you can't recharge it and turn the thing on.
Recently my laptop stopped accepting energy from the power supply; lasted a good year and a half before this. It took a lot of fiddling to get the recharge light to turn on so I could use it but after a little while even that stopped working, I tried to De-oxidize the connection surface by cleaning it with some alcohol but even then it still didn't work.
When I was younger I had a tendency to take things apart; I was very curious of how things worked, sadly at that time of my life I had a habit of not putting things back together but thankfully I've learned better since then.
I decided that it was time to repair my laptop once and for all; by completely replacing the power connection inside, I had some spare electronics that was no longer of use that had a power socket which was compatible with a plug I had lying about so I De-soldered it from the board. It took a while to open up my laptop; finding all the hidden screws and storing them away safe so I could put everything back together eventually: I had actually opened my laptop a few times before this out of curiosity so I got pretty good at opening it this time. Once I had opened the laptop I unscrewed the power board and detached it, I aligned the new power socket up for comparison and it looked like it would fit inside perfectly so I began work on the power system. I detached the old socket and aligned the new one up, soldered it on and made sure everything looked ok.
Here you can see the new socket attached and the old one on the right:
After the new socket was successfully attached I discovered that one of the surface mounted components had disintegrated into powder under the heat of the soldering iron, it was just too close to the socket. I needed to know what I destroyed so I could repair it, I performed a continuity test and one side connected to positive and the other to ground which indicated to me that I had destroyed a small capacitor used for smoothing out the power coming in. I got out one of my 0.01uf micro farad capacitors albeit much larger than a tiny surface mounted one and attached it on the other side which had much easier to access connections that the ones the original component was using.
Once everything was soldered I double checked everything and placed the board back inside the laptop making sure to attach all the wires. I aligned it up and began to screw it back in place and thankfully it fit like a glove, here you can see it back where it belongs:
I hooked up the power supply to my new plug, it's one of those power supplies that support multiple connectors that attached to the end so I had to adapt my connection to it. I made absolutely sure that it would not break for a long time by layering heat shrink as these kinds of connectors have a tendency to break and bend otherwise. Here you can see what I came up with:
It worked! The charging light is lit and I have power again:
Sure beats the thought of buying a whole new laptop.
Thanks for reading,
Ashton.
Labels:
Analytical,
Broken,
Curiosity,
Electronics,
Fault,
Quickfix,
Repair,
Science,
Shrink,
Soldering
Wednesday, December 19, 2012
Orange Blue White
Hey Everyone,
Ever since I was a kid and sat in the back of the car as my parents would drive me about I simply loved looking out the window at the trees and the clouds in the sky, I also enjoyed night time when all the street lights were lit; mostly orange though some are white and I could have sworn I saw a green one. A fun little thing I discovered was If you look through the blue sun strip built into the glass at the top and watch the orange street lights through the glass, the moment an orange light would pass through the strip it would turn a shade of white.
I always found it fun and fascinating even though I understood at that age that the sun strip absorbed the orange light and what was left behind combined with the blue of the strip formed the white colour but it's small things like that that kept me thinking and helped me develop my analytical mind for the future. I always enjoy remembering the things that influenced me as a kid; no matter how subtle or what some might consider meaningless.
Thanks for reading,
Ashton.
Ever since I was a kid and sat in the back of the car as my parents would drive me about I simply loved looking out the window at the trees and the clouds in the sky, I also enjoyed night time when all the street lights were lit; mostly orange though some are white and I could have sworn I saw a green one. A fun little thing I discovered was If you look through the blue sun strip built into the glass at the top and watch the orange street lights through the glass, the moment an orange light would pass through the strip it would turn a shade of white.
I always found it fun and fascinating even though I understood at that age that the sun strip absorbed the orange light and what was left behind combined with the blue of the strip formed the white colour but it's small things like that that kept me thinking and helped me develop my analytical mind for the future. I always enjoy remembering the things that influenced me as a kid; no matter how subtle or what some might consider meaningless.
Thanks for reading,
Ashton.
Labels:
Absorption,
Analytical,
Car,
Curiosity,
Day,
Driving,
Fun,
Influential,
Light,
Night,
Philosophical,
Science
Repaired my Brother's Stereo Today
Hey Everyone,
I guess I'm kinda documenting what I've done here and there in my life on this blog; wasn't sure what I was going to end up posting here initially. One thing I enjoy doing is helping others with problems and doing everything within my ability to fix things before the unnecessary move to buy entire replacements which can cost quite a lot of money. I learn from each and every experience regardless if I fail; usually caused from over complex parts that are almost impossible to repair due to strange design choices to save money or overly complex moving pieces which I can't replace unless I had tools like a CNC or Laser printer to print new parts which cost easily within the thousands to tens of thousands of dollars.
Recently my Brother found that his stereo system wasn't allowing audio to reach the speakers after the head set was unplugged due to the headset mute feature and even when they were plugged in it required a lot of fiddling with the connector to get sound through the headset. I took an educated guess what the problem might be and headed outside with my tools and the stereo. After a few minutes I had the casing removed and examined the inside for damage or lose wires but I couldn't see anything wrong with it so I immediately went straight to where I thought the problem was; the stereo socket for connecting the headset. After carefully dismantling all the pieces that held the machine together and keeping the screws safe I finally reached the socket, I detached the circuit board it was attached to and immediately saw the problem; all the solder joints were visibly detached so it's no wonder why my Brother had such trouble getting it to behave.
Here you can see where the solder has shattered:
Stereo sockets can come with an optional extra connection that can be used as a switch to detect the presence of an attached plug from a headset which the machine uses to know when to mute the main speakers. Since the sense line was unattached the stereo system defaulted to assuming a headset was always attached; the switch inside would normally be connected until the plug is inserted causing a break in the connection, the fact that the solder was broken caused a permanent break so there was no way for the machine to know that the plug wasn't inserted anymore resulting in a permanent mute. As a fun side note to this you could attach your own switch to this sense line to create a custom mute feature and the option to have sound come through both the headset and speakers at the same time.
I got out my soldering iron, some spare solder and got to work replacing the solder joints with new solder making sure the socket had a nice and strong connection to the circuit board again. After I repaired the solder joints I partially put the machine back together just enough so I could make sure it worked before screwing everything back in and immediately I could hear sound coming through the speakers again. Turns out I was correct from the start and now my Brother can listen to music again; either through the headset or speakers without the need to waste money on a new stereo; at least for the time being.
Here's the end result of the circuit with a new set of solder:
Thanks for reading,
Ashton.
I guess I'm kinda documenting what I've done here and there in my life on this blog; wasn't sure what I was going to end up posting here initially. One thing I enjoy doing is helping others with problems and doing everything within my ability to fix things before the unnecessary move to buy entire replacements which can cost quite a lot of money. I learn from each and every experience regardless if I fail; usually caused from over complex parts that are almost impossible to repair due to strange design choices to save money or overly complex moving pieces which I can't replace unless I had tools like a CNC or Laser printer to print new parts which cost easily within the thousands to tens of thousands of dollars.
Recently my Brother found that his stereo system wasn't allowing audio to reach the speakers after the head set was unplugged due to the headset mute feature and even when they were plugged in it required a lot of fiddling with the connector to get sound through the headset. I took an educated guess what the problem might be and headed outside with my tools and the stereo. After a few minutes I had the casing removed and examined the inside for damage or lose wires but I couldn't see anything wrong with it so I immediately went straight to where I thought the problem was; the stereo socket for connecting the headset. After carefully dismantling all the pieces that held the machine together and keeping the screws safe I finally reached the socket, I detached the circuit board it was attached to and immediately saw the problem; all the solder joints were visibly detached so it's no wonder why my Brother had such trouble getting it to behave.
Here you can see where the solder has shattered:
Stereo sockets can come with an optional extra connection that can be used as a switch to detect the presence of an attached plug from a headset which the machine uses to know when to mute the main speakers. Since the sense line was unattached the stereo system defaulted to assuming a headset was always attached; the switch inside would normally be connected until the plug is inserted causing a break in the connection, the fact that the solder was broken caused a permanent break so there was no way for the machine to know that the plug wasn't inserted anymore resulting in a permanent mute. As a fun side note to this you could attach your own switch to this sense line to create a custom mute feature and the option to have sound come through both the headset and speakers at the same time.
I got out my soldering iron, some spare solder and got to work replacing the solder joints with new solder making sure the socket had a nice and strong connection to the circuit board again. After I repaired the solder joints I partially put the machine back together just enough so I could make sure it worked before screwing everything back in and immediately I could hear sound coming through the speakers again. Turns out I was correct from the start and now my Brother can listen to music again; either through the headset or speakers without the need to waste money on a new stereo; at least for the time being.
Here's the end result of the circuit with a new set of solder:
Thanks for reading,
Ashton.
Tuesday, December 18, 2012
Creativity at the Most Inappropriate Time
Hey Everyone,
This is just something I experience but wanted to share with other people who may not be aware of this.
I never knew that this was a semi-well known thing since it was something I discovered on my own; but there is a curious time just before you go to sleep when your really tired; it's almost like the brain can dedicate all its energy into one specific task, the task in question is raw creativity; the ability to imagine. This might also be related to the hyper active thinking which can lead some people to insomnia before sleep when you just can't stop thinking of stuff. I actually found an article recently that from memory said "Back during the ancient period of our species we didn't have much up time; the bed was regarded as an important location (which I take to heart since I love sleeping too) they noticed this phenomenon and called it the hour of creativity / imagination." At the time of writing I can't find that article so I'm most likely miss-quoting. There's a few articles out their that associate sleep with increased cognitive flexibility due to the way relational memories are integrated into your long term memory during REM sleep but that's related to unconsciousness whilst my post is a complementary to that in the conscious state.
Interestingly enough I would have guessed the imagination centre of the brain took a lot of brain power, probably from that fact that you can imagine pretty much anything and gives off the illusion that it is taxing on the brain but from further evaluation I've realized that it actually takes extremely little, either that or the pathways of the brain that allow you to imagine are easy for the brain to access without additional energy which is why it's all you are left with before sleep. Pretty much any additionally complex part of your brain's abilities besides seeing, smelling, touching and hearing takes a lot of effort to re-enable like trying to budge a heavy door to open with rusted hinges. When I am within this zone I'm so tired I could just drop at any moment but amazingly I can imagine things much clearer; with higher vibrancy and detail etc without much effort at all like a movie that I can direct. Things just flow so naturally that I use it whenever I can to improve the stories I write as well as refine things I've been working on.
So the next time you are at that stage where you just want to lay down and sleep the night away; no need to worry about falling asleep during this moment: just lay there and have a go at day dreaming, thinking about your art if your the artist type? or perhaps the story you've been writing? your current musical composition? what ever you want and see if it flows easier for you too. I can only speak from experience so this may not work for everyone but have a go just in case as it's an opportunity one shouldn't miss, you might be pleasantly surprised. Just remember to leave a notepad with writing equipment nearby or your ideas might keep you up all night.
Ironically it comes at the most inappropriate time, go figure.
Thanks for reading,
Ashton.
This is just something I experience but wanted to share with other people who may not be aware of this.
I never knew that this was a semi-well known thing since it was something I discovered on my own; but there is a curious time just before you go to sleep when your really tired; it's almost like the brain can dedicate all its energy into one specific task, the task in question is raw creativity; the ability to imagine. This might also be related to the hyper active thinking which can lead some people to insomnia before sleep when you just can't stop thinking of stuff. I actually found an article recently that from memory said "Back during the ancient period of our species we didn't have much up time; the bed was regarded as an important location (which I take to heart since I love sleeping too) they noticed this phenomenon and called it the hour of creativity / imagination." At the time of writing I can't find that article so I'm most likely miss-quoting. There's a few articles out their that associate sleep with increased cognitive flexibility due to the way relational memories are integrated into your long term memory during REM sleep but that's related to unconsciousness whilst my post is a complementary to that in the conscious state.
Interestingly enough I would have guessed the imagination centre of the brain took a lot of brain power, probably from that fact that you can imagine pretty much anything and gives off the illusion that it is taxing on the brain but from further evaluation I've realized that it actually takes extremely little, either that or the pathways of the brain that allow you to imagine are easy for the brain to access without additional energy which is why it's all you are left with before sleep. Pretty much any additionally complex part of your brain's abilities besides seeing, smelling, touching and hearing takes a lot of effort to re-enable like trying to budge a heavy door to open with rusted hinges. When I am within this zone I'm so tired I could just drop at any moment but amazingly I can imagine things much clearer; with higher vibrancy and detail etc without much effort at all like a movie that I can direct. Things just flow so naturally that I use it whenever I can to improve the stories I write as well as refine things I've been working on.
So the next time you are at that stage where you just want to lay down and sleep the night away; no need to worry about falling asleep during this moment: just lay there and have a go at day dreaming, thinking about your art if your the artist type? or perhaps the story you've been writing? your current musical composition? what ever you want and see if it flows easier for you too. I can only speak from experience so this may not work for everyone but have a go just in case as it's an opportunity one shouldn't miss, you might be pleasantly surprised. Just remember to leave a notepad with writing equipment nearby or your ideas might keep you up all night.
Ironically it comes at the most inappropriate time, go figure.
Thanks for reading,
Ashton.
Saturday, November 3, 2012
Repaired the Dishwasher Today
Hey Everyone,
One of the things I like to do around the house when something breaks is make absolutely sure that the thing that breaks can be fixed before writing it off for scrap and spare parts. Today I found all the cutlery and plastic in the dishwasher bent, burned and pretty much destroyed. I thought about how that could have happened knowing that it couldn't have been an acid from the dishwasher powder since plastic is immune to it so the only thing it could have been was heat.
I took out everything including the sliding draws so I could perform a test run. After a little while I noticed the distinctive sound that I always heard was gone; the loud grumbling noise indicative of the pump below. I opened the door after a minute and the heating element at the bottom was red hot but not a scrap of water was shooting about to cool it so something had stopped the pump from working.
It took a little time to disconnect it from the water and power before pulling it out from under the kitchen bench so I could examine it in detail but once I had it out I could get to work. I removed the front panel and examined every part of the circuit looking for burned out components or some sign of what had happened to it. The relays had a little singe but that was to be expected since the machine was 10 years old and I knew they were working as I tested the machine again with the relays visible. I took the circuit diagram, traced it to the main pump and found it connected to the second relay on line L1. I followed the wires and found one of them had snapped due to being unnecessarily tight against the corner of the metal frame; all the other wires seemed fine and not under stress, I grabbed my heat shrink, soldering iron etc and set to work.
I reconnected the wires back together making sure to heat shrink both sides and ran another test, this time I reconnected the water and the pump started up just like it had for the last decade. When I opened the door it shot water at me and drenched me completely; guess I had the water turned up too high.
After re-attaching everything back to the frame I slid it back under the kitchen bench and screwed it back in to the wooden frame. I added a few more screws here and there for good measure and in just a couple of hours I had a working dishwasher again and saved a lot of money too which is always nice. :)
Thanks for reading,
Ashton.
One of the things I like to do around the house when something breaks is make absolutely sure that the thing that breaks can be fixed before writing it off for scrap and spare parts. Today I found all the cutlery and plastic in the dishwasher bent, burned and pretty much destroyed. I thought about how that could have happened knowing that it couldn't have been an acid from the dishwasher powder since plastic is immune to it so the only thing it could have been was heat.
I took out everything including the sliding draws so I could perform a test run. After a little while I noticed the distinctive sound that I always heard was gone; the loud grumbling noise indicative of the pump below. I opened the door after a minute and the heating element at the bottom was red hot but not a scrap of water was shooting about to cool it so something had stopped the pump from working.
It took a little time to disconnect it from the water and power before pulling it out from under the kitchen bench so I could examine it in detail but once I had it out I could get to work. I removed the front panel and examined every part of the circuit looking for burned out components or some sign of what had happened to it. The relays had a little singe but that was to be expected since the machine was 10 years old and I knew they were working as I tested the machine again with the relays visible. I took the circuit diagram, traced it to the main pump and found it connected to the second relay on line L1. I followed the wires and found one of them had snapped due to being unnecessarily tight against the corner of the metal frame; all the other wires seemed fine and not under stress, I grabbed my heat shrink, soldering iron etc and set to work.
I reconnected the wires back together making sure to heat shrink both sides and ran another test, this time I reconnected the water and the pump started up just like it had for the last decade. When I opened the door it shot water at me and drenched me completely; guess I had the water turned up too high.
After re-attaching everything back to the frame I slid it back under the kitchen bench and screwed it back in to the wooden frame. I added a few more screws here and there for good measure and in just a couple of hours I had a working dishwasher again and saved a lot of money too which is always nice. :)
Thanks for reading,
Ashton.
Tuesday, August 14, 2012
Dodgy Vergola Motor
Hey Everyone,
My family got a vergola built to cover our deck out the back, it came with a remote controlled 12v motor which after about half a year or so it began to stuff up and could no longer open the cover. Since I'm quite handy around the house I decided to have a go at repairing the motor to save on spending ridiculous amounts of money to get it replaced. I opened it up and it was full of rust water so I took everything out, cleaned it all up and screwed it all back together. It seemed to work again so I applied a skin of silicone around all the outside of the case to prevent any further water making its way in. It worked well for a month or so but ended up breaking again, I took it apart to see what had happened and the silicone did the job of keeping out the water so I knew it had to be a flaw in the design. I allowed the gears to function while the case was open so I could see what was going on, the arm was attached to a worm gear that allowed the small 12v motor to apply enough torque to open an entire vergola with a small gear box to slow the ratio down. In the back of my mind I kind of knew what must have been happening so I applied the idea in practice; I thought about the worm gear pulling the arm as far back as possible while I examined the structure of the plastic, something just wasn't right to me. I allowed it to pull back and the moment it touched the plastic that stopped it, it would jam which I had imagined was happening in my mind. Since I had a dremel handy I got myself a thickish metallic washer to act as a more solid buffer and cut a section out of it for the worm gear shaft to fit, I placed it up against the end with superglue to prevent the worm gear from pressing the arm too close to the plastic and allow a small air gap, I put everything back together and added a new skin of silicone to make it water proof which I'm still shaking my head about since it's designed to work outdoors and at that kind of price? these companies that skimp on waterproofing disgust me to be honest; nothing that's made these days have any quality and the only real way to obtain quality is to either make your own or fix what you already have, it's just disgraceful. To this very day it has worked without a hitch thanks to the simple modification I made and my family can now enjoy the sunlight on the deck without wasting a single buck.
Thanks for reading,
Ashton.
My family got a vergola built to cover our deck out the back, it came with a remote controlled 12v motor which after about half a year or so it began to stuff up and could no longer open the cover. Since I'm quite handy around the house I decided to have a go at repairing the motor to save on spending ridiculous amounts of money to get it replaced. I opened it up and it was full of rust water so I took everything out, cleaned it all up and screwed it all back together. It seemed to work again so I applied a skin of silicone around all the outside of the case to prevent any further water making its way in. It worked well for a month or so but ended up breaking again, I took it apart to see what had happened and the silicone did the job of keeping out the water so I knew it had to be a flaw in the design. I allowed the gears to function while the case was open so I could see what was going on, the arm was attached to a worm gear that allowed the small 12v motor to apply enough torque to open an entire vergola with a small gear box to slow the ratio down. In the back of my mind I kind of knew what must have been happening so I applied the idea in practice; I thought about the worm gear pulling the arm as far back as possible while I examined the structure of the plastic, something just wasn't right to me. I allowed it to pull back and the moment it touched the plastic that stopped it, it would jam which I had imagined was happening in my mind. Since I had a dremel handy I got myself a thickish metallic washer to act as a more solid buffer and cut a section out of it for the worm gear shaft to fit, I placed it up against the end with superglue to prevent the worm gear from pressing the arm too close to the plastic and allow a small air gap, I put everything back together and added a new skin of silicone to make it water proof which I'm still shaking my head about since it's designed to work outdoors and at that kind of price? these companies that skimp on waterproofing disgust me to be honest; nothing that's made these days have any quality and the only real way to obtain quality is to either make your own or fix what you already have, it's just disgraceful. To this very day it has worked without a hitch thanks to the simple modification I made and my family can now enjoy the sunlight on the deck without wasting a single buck.
Thanks for reading,
Ashton.
Wednesday, July 4, 2012
Tutorial - ArduinoISP Duemilanove with Optiboot
Hey everyone,
This will be technically a few tutorials in one as I intend to not only teach you how to interface two Arduino's together for In-System-Programming but also how to upgrade and change the firmware built in (so it will probably turn out much longer than my Dosbox VGA Tutorial). This method does require a second Arduino board to act as our ISP Programmer but there is another method called Bit-Banging where you connect the 4 pins called the X3 header on the Duemilanove, usually located next to the FTDI chip and hook them to the ICSP pins on the same Arduino, since I won't be using that method in this tutorial feel free to check out this tutorial instead if you only have a single Arduino on hand. I may append the Bit-Bang method to this tutorial or make a new one in the future now that I have the necessary connectors on hand to do it but for now the link will suffice.
I remember reading somewhere on the internet about the overhead of having a boot-loader on your Arduino vs direct upload of a compiled program. The convenience of a boot loader is that it allows you to upload sketches to your Arduino using a USB serial interface while the only down side is less memory for your uploaded project due to the memory requirements of the boot-loader and a delayed start up time for the Arduino. The newer version of the Arduino called UNO comes with a much smaller and faster boot-loader called Optiboot which gives back around 1.5kb's of memory for your projects. Later on I'll teach you how to upgrade your older Diecimila or Duemilanove with this new boot-loader.
The First Part of this tutorial is to teach you how to connect an Arduino to another Arduino by using the In-System-Programming method or ISP for short. One of the Arduino's will be your programmer while the other is the slave that you will be modifying the firmware on. When I first learned how to do this I was using my Arduino Mega 1280 to reprogram my Arduino Duemilanove to both upload raw sketches without a boot loader as well as successfully install the Optiboot loader. After I had worked out all the kinks and solved some problems I decided that it might be beneficial to share my experience and teach others how to use this method too. At first I just had floating wires everywhere connecting the two together but I spent a good afternoon constructing a proper cable that is much more stable for connecting them which you can see here:
For the time being you can simply connect everything with wires for this tutorial but feel free to use hook up wires with pins if you have any or even make your own cable. I didn't have any header pins available when I made this so I just used pieces of solid wire I cut from a spool which needed a little sanding to remove the outer cover since solder wasn't sticking to it. Depending on what Arduino you use changes which pins we will be using to connect the programmer to your slave board. The 4 main pins that we will be using are listed here:
If your chosen programmer board is a Diecimila or Duemilanove then connect the wires like this: Connect Pin 10 of the programmer to the reset pin of your slave, connect Pin 11 to Pin 11 of your slave, connect Pin 12 to Pin 12 on your slave and then lastly connect Pin 13 to Pin 13 on your slave.
If your chosen programmer board is an Arduino Mega then connect the wires like this: Connect pin 53 to the reset pin of your slave, connect Pin 52 to Pin 13 of your slave, connect Pin 51 to Pin 11 of your slave and lastly connect Pin 50 to Pin 12 of your slave.
What we have done is connect the two boards together using the Serial Peripheral Interface (SPI). Since only the programmer will be connected to the computer we will need to make sure your slave has access to power as well. To do this simply connect a wire from the 5v pin of your programmer's power rail to your slave's 5v pin and another wire connecting your programmer's Ground pin to your slave's Ground pin.
The Second Part will involve uploading a project called ArduinoISP (which comes with the Arduino software) to your programmer board which will allow us to reprogram another board connected through the SPI system. First you'll need to make sure you have installed the programming IDE for Arduino which you can download from here. Simply choose the correct version for the operating system you have then download and install it. Once it's installed open up the program and on the top menu click File, then mouse over Examples and finally click on the ArduinoISP project which will open up an instance of the code. Now attach your desired programmer board to the computer, click on Tools and open up boards, select the board you wish to use as your programmer; in my case I chose "Arduino Mega (ATmega1280)". Go back to tools and select the Port your programmer is attached to. Finally you can click the upload button at the top that looks like an arrow pointing right which will upload the ArduinoISP project onto your programmer.
Now you might have noticed that I have an LED display on my cable. This is related to the ArduinoISP software which uses Pin 7 to indicate that it's programming, Pin 8 to report any errors and Pin 9 which is the heartbeat that pulses to indicate that everything is good; this information can be found in the top comments section of the project code. Feel free to add these LED's to your setup so that you can know when things are working properly or have failed somewhere. If you are new to connecting LED's to Arduino's then I recommend this great tutorial by Lady Ada.
Awesome, now that we have your programmer board all set up and connected to the slave board that we wish to reprogram, we now need a way of uploading your new boot-loader to it. A good way of testing your programmer board is to burn the default boot-loader onto your slave board. To do this, make sure that the programmer is attached to your computer and that both boards have power. Open up the Arduino programming IDE that we recently installed, then under the Tools select the board that is your slave; in my case I selected "Arduino Duemilanove /w ATmega328". Then in the Tools menu go to Programmer, then select "Arduino as ISP", once that's selected go back to Tools and click on "Burn Bootloader" and you should see your programmer board upload the boot-loader to your slave board with the default blink sketch blinking the led on Pin 13; just like when you first bought the board from a reseller.
Alright, now that we can upload to your slave board successfully using your programmer there's lot of things we can try out. I'll show you how to upload your sketches without the need for a boot-loader as well as upgrading your older Arduino's with the latest Optiboot loader. To do this we will be using a program called AVRDude which comes with WinAVR. You can download the latest version from its source forge page here then install it. WinAVR's installer will register the AVRDude executable with Windows so it can be accessed via command prompt. You can access the command prompt in Windows a myriad of ways. I usually just press the Windows key and type "cmd" or "powershell" and hit enter in Windows 7 but for this tutorial I'll be using the power-shell as my preferred terminal. Alternatively you can open the command prompt via the start menu and click on run, then type "cmd" or "powershell" and hit enter. You can even shift + right click in any folder or on the desktop then click the new "Open command window here" option that appears. Once you have your terminal open type "avrdude" and hit enter, you should see a list of available options listed like I show here:
Command terminals on Windows default the starting location to the user's folder unless you used the "Open command window here" method which will inherit the folder you right clicked in. If this is the case then simply type "cd.." and hit enter, do this again and again until you are at the root drive and only see "C:\" in the command window. Here's an example:
This is simply to make uploading a Hex file to your board much easier since you would need to specify the directory that contains your file in full for AVRDude. Feel free to use a folder structure though if you prefer but since your project files are so small it's easy to use the root drive as a temporary folder for uploading. Hex files are the end result of a compile with the Arduino IDE and are encoded in Intel assembly; to learn more about the Arduino build process you can check out this link. In older versions of the IDE you could find the Hex file in your project's directory but the later versions now store the compiled code temporarily in the Windows temp folder which is hidden from the user by default located here:
This folder is specific to which operating system you are using, in my case I have Windows 7 but if you have a different OS then you can find where the IDE compiles to by initialising verbosity mode. Go to the top menu and click File then Preferences and in the preferences window you should see "Show verbose output during:". Select compile or both if you prefer then hit ok. Now when you click the Verify button you should see where the IDE is compiling the code to.
Lets prepare a project to upload to your slave board without a boot-loader installed. I like the blink project as it give you feedback of a successful upload via the blinking LED. With the Arduino IDE open, go to the top menu and click on "File" then go to Examples/01.Basics and click on Blink. You should now have a Blink project open, since we need the code compiled into a Hex file but we don't want the code uploaded to the board just yet, you can click on the Verify button (looks like a tick) which will compile your code and check for errors but it won't upload the code to the board which can be very useful. While the IDE is open and you have compiled your code, the Hex file can be found in the Temp folder I showed previously; projects in this folder usually start with the name "build" with a series of unique numbers like this "build1544573883262332201.tmp" and inside this folder will be your Hex file and in my case it was called "Blink.cpp.hex". Remember that your Hex file will usually be deleted the moment you close the IDE along with the temporary folder so it's best to find your Hex file and copy / paste it into your C:\ drive for uploading, feel free to rename it to whatever you like; for example: "Blink.hex".
Before we begin the upload, if you are worried about the fact that we will no longer have a boot-loader on the board, remember that you always have the "Burn Bootloader" option at your disposal in the Arduino IDE under Tools; this uploads the default boot-loader that comes with the board you have selected as your slave. Additionally if you go back to the default boot-loader and wish to upload projects to it like normal without a programming board, remember to change the IDE's programmer under Tools back to "AVRISP_II" and set the Board and Serial Port respectfully for the board you plan to upload to.
Alright, now that we have successfully compiled a project and have our Hex file ready to go I can now teach you how to use AVRDude to upload it to your slave board. There's a number of parameters that we will need to pass to AVRDude in order to upload our sketch to the board, this will include the method we are using to upload with, the baud rate, what chip we are programming and where the sketch will be stored etc. Make sure you have a command prompt open and set to your C:\ drive like I showed above.
The First Parameter will be our uploading method; there's numerous options which you can see a full list of if you type "avrdude -c randomtext" since random text isn't an available option, AVRDude will list all the possible upload methods supported. Take note of the last option in the list called "Arduino" which means that an Arduino would be used for our programming method which is perfect for us since we are using one as an ISP programmer. Now that we know which programmer to use, lets move on to the next parameter.
The Second Parameter will be the chip we plan to upload to, if you type "avrdude -c arduino" and hit enter, AVRDude will display a list of supported micro controllers which can be specified with "-p" and then the name of the chip we are programming. If you are unsure of the chip on your board you can check out the Hardware page for your board at the Arduino website which will show the technical specifications that indicates what chip is used. In my case I was using an Arduino Duemilanove with an ATmega328 chip so I would choose "m328p" from the list.
The Third Parameter will be the name of our port that the Arduino programmer is attached to. The best way I find to work this out is to simply reference where the Arduino IDE says in "Tools/Serial Port". Alternatively you can go to your Device Manager and under "Ports (COM & LPT)" you should see a device listed with the port that it uses. You can pass a port to AVRDude by using the "-P" command and typing the port's name after that; in my case it was "-P com3".
The Fourth Parameter will be our desired baud rate which is how fast we will be sending data to our programmer. Since we are going to be using the ISP system we must use "19200" as our overriding baud rate which you can pass to AVRDude with the "-b" command. If this command is not passed you may receive issues with syncing the programmer board.
The Fifth Parameter will specify where in the micro controller's memory that the sketch will be uploaded to; in this case we will be using flash, additionally we will also specify that we wish to write to the memory which is specified with "w" between the colons. You use the "-U" command and then pass "flash:w:" then write the name of your Hex file "Blink.hex", in my case I wrote "-U flash:w:Blink.hex".
Once you've typed that in, hit enter and if everything goes well, you should see AVRDude uploading the Hex file to the board and verifying that everything was uploaded correctly as you can see here:
And now you should see your Arduino slave board blinking away, since there's no longer a boot loader on the Arduino if you reset the board you'll noticed almost no delay before the code starts again which can be extremely useful for projects that need as much up time as possible during self resets. Another useful feature of not using a boot-loader is that you have a lot more room for large sketches / projects.
You should now have an Arduino Duemilanove with the latest Optiboot loader installed :) please note that this new boot-loader has a faster upload allowance and that you won't be able to upload your code using the Arduino IDE with Duemilanove set as your board. Additionally you shouldn't worry if the light is not blinking this time since the new boot-loader doesn't come with it by default. Duemilanoves use "57600" as their baud rate while the Optiboot loader uses "115200" which is two times faster so if you tried uploading sketches the normal way to your new board you'd receive a sync error. Since the Arduino UNO has the exact same chip and parameters as the Duemilanove, you can use the UNO as your uploading board. If you wish to learn more about how you could create a custom board definition for an Arduino Duemilanove with Optiboot then feel free to continue reading my bonus tutorial which will not only show you how to create a custom board but also introduce you to what fuses are all about.
Since we have physically changed the boot-loader that was once on our Arduino to the new Optiboot that comes with Arduino Uno I thought it might be nice to show you how to add a custom board to the Arduino IDE that can represent an Arduino Duemilanove with Optiboot and allow uploading sketches.
To make a custom board that we can use with our new board, we'll need to modify the "boards.txt" file inside the "hardware\arduino" folder. Since the encoding of the file is extended beyond basic ASCII we will need a proper binary editor; Notepad won't be able to format the text correctly. The one I like to use is called Context which you can download here. There's also an editor called Notepad++ that should work. There are lots of editors out there so feel free to choose the one you like best.
Once you have installed an editor, open the "boards.txt" file inside it and you should see all the definitions of the boards currently supported by the Arduino IDE. We will be extending this list with a custom board definition that you can see here:
Place this between the "Arduino Uno" definition and the "Arduino Duemilanove w/ ATmega328" one. As you can see there's a few differences from the original Duemilanove definition; there's a larger "maximum_size" that takes into account the new memory given back by the smaller bootloader and the baud rate has been doubled to support our new board for uploading. Additionally for those who are curious, the "bootloader.file=optiboot_atmega328.hex" line is actually what the IDE will consider the default boot-loader to upload to your board if you click the "Burn Bootloader" button while the "bootloader.path" specifies what folder inside the "hardware\arduino\bootloaders" folder that the Hex file exists in.
The name before every line must be unique from every other definition or it will not show up in the Arduino IDE. Since the definition for the original Duemilanove was "atmega328" I decided to call the new one "Duemilanove". If you close all instances of the Arduino IDE and re-open it you'll find the new board definition available which you can use to burn sketches to your hearts content. Just remember to change the programmer back to "AVRISP_II" since we won't need the programmer board now that we have a boot-loader.
Fuses are a bit of a misnomer since they don't have anything to do with protecting against power surges etc. In the microprocessor world fuses are simply switches that can be turned on and off to specify how the board should act. The fuses are non-volatile and will remain set even if you erase the board since they have their own flash memory that they are stored in. A word of caution though, you can damage your arduino beyond repair if these are set incorrectly and won't be able to reprogram it using ISP. The only way to recover a damaged chip is to use a high voltage programmer; here's a good example that's compatible with Arduinos.
Fuses are stored as hex values which if converted to binary will show you which switches are turned on and off. Each letter of the Hex value represents 4 bits and since we have two letters that's 8 bits in total or one byte. I'll give an example of the "0xDE" high fuse value of our board definition:
To make life easier we can use a fuse calculator to derive the needed Hex values. The one I like to use is here. Simply choose the chip that you are programming; in my case it's "ATmega328P" then click select. You should see the interface expand showing the default settings that the chip has as a factory default. Further down the screen you can find the Hex values in the "Current Settings" area. Any changes you make to the above settings will change the Hex values appropriately. Never set "Reset Disabled" or "Disable ISP" to true unless you know what you are doing since you won't be able to reprogram the chip using the In-System-Programming method. If you accidentally did this and can no longer reprogram the chip just remember to get yourself or make a high voltage programmer: a good example of one can be found here and here. This calculator website kindly displays the commands needed to set the fuses of your board using AVRDude just to the right of the "Current Settings" area:
Thanks for reading,
Ashton.
This will be technically a few tutorials in one as I intend to not only teach you how to interface two Arduino's together for In-System-Programming but also how to upgrade and change the firmware built in (so it will probably turn out much longer than my Dosbox VGA Tutorial). This method does require a second Arduino board to act as our ISP Programmer but there is another method called Bit-Banging where you connect the 4 pins called the X3 header on the Duemilanove, usually located next to the FTDI chip and hook them to the ICSP pins on the same Arduino, since I won't be using that method in this tutorial feel free to check out this tutorial instead if you only have a single Arduino on hand. I may append the Bit-Bang method to this tutorial or make a new one in the future now that I have the necessary connectors on hand to do it but for now the link will suffice.
I remember reading somewhere on the internet about the overhead of having a boot-loader on your Arduino vs direct upload of a compiled program. The convenience of a boot loader is that it allows you to upload sketches to your Arduino using a USB serial interface while the only down side is less memory for your uploaded project due to the memory requirements of the boot-loader and a delayed start up time for the Arduino. The newer version of the Arduino called UNO comes with a much smaller and faster boot-loader called Optiboot which gives back around 1.5kb's of memory for your projects. Later on I'll teach you how to upgrade your older Diecimila or Duemilanove with this new boot-loader.
The First Part of this tutorial is to teach you how to connect an Arduino to another Arduino by using the In-System-Programming method or ISP for short. One of the Arduino's will be your programmer while the other is the slave that you will be modifying the firmware on. When I first learned how to do this I was using my Arduino Mega 1280 to reprogram my Arduino Duemilanove to both upload raw sketches without a boot loader as well as successfully install the Optiboot loader. After I had worked out all the kinks and solved some problems I decided that it might be beneficial to share my experience and teach others how to use this method too. At first I just had floating wires everywhere connecting the two together but I spent a good afternoon constructing a proper cable that is much more stable for connecting them which you can see here:
Master-In-Slave-Out (MISO) = Pin 12 on Duemilanove and Pin 50 for Mega
Master-Out-Slave-In (MOSI) = Pin 11 on Duemilanove and Pin 51 for Mega
Serial Clock (SCK) = Pin 13 on Duemilanove and Pin 52 for Mega
Slave Select (SS) = Pin 10 on Duemilanove and Pin 53 for Mega
If your chosen programmer board is a Diecimila or Duemilanove then connect the wires like this: Connect Pin 10 of the programmer to the reset pin of your slave, connect Pin 11 to Pin 11 of your slave, connect Pin 12 to Pin 12 on your slave and then lastly connect Pin 13 to Pin 13 on your slave.
If your chosen programmer board is an Arduino Mega then connect the wires like this: Connect pin 53 to the reset pin of your slave, connect Pin 52 to Pin 13 of your slave, connect Pin 51 to Pin 11 of your slave and lastly connect Pin 50 to Pin 12 of your slave.
Feel free to check out this link if you need more help connecting them.
What we have done is connect the two boards together using the Serial Peripheral Interface (SPI). Since only the programmer will be connected to the computer we will need to make sure your slave has access to power as well. To do this simply connect a wire from the 5v pin of your programmer's power rail to your slave's 5v pin and another wire connecting your programmer's Ground pin to your slave's Ground pin.
Technically you could program any number of different Arduinos with this system; just look up the hardware page and find the 4 pins needed for SPI interfacing.
The Second Part will involve uploading a project called ArduinoISP (which comes with the Arduino software) to your programmer board which will allow us to reprogram another board connected through the SPI system. First you'll need to make sure you have installed the programming IDE for Arduino which you can download from here. Simply choose the correct version for the operating system you have then download and install it. Once it's installed open up the program and on the top menu click File, then mouse over Examples and finally click on the ArduinoISP project which will open up an instance of the code. Now attach your desired programmer board to the computer, click on Tools and open up boards, select the board you wish to use as your programmer; in my case I chose "Arduino Mega (ATmega1280)". Go back to tools and select the Port your programmer is attached to. Finally you can click the upload button at the top that looks like an arrow pointing right which will upload the ArduinoISP project onto your programmer.
Now you might have noticed that I have an LED display on my cable. This is related to the ArduinoISP software which uses Pin 7 to indicate that it's programming, Pin 8 to report any errors and Pin 9 which is the heartbeat that pulses to indicate that everything is good; this information can be found in the top comments section of the project code. Feel free to add these LED's to your setup so that you can know when things are working properly or have failed somewhere. If you are new to connecting LED's to Arduino's then I recommend this great tutorial by Lady Ada.
Awesome, now that we have your programmer board all set up and connected to the slave board that we wish to reprogram, we now need a way of uploading your new boot-loader to it. A good way of testing your programmer board is to burn the default boot-loader onto your slave board. To do this, make sure that the programmer is attached to your computer and that both boards have power. Open up the Arduino programming IDE that we recently installed, then under the Tools select the board that is your slave; in my case I selected "Arduino Duemilanove /w ATmega328". Then in the Tools menu go to Programmer, then select "Arduino as ISP", once that's selected go back to Tools and click on "Burn Bootloader" and you should see your programmer board upload the boot-loader to your slave board with the default blink sketch blinking the led on Pin 13; just like when you first bought the board from a reseller.
Alright, now that we can upload to your slave board successfully using your programmer there's lot of things we can try out. I'll show you how to upload your sketches without the need for a boot-loader as well as upgrading your older Arduino's with the latest Optiboot loader. To do this we will be using a program called AVRDude which comes with WinAVR. You can download the latest version from its source forge page here then install it. WinAVR's installer will register the AVRDude executable with Windows so it can be accessed via command prompt. You can access the command prompt in Windows a myriad of ways. I usually just press the Windows key and type "cmd" or "powershell" and hit enter in Windows 7 but for this tutorial I'll be using the power-shell as my preferred terminal. Alternatively you can open the command prompt via the start menu and click on run, then type "cmd" or "powershell" and hit enter. You can even shift + right click in any folder or on the desktop then click the new "Open command window here" option that appears. Once you have your terminal open type "avrdude" and hit enter, you should see a list of available options listed like I show here:
This is simply to make uploading a Hex file to your board much easier since you would need to specify the directory that contains your file in full for AVRDude. Feel free to use a folder structure though if you prefer but since your project files are so small it's easy to use the root drive as a temporary folder for uploading. Hex files are the end result of a compile with the Arduino IDE and are encoded in Intel assembly; to learn more about the Arduino build process you can check out this link. In older versions of the IDE you could find the Hex file in your project's directory but the later versions now store the compiled code temporarily in the Windows temp folder which is hidden from the user by default located here:
C:\Users\USER_NAME_HERE\AppData\Local\Temp
This folder is specific to which operating system you are using, in my case I have Windows 7 but if you have a different OS then you can find where the IDE compiles to by initialising verbosity mode. Go to the top menu and click File then Preferences and in the preferences window you should see "Show verbose output during:". Select compile or both if you prefer then hit ok. Now when you click the Verify button you should see where the IDE is compiling the code to.
Lets prepare a project to upload to your slave board without a boot-loader installed. I like the blink project as it give you feedback of a successful upload via the blinking LED. With the Arduino IDE open, go to the top menu and click on "File" then go to Examples/01.Basics and click on Blink. You should now have a Blink project open, since we need the code compiled into a Hex file but we don't want the code uploaded to the board just yet, you can click on the Verify button (looks like a tick) which will compile your code and check for errors but it won't upload the code to the board which can be very useful. While the IDE is open and you have compiled your code, the Hex file can be found in the Temp folder I showed previously; projects in this folder usually start with the name "build" with a series of unique numbers like this "build1544573883262332201.tmp" and inside this folder will be your Hex file and in my case it was called "Blink.cpp.hex". Remember that your Hex file will usually be deleted the moment you close the IDE along with the temporary folder so it's best to find your Hex file and copy / paste it into your C:\ drive for uploading, feel free to rename it to whatever you like; for example: "Blink.hex".
Uploading Raw Sketches
Before we begin the upload, if you are worried about the fact that we will no longer have a boot-loader on the board, remember that you always have the "Burn Bootloader" option at your disposal in the Arduino IDE under Tools; this uploads the default boot-loader that comes with the board you have selected as your slave. Additionally if you go back to the default boot-loader and wish to upload projects to it like normal without a programming board, remember to change the IDE's programmer under Tools back to "AVRISP_II" and set the Board and Serial Port respectfully for the board you plan to upload to.
Alright, now that we have successfully compiled a project and have our Hex file ready to go I can now teach you how to use AVRDude to upload it to your slave board. There's a number of parameters that we will need to pass to AVRDude in order to upload our sketch to the board, this will include the method we are using to upload with, the baud rate, what chip we are programming and where the sketch will be stored etc. Make sure you have a command prompt open and set to your C:\ drive like I showed above.
The First Parameter will be our uploading method; there's numerous options which you can see a full list of if you type "avrdude -c randomtext" since random text isn't an available option, AVRDude will list all the possible upload methods supported. Take note of the last option in the list called "Arduino" which means that an Arduino would be used for our programming method which is perfect for us since we are using one as an ISP programmer. Now that we know which programmer to use, lets move on to the next parameter.
The Second Parameter will be the chip we plan to upload to, if you type "avrdude -c arduino" and hit enter, AVRDude will display a list of supported micro controllers which can be specified with "-p" and then the name of the chip we are programming. If you are unsure of the chip on your board you can check out the Hardware page for your board at the Arduino website which will show the technical specifications that indicates what chip is used. In my case I was using an Arduino Duemilanove with an ATmega328 chip so I would choose "m328p" from the list.
The Third Parameter will be the name of our port that the Arduino programmer is attached to. The best way I find to work this out is to simply reference where the Arduino IDE says in "Tools/Serial Port". Alternatively you can go to your Device Manager and under "Ports (COM & LPT)" you should see a device listed with the port that it uses. You can pass a port to AVRDude by using the "-P" command and typing the port's name after that; in my case it was "-P com3".
The Fourth Parameter will be our desired baud rate which is how fast we will be sending data to our programmer. Since we are going to be using the ISP system we must use "19200" as our overriding baud rate which you can pass to AVRDude with the "-b" command. If this command is not passed you may receive issues with syncing the programmer board.
The Fifth Parameter will specify where in the micro controller's memory that the sketch will be uploaded to; in this case we will be using flash, additionally we will also specify that we wish to write to the memory which is specified with "w" between the colons. You use the "-U" command and then pass "flash:w:" then write the name of your Hex file "Blink.hex", in my case I wrote "-U flash:w:Blink.hex".
The whole command should look like this:
And now you should see your Arduino slave board blinking away, since there's no longer a boot loader on the Arduino if you reset the board you'll noticed almost no delay before the code starts again which can be extremely useful for projects that need as much up time as possible during self resets. Another useful feature of not using a boot-loader is that you have a lot more room for large sketches / projects.
Uploading Optiboot
Cool, now that we have successfully uploaded a raw Hex file to our board I'll now show you how to upload the more up to date boot-loader called Optiboot. Optiboot actually comes with your Arduino's IDE software; simply go to the folder you have placed the software in and go to this location:
(Arduino Installation Folder)\hardware\arduino\bootloaders\optiboot
And you should see a Hex file called "optiboot_atmega328.hex", copy and paste this file to your "C:\" drive so we can upload it to our slave board like before. The boot-loaders folder that we just went inside contains the Hex files that the Arduino IDE literally uploads to the board when you click on "Burn Bootloader". The association for each board's default boot-loader is defined inside the "boards.txt" file in the "hardware\arduino" folder, which I'll be talking about more in the bonus tutorial below.
Now inside your command prompt that was used to upload the Blink sketch, we will now upload the Optiboot Hex file. To do this, type exactly what was typed before but change "Blink.hex" to the name of the Optiboot Hex file "optiboot_atmega328.hex" then hit enter. This will take a few seconds longer to upload to the slave board than the Blink sketch since it is much larger file and just like before you should see this:
The majority of the time that is taken for AVRDude is verifying every bit that was uploaded to your slave board, if you are confident in AVRDude's ability to upload without fault then feel free to pass the "-V" command which will omit the verification process and finalise the upload much quicker.
You should now have an Arduino Duemilanove with the latest Optiboot loader installed :) please note that this new boot-loader has a faster upload allowance and that you won't be able to upload your code using the Arduino IDE with Duemilanove set as your board. Additionally you shouldn't worry if the light is not blinking this time since the new boot-loader doesn't come with it by default. Duemilanoves use "57600" as their baud rate while the Optiboot loader uses "115200" which is two times faster so if you tried uploading sketches the normal way to your new board you'd receive a sync error. Since the Arduino UNO has the exact same chip and parameters as the Duemilanove, you can use the UNO as your uploading board. If you wish to learn more about how you could create a custom board definition for an Arduino Duemilanove with Optiboot then feel free to continue reading my bonus tutorial which will not only show you how to create a custom board but also introduce you to what fuses are all about.
Bonus Tutorial :)
I decided since this tutorial turned out so huge that another complemetary tutorial couldn't hurt and might be of some interest to a few people.
Since we have physically changed the boot-loader that was once on our Arduino to the new Optiboot that comes with Arduino Uno I thought it might be nice to show you how to add a custom board to the Arduino IDE that can represent an Arduino Duemilanove with Optiboot and allow uploading sketches.
To make a custom board that we can use with our new board, we'll need to modify the "boards.txt" file inside the "hardware\arduino" folder. Since the encoding of the file is extended beyond basic ASCII we will need a proper binary editor; Notepad won't be able to format the text correctly. The one I like to use is called Context which you can download here. There's also an editor called Notepad++ that should work. There are lots of editors out there so feel free to choose the one you like best.
Once you have installed an editor, open the "boards.txt" file inside it and you should see all the definitions of the boards currently supported by the Arduino IDE. We will be extending this list with a custom board definition that you can see here:
##############################################################
Duemilanove.name=Arduino Duemilanove w/ ATmega328 - Optiboot
Duemilanove.upload.protocol=arduino
Duemilanove.upload.maximum_size=32256
Duemilanove.upload.speed=115200
Duemilanove.bootloader.low_fuses=0xFF
Duemilanove.bootloader.high_fuses=0xDE
Duemilanove.bootloader.extended_fuses=0x05
Duemilanove.bootloader.path=optiboot
Duemilanove.bootloader.file=optiboot_atmega328.hex
Duemilanove.bootloader.unlock_bits=0x3F
Duemilanove.bootloader.lock_bits=0x0F
Duemilanove.build.mcu=atmega328p
Duemilanove.build.f_cpu=16000000L
Duemilanove.build.core=arduino
Duemilanove.build.variant=standard
##############################################################
Duemilanove.name=Arduino Duemilanove w/ ATmega328 - Optiboot
Duemilanove.upload.protocol=arduino
Duemilanove.upload.maximum_size=32256
Duemilanove.upload.speed=115200
Duemilanove.bootloader.low_fuses=0xFF
Duemilanove.bootloader.high_fuses=0xDE
Duemilanove.bootloader.extended_fuses=0x05
Duemilanove.bootloader.path=optiboot
Duemilanove.bootloader.file=optiboot_atmega328.hex
Duemilanove.bootloader.unlock_bits=0x3F
Duemilanove.bootloader.lock_bits=0x0F
Duemilanove.build.mcu=atmega328p
Duemilanove.build.f_cpu=16000000L
Duemilanove.build.core=arduino
Duemilanove.build.variant=standard
##############################################################
Place this between the "Arduino Uno" definition and the "Arduino Duemilanove w/ ATmega328" one. As you can see there's a few differences from the original Duemilanove definition; there's a larger "maximum_size" that takes into account the new memory given back by the smaller bootloader and the baud rate has been doubled to support our new board for uploading. Additionally for those who are curious, the "bootloader.file=optiboot_atmega328.hex" line is actually what the IDE will consider the default boot-loader to upload to your board if you click the "Burn Bootloader" button while the "bootloader.path" specifies what folder inside the "hardware\arduino\bootloaders" folder that the Hex file exists in.
The name before every line must be unique from every other definition or it will not show up in the Arduino IDE. Since the definition for the original Duemilanove was "atmega328" I decided to call the new one "Duemilanove". If you close all instances of the Arduino IDE and re-open it you'll find the new board definition available which you can use to burn sketches to your hearts content. Just remember to change the programmer back to "AVRISP_II" since we won't need the programmer board now that we have a boot-loader.
Fuses are a bit of a misnomer since they don't have anything to do with protecting against power surges etc. In the microprocessor world fuses are simply switches that can be turned on and off to specify how the board should act. The fuses are non-volatile and will remain set even if you erase the board since they have their own flash memory that they are stored in. A word of caution though, you can damage your arduino beyond repair if these are set incorrectly and won't be able to reprogram it using ISP. The only way to recover a damaged chip is to use a high voltage programmer; here's a good example that's compatible with Arduinos.
Fuses are stored as hex values which if converted to binary will show you which switches are turned on and off. Each letter of the Hex value represents 4 bits and since we have two letters that's 8 bits in total or one byte. I'll give an example of the "0xDE" high fuse value of our board definition:
0xDE
or
11011110
avrdude -c arduino -p m328p -P com3 -U lfuse:w:0xFF:m
avrdude -c arduino -p m328p -P com3 -U hfuse:w:0xDE:m
avrdude -c arduino -p m328p -P com3 -U efuse:w:0x05:m
avrdude -c arduino -p m328p -P com3 -U hfuse:w:0xDE:m
avrdude -c arduino -p m328p -P com3 -U efuse:w:0x05:m
After choosing the settings you desire, the Hex values will be calculated, then it's just a matter of passing the correct Hex value to the correct fuse using AVRDude: either Low, High or Extended. I recommend you double or even triple check the settings before uploading to the board just to be safe and don't forget to use your programmer with the ISP cable to code the new fuse settings to the slave.
Some of the settings that are of interest include:
Disabling the "Divide clock by 8" option which will increase the speed of your Arduino to maximum speed but uses more power. Or maybe your project doesn't require much speed and enabling the "Divide clock by 8" feature would lower power consumption which can be handy if your project is powered by a battery.
Turning on "Brownout Detection" if your project is dependant on using the EEPROM for storing information, the moment you go below the brownout power threshold the Arduino will shut down to shield the EEPROM from being erased or corrupted.
To compliment the "Brownout Detection" feature you can enable "Preserve EEPROM memory" which keeps the data stored in the EEPROM even after a chip erase since you may not want the information deleted.
That's all I can think of for now but I do hope this tutorial was helpful
Ashton.
Labels:
Arduino,
ArduinoISP,
Avrdude,
Bootloader,
Burn,
Command Prompt,
Education,
Electronics,
Fuses,
Help,
Hex,
ISP,
Optiboot,
Powershell,
Programming,
Sketch,
Tutorial
Wednesday, June 27, 2012
Promethien Burnout
Hey everyone,
I just got back from watching Prometheus and it left me shaking my head on how many scientific mistakes were made, the movie was ok though regardless but only in respect to the special effects since a lot of the show was mediocre to say the least, things just need to be said about it.
I was reading an examination of the show by 5 scientists who were interviewed for their opinions on the movie which was done by Forbes here. This video they linked to definitely asks a lot of questions that I was asking myself pretty much through the entire video, it's pretty funny so I recommend that you watch it too. Another good rant from someone who actually works with DNA can be read here.
There's so many good rants out there already about the show so I can only contribute a little if at all in respect to them, so here's my amendment / rant thing:
The biggest mistake made in the movie was related to pretty much the entire story of the aliens making humans and ignoring the s*** tonne of evidence for evolution and the fact that we are 98.8% or so similar to apes due to our evolutionary ancestry, additionally you wouldn't get a 100% match with the aliens DNA since there were extreme differences in their make-up; the eyes, the extra muscle, their 8 foot tall height etc would have all contributed differences in the genetic sequence similar to us and apes or even another human. You'd either have to throw away all notion of natural selection which has happened for around 4 billion years or so, ignore all the fossils and other myriad of evidence laid out like a banquet in front of you which would end you up getting an F in biology but either way you won't get a job in science. The story would have been better had they said they made all life unintentionally leading up to the humans etc and not this arrogant "we are superior to animals since the creator's made us" anthropocentric way of thinking like most religions like to imagine, derived from some kind of superiority complex or narcissism and pandered by creationists who intentionally miss inform and lie to you and the less informed public while knowing full well what they are doing for political and personal gain. The story would have been better if everything related to the creator's story simply described how the aliens came about from being in their ships, escape somehow and then turning into the alien we recognise once inheriting the right genetics through chest bursts which by the way is a form of mutation related to the very system that founds evolution ironically in which the alien changes its look depending on the creature that had the egg laid inside it, simply scrap the part about the humans entirely.
We are far from superior in all honesty and there's evidence that certain species are much better than us at certain things; take for example the test being done on apes having a far better photographic recollection of where a set of numbers were on a quick flash screen. Species that can hear below or above our hearing range, species of birds and lizards that can see ultra violet light which exceeds our vision, not to mention the species of mantis shrimp that not only see visible light and ultraviolet but also polarised light; both linear and circular, these animals have eyes a million times better than ours and we say we are superior? There's a myriad of species that can run faster, think and react quicker, live longer or forever etc and even dolphins understand what the term zero means. Personally I think just saying we are superior; this arrogant thinking process is enough evidence to prove we are not in any way shape or form and personally makes me sick. Don't people realise that we wouldn't even function if it wasn't for all the bacteria in our bodies that we take for granted which we have a symbiotic relationship with to keep us alive? How dare we marginalise the amazing species of our beautiful planet and call ourselves superior just to feel better than them and polish our ego, we are their equal; each animal is great at something but there is definitely not a species that is great at everything and I think that's a good thing personally. We are so far behind it makes me laugh; we still have wars, still deprive others of equal rights based on bigoted prejudices. A "superior" species if ever one came about would have left these primitive notions behind a long, long time ago where they belong.
Now I'll let that settle for a moment while you watch this video of a bird fishing with a piece of bread. Don't get me wrong, there are many wonderful people in this world many that I look up to and admire but they are sadly few and far between but they exist and that's what matters. We as Humans have our own beauty just like each and every animal on this planet and thanks to our evolutionary path to abstraction and lateral thought we can now take advantage of nature and as the expression goes "Those who have power have great responsibility". Though dependant on nature to keep us alive we can push the boundaries, speed up evolution by enhancing our lives, we express ourselves through art, music, literature and voice to the world we share and thanks to the internet, we can see that we are all the same and many of us have a strong will to make our world better; I guess you could call me an eternal optimist. Sadly there are many who are corrupted and desire money, fame and power all of which are fleeting just like that of fossil fuels. We can love and express our emotions but we are still part of nature, still an animal like all the others so let us not belittle them and subjugate them to lesser ideals. In order to learn and discover things we have as a result caused some damage to this world but we can be forgiven due to our ignorance and our ancestral desires for we have the ability to make things right again. I feel technology has matured enough that we can reverse this damage and restore our world, emulate nature by mimicking what nature has solved over millions of years. Science has given us the tools and we now have the ability to bring back the myriad of species that have unfortunately been made extinct to our endeavours. Hopefully we aren't too late to reverse global warming by implementing green technologies to remove the dependencies on fossil fuels, we just need to use our money more wisely and get solar and other free sources of energy into every home. We are still young as a species but we are responsible for our world, responsible for all the life forms that inhabit it. We are Earth's guardians in a sense and I'm humbled to be apart of that and to do what I can even if it's small; if we all work together it will all add up in the end and the future of our children and those of other species will be all the better for it.
Thanks for reading,
Ashton.
I just got back from watching Prometheus and it left me shaking my head on how many scientific mistakes were made, the movie was ok though regardless but only in respect to the special effects since a lot of the show was mediocre to say the least, things just need to be said about it.
I was reading an examination of the show by 5 scientists who were interviewed for their opinions on the movie which was done by Forbes here. This video they linked to definitely asks a lot of questions that I was asking myself pretty much through the entire video, it's pretty funny so I recommend that you watch it too. Another good rant from someone who actually works with DNA can be read here.
There's so many good rants out there already about the show so I can only contribute a little if at all in respect to them, so here's my amendment / rant thing:
The biggest mistake made in the movie was related to pretty much the entire story of the aliens making humans and ignoring the s*** tonne of evidence for evolution and the fact that we are 98.8% or so similar to apes due to our evolutionary ancestry, additionally you wouldn't get a 100% match with the aliens DNA since there were extreme differences in their make-up; the eyes, the extra muscle, their 8 foot tall height etc would have all contributed differences in the genetic sequence similar to us and apes or even another human. You'd either have to throw away all notion of natural selection which has happened for around 4 billion years or so, ignore all the fossils and other myriad of evidence laid out like a banquet in front of you which would end you up getting an F in biology but either way you won't get a job in science. The story would have been better had they said they made all life unintentionally leading up to the humans etc and not this arrogant "we are superior to animals since the creator's made us" anthropocentric way of thinking like most religions like to imagine, derived from some kind of superiority complex or narcissism and pandered by creationists who intentionally miss inform and lie to you and the less informed public while knowing full well what they are doing for political and personal gain. The story would have been better if everything related to the creator's story simply described how the aliens came about from being in their ships, escape somehow and then turning into the alien we recognise once inheriting the right genetics through chest bursts which by the way is a form of mutation related to the very system that founds evolution ironically in which the alien changes its look depending on the creature that had the egg laid inside it, simply scrap the part about the humans entirely.
We are far from superior in all honesty and there's evidence that certain species are much better than us at certain things; take for example the test being done on apes having a far better photographic recollection of where a set of numbers were on a quick flash screen. Species that can hear below or above our hearing range, species of birds and lizards that can see ultra violet light which exceeds our vision, not to mention the species of mantis shrimp that not only see visible light and ultraviolet but also polarised light; both linear and circular, these animals have eyes a million times better than ours and we say we are superior? There's a myriad of species that can run faster, think and react quicker, live longer or forever etc and even dolphins understand what the term zero means. Personally I think just saying we are superior; this arrogant thinking process is enough evidence to prove we are not in any way shape or form and personally makes me sick. Don't people realise that we wouldn't even function if it wasn't for all the bacteria in our bodies that we take for granted which we have a symbiotic relationship with to keep us alive? How dare we marginalise the amazing species of our beautiful planet and call ourselves superior just to feel better than them and polish our ego, we are their equal; each animal is great at something but there is definitely not a species that is great at everything and I think that's a good thing personally. We are so far behind it makes me laugh; we still have wars, still deprive others of equal rights based on bigoted prejudices. A "superior" species if ever one came about would have left these primitive notions behind a long, long time ago where they belong.
Now I'll let that settle for a moment while you watch this video of a bird fishing with a piece of bread. Don't get me wrong, there are many wonderful people in this world many that I look up to and admire but they are sadly few and far between but they exist and that's what matters. We as Humans have our own beauty just like each and every animal on this planet and thanks to our evolutionary path to abstraction and lateral thought we can now take advantage of nature and as the expression goes "Those who have power have great responsibility". Though dependant on nature to keep us alive we can push the boundaries, speed up evolution by enhancing our lives, we express ourselves through art, music, literature and voice to the world we share and thanks to the internet, we can see that we are all the same and many of us have a strong will to make our world better; I guess you could call me an eternal optimist. Sadly there are many who are corrupted and desire money, fame and power all of which are fleeting just like that of fossil fuels. We can love and express our emotions but we are still part of nature, still an animal like all the others so let us not belittle them and subjugate them to lesser ideals. In order to learn and discover things we have as a result caused some damage to this world but we can be forgiven due to our ignorance and our ancestral desires for we have the ability to make things right again. I feel technology has matured enough that we can reverse this damage and restore our world, emulate nature by mimicking what nature has solved over millions of years. Science has given us the tools and we now have the ability to bring back the myriad of species that have unfortunately been made extinct to our endeavours. Hopefully we aren't too late to reverse global warming by implementing green technologies to remove the dependencies on fossil fuels, we just need to use our money more wisely and get solar and other free sources of energy into every home. We are still young as a species but we are responsible for our world, responsible for all the life forms that inhabit it. We are Earth's guardians in a sense and I'm humbled to be apart of that and to do what I can even if it's small; if we all work together it will all add up in the end and the future of our children and those of other species will be all the better for it.
Thanks for reading,
Ashton.
Labels:
Education,
Movies,
Nature,
Philosophical,
Prometheus,
Science
Monday, June 25, 2012
Quickfix - Arduino Pro Mini's not Syncronizing
Hey everyone,
A little while back I bought an Arduino Pro Mini (5v version) and was planning on using it to make small devices like remotes or human interface devices to control my computer. Everything was going well, I soldered connections to all the pins and was ready to program the device using a USB to Serial converter (which is also rated at 5v to match my Arduino) that you can see here:
So I plugged it in and everything seemed fine, but as soon as I tried to reprogram the Arduino from the default blink project that it came pre-programmed with, I received an error saying that I couldn't synchronise with the board and that Processing couldn't upload my new code. I spent a good day looking up solutions on the internet and nothing helped, there was even two images of the same serial board I had attached to the Arduino forwards and backwards which wouldn't help anyone who was looking for solutions and I was sure I had the boards matching up correctly so that wasn't it, you'll find there's two version with the BLK to GRN switched so just make sure that your particular version is aligned correctly to the serial converter. Eventually I found my own solution utilising a method I use when debugging in C++ / C#; I connected up just the power and ground then slowly introduced each pin until I was able to commit my code to the Arduino. The solution was simply to remove one of the pins that said ground (Since the BLK pin was also a ground pin) on the Arduino Mini Pro which was connecting to a pin called CTS on the Serial board as you can see here:
As soon as I removed the pin everything just worked, no more sync issues with Processing and I could finally begin developing with the Arduino board :)
After solving the problem I read up on what the pin does, it's called CTS (Clear To Send) and was responsible for serial handshaking. Since the pin is omitted from the Arduino Mini Pro, I'm guessing they no longer need that pin and was used with older systems that didn't come with a self reset feature for programming; older Arduino's required you to reset the board just before the serial command to reprogram the board was sent. The USB to Serial Converter must have kept it for backwards compatibility with older boards and other serial devices. For additional information for those who are curious you can read about the flow control system here.
My Arduino Mini Pro seems to have the connections reversed from the one specified on the Arduino website here which may indicate that my Arduino may be outdated or perhaps it's a difference between the 3.3v and 5v versions. This being the case, if your version has the connections similar to the website then I can't guarantee if this solution will fix yours since I've never used that version but if my theory about the CTS pin being pulled to ground is correct which causes interference with the re-programming then I do hope this solution helps you too.
Thanks for reading,
Ashton.
A little while back I bought an Arduino Pro Mini (5v version) and was planning on using it to make small devices like remotes or human interface devices to control my computer. Everything was going well, I soldered connections to all the pins and was ready to program the device using a USB to Serial converter (which is also rated at 5v to match my Arduino) that you can see here:
So I plugged it in and everything seemed fine, but as soon as I tried to reprogram the Arduino from the default blink project that it came pre-programmed with, I received an error saying that I couldn't synchronise with the board and that Processing couldn't upload my new code. I spent a good day looking up solutions on the internet and nothing helped, there was even two images of the same serial board I had attached to the Arduino forwards and backwards which wouldn't help anyone who was looking for solutions and I was sure I had the boards matching up correctly so that wasn't it, you'll find there's two version with the BLK to GRN switched so just make sure that your particular version is aligned correctly to the serial converter. Eventually I found my own solution utilising a method I use when debugging in C++ / C#; I connected up just the power and ground then slowly introduced each pin until I was able to commit my code to the Arduino. The solution was simply to remove one of the pins that said ground (Since the BLK pin was also a ground pin) on the Arduino Mini Pro which was connecting to a pin called CTS on the Serial board as you can see here:
As soon as I removed the pin everything just worked, no more sync issues with Processing and I could finally begin developing with the Arduino board :)
I recommend that you try connecting wires first before removing the pin; just in
case your mini has a different reason than mine for not syncing, if yours doesn't have the same problem then it would be safer since the small board doesn't cope well with repeated application of heat from a soldering iron.
After solving the problem I read up on what the pin does, it's called CTS (Clear To Send) and was responsible for serial handshaking. Since the pin is omitted from the Arduino Mini Pro, I'm guessing they no longer need that pin and was used with older systems that didn't come with a self reset feature for programming; older Arduino's required you to reset the board just before the serial command to reprogram the board was sent. The USB to Serial Converter must have kept it for backwards compatibility with older boards and other serial devices. For additional information for those who are curious you can read about the flow control system here.
My Arduino Mini Pro seems to have the connections reversed from the one specified on the Arduino website here which may indicate that my Arduino may be outdated or perhaps it's a difference between the 3.3v and 5v versions. This being the case, if your version has the connections similar to the website then I can't guarantee if this solution will fix yours since I've never used that version but if my theory about the CTS pin being pulled to ground is correct which causes interference with the re-programming then I do hope this solution helps you too.
Thanks for reading,
Ashton.
Thursday, March 22, 2012
A Congregate of Symmetry, Science and its Beauty
Hey Everyone,
Something I enjoy doing each day is thinking and contemplating reality. I have no qualifications in physiology or any major field of scientific research but I do have an advanced diploma in computer science as a programmer but even so, I do consider myself a scientist / theoretical physicist. All my perceptions and understandings of reality are self derived from my own perceptions and thoughts over the period of my life time. I strive for accuracy and refinement and I love learning new things and thinking about things I already know but in different ways, an introvert with a curious mind.
I went for a walk outside today and looked at the garden; I find beauty beyond just flowers, I see it in everything: the leaves, the structure of the plant or tree itself. I look up at the clouds, then back down to a stream of water and see a similar beauty. This innate yet subtle structure that many seem to overlook, the same structure that governs the way my brain forms a neural net, the way my veins grow to deliver blood to the rest of my body. Even in entropic systems where weathering effects the formations of the planets, all you need is a satellite with a camera or even a microscope and you'll see the same pattern of blood veins that I see in my arm. In all underlining systems that makes our universe form and yet derived from an elegantly simple iteration algorithm also known as a fractal.
Some people seem to want to find and preserve symmetry like an obsessive-compulsive disorder but usually just in a conventional way; like side by side in a mirror, but there's so much more to it than that. Circular symmetries exists like the splash of a rain drop as well as the notion of self-similarity where regardless of the position on a fractal, you'll see a similar pattern from your former position. Even if something doesn't appear symmetric, all you need to do is look a little closer or further away to find it.
As I was walking passed the spearmint I noticed it was starting to bloom. Normally a spearmint would be splitting leaves at 90 degree intervals; hence its iterative fractal structure but what intrigued me was the fact that the plant had changed the rule-set that founded that fractal in order to start growing flower buds. I'm not familiar with any articles on the subject but I'm sure there's one out there derived from the plants biological processors that result in this change but I was interested in how such biology and chemical reactions changed the fractal structure itself. I took some pictures so others could see the stages the plant was going through; each one at a different phase and some still making leaves, some making flowers as well as those in between.
(Edit) I'm now aware from a recent scientific article that plants / trees use molecular patterns that specify how different cells will stretch when a leaf grows which results in all the different leaf patterns, I'm guessing that all aspects of plant growth would derive from this pattern mechanism to facilitate the growth of stems and flowers too. Pretty amazing.
People say that science destroys the mystery which some people crave but that couldn't be further from the truth; Sci-Fi is one of the best mediums to date that spurs our imaginations and makes us think "there's so much more to discover, learn and to see what's possible" the so called thinking outside the box and that exact notion is why science is so wondrously exciting. The evidence is overwhelming as each and every day, new and wondrous things are being discovered, improved and devised that can help a huge number if not all institutions including our very lives and deepen our appreciation. New cures for cancers, better ways to make electricity; devices that can save Africa from poverty. I couldn't think of a more honest system than science, yes there's people who are dishonest who lie and make up fake science for money but real science doesn't lie, it will never let you down, it will always admit when it was wrong and seek out the answers. People imply that because of such scientific views that others like myself can't appreciate or understand what beauty is like they "apparently" can, lacking the aesthetics so to speak. I beg to differ; they fail to understand that not only can I see this beauty they speak of, but I can understand it in more ways than they could possibly imagine: thanks to science. To know why a flower is the colour you see, why the stem is green or red and why it smells so pleasing. Knowing these attributes of the flower feels like my appreciation and the beauty I see is amplified 10 fold. Science isn't cold or black and white, it's the reason you have colour TV, the reason you live a life at least 4 times that of your great great ancestors by creating life saving cures and not to mention the moments when medical scientists aka doctors and nurses spend over 15+ hours in a hospital operation room just to stabilize one person's life, the reason why I can see with my glasses and why I can fix something when it breaks, making my life and others around me so much better as a result. These people with such shallow perceptions might take science for granted but I am honoured and privileged to have science as a tool that I can wield to make this world a better place, to truly understand its beauty and to know implicitly why life and this earth I stand on is so precious.
The next time you want to be thankful for something, try thanking science and don't just wait for a "Special" day to do it either; for each day in your life is just as precious as the next.
Thank you for your time,
Ashton.
Something I enjoy doing each day is thinking and contemplating reality. I have no qualifications in physiology or any major field of scientific research but I do have an advanced diploma in computer science as a programmer but even so, I do consider myself a scientist / theoretical physicist. All my perceptions and understandings of reality are self derived from my own perceptions and thoughts over the period of my life time. I strive for accuracy and refinement and I love learning new things and thinking about things I already know but in different ways, an introvert with a curious mind.
I went for a walk outside today and looked at the garden; I find beauty beyond just flowers, I see it in everything: the leaves, the structure of the plant or tree itself. I look up at the clouds, then back down to a stream of water and see a similar beauty. This innate yet subtle structure that many seem to overlook, the same structure that governs the way my brain forms a neural net, the way my veins grow to deliver blood to the rest of my body. Even in entropic systems where weathering effects the formations of the planets, all you need is a satellite with a camera or even a microscope and you'll see the same pattern of blood veins that I see in my arm. In all underlining systems that makes our universe form and yet derived from an elegantly simple iteration algorithm also known as a fractal.
Some people seem to want to find and preserve symmetry like an obsessive-compulsive disorder but usually just in a conventional way; like side by side in a mirror, but there's so much more to it than that. Circular symmetries exists like the splash of a rain drop as well as the notion of self-similarity where regardless of the position on a fractal, you'll see a similar pattern from your former position. Even if something doesn't appear symmetric, all you need to do is look a little closer or further away to find it.
As I was walking passed the spearmint I noticed it was starting to bloom. Normally a spearmint would be splitting leaves at 90 degree intervals; hence its iterative fractal structure but what intrigued me was the fact that the plant had changed the rule-set that founded that fractal in order to start growing flower buds. I'm not familiar with any articles on the subject but I'm sure there's one out there derived from the plants biological processors that result in this change but I was interested in how such biology and chemical reactions changed the fractal structure itself. I took some pictures so others could see the stages the plant was going through; each one at a different phase and some still making leaves, some making flowers as well as those in between.
(Edit) I'm now aware from a recent scientific article that plants / trees use molecular patterns that specify how different cells will stretch when a leaf grows which results in all the different leaf patterns, I'm guessing that all aspects of plant growth would derive from this pattern mechanism to facilitate the growth of stems and flowers too. Pretty amazing.
People say that science destroys the mystery which some people crave but that couldn't be further from the truth; Sci-Fi is one of the best mediums to date that spurs our imaginations and makes us think "there's so much more to discover, learn and to see what's possible" the so called thinking outside the box and that exact notion is why science is so wondrously exciting. The evidence is overwhelming as each and every day, new and wondrous things are being discovered, improved and devised that can help a huge number if not all institutions including our very lives and deepen our appreciation. New cures for cancers, better ways to make electricity; devices that can save Africa from poverty. I couldn't think of a more honest system than science, yes there's people who are dishonest who lie and make up fake science for money but real science doesn't lie, it will never let you down, it will always admit when it was wrong and seek out the answers. People imply that because of such scientific views that others like myself can't appreciate or understand what beauty is like they "apparently" can, lacking the aesthetics so to speak. I beg to differ; they fail to understand that not only can I see this beauty they speak of, but I can understand it in more ways than they could possibly imagine: thanks to science. To know why a flower is the colour you see, why the stem is green or red and why it smells so pleasing. Knowing these attributes of the flower feels like my appreciation and the beauty I see is amplified 10 fold. Science isn't cold or black and white, it's the reason you have colour TV, the reason you live a life at least 4 times that of your great great ancestors by creating life saving cures and not to mention the moments when medical scientists aka doctors and nurses spend over 15+ hours in a hospital operation room just to stabilize one person's life, the reason why I can see with my glasses and why I can fix something when it breaks, making my life and others around me so much better as a result. These people with such shallow perceptions might take science for granted but I am honoured and privileged to have science as a tool that I can wield to make this world a better place, to truly understand its beauty and to know implicitly why life and this earth I stand on is so precious.
The next time you want to be thankful for something, try thanking science and don't just wait for a "Special" day to do it either; for each day in your life is just as precious as the next.
Thank you for your time,
Ashton.
Monday, March 19, 2012
Tutorial - Dosbox Linear Scaler 4x and Greater
Hey Everyone,
I was just checking up on the status of a program called Dosbox to see how the development is going and started reading the forum, I noticed someone asking if additional linear scales could be added to the rendering context configuration. I actually did this myself when I needed the game to fit nicely on a 2560x1600 screen in window mode by modifying and recompiling the source code. So since I've done it before I decided I should write a nice "quickish" tutorial on how to do this for those who are curious or even have the same problem like I once had. Please note that this is only going to add additional ScaleNormal's; 2x, 3x, etc which doesn't include TV, RGB, Scan, HQ, Sai, Super, Advanced Mame or Interp. Also for those who are more familiar with programming and are comfortable with working out dependencies in your favourite IDE etc feel free to skip the steps and head straight to the code change section :)
Additionally someone has recently compiled a patch using this tutorial to add support for 4x, 5x and 6x which you can find at the DosBox Development Forum here: link :)
The first step is to obtain the source code, you can either download the latest stable build from here or you could download a subversion aggregation program to obtain the latest up to date version of the code, the one I use is called Tortoise SVN which you can download from here. Once you have that you can download the latest SVN repository of Dosbox by copying and pasting this link into your subversion's checkout process:
The second step once you've downloaded the source code into your desired directory you'll need an editor for modifying the source code, I believe Dosbox supports a few including make files. Since I use the Windows operating system I like to edit code using Microsoft's visual studio which you can download the express version for free from here, the source code is written in C++ so I've linked the 2010 C++ Express edition.
The third step is to load the project into your editor, for those using visual studio they have provided an .sln project file that you can open in the editor, you can find this in "SVNFolder\dosbox\trunk\visualc_net". You may need to convert the project file to 2010 due to the project being built from an older visual studio version but the code will still work fine in 2010 after you convert it; Visual Studio will provide a window that will take you through the conversion process while also giving the option to backup the code in case the conversion fails.
The fourth step will be getting the code to compile without build errors; for the purposes of the tutorial and to make things easier I'll be omitting the screenshot ability as well as the debugging system of Dosbox so the code will compile with less hassle. First things first, create a folder for placing everything in; well need to download some dependencies for the Dosbox rendering context and networking subsystem. First you'll need to download SDL from here, at the bottom of the page where it says development libraries click on the appropriate file for your IDE and download it to your new folder. Second you'll need to download SDL_Net from here where it says binaries; download the appropriate developer package for your operating system, they'll contain "devel" in their names and download it to your new folder as well.
Extract both packages to their own folder and then decide where you'd like your global dependencies to exist for future projects like "C:\API Dependencies" or something like that so you have a nice place to put everything. Create two folders inside; one called SDL and the other SDL_Net, once you've done that open the SDL folder you extracted and drag and drop the include and lib folders to your new SDL API Dependencies folder. Then do the same for SDL_Net from your extraction folder to the dependencies SDL_Net folder.
Ok time to modify the Dosbox project settings so it knows where these files are and allow it to compile happily. Make sure you have the project open in Visual Studio 2010, you can optionally set the project to either debug mode or release mode; release being more efficient and result in a smaller exe file but remember that all these settings you are about to change will have to be done again for debug. Please note that release mode will take longer to compile due to additional code optimizations but the program will run a lot smoother as a result, after choosing that you can either hit Alt+F7 or go up to the top menu under "Project" and click on "Dosbox Properties" which will open the project settings dialogue. Click on "VC++ Directories", then click on "Include Directories" and an arrow will appear to the right side of the text area, click that and then click edit (I have no idea why the interface is like this so bare with it). After you do that you'll see a small window open up called "Include Directories", go back to your API Dependencies folder and locate the include folder for SDL and copy the directories path and then go back to the "Include Directories" window, double click on the white space or click the new path button and paste your SDL directory into it. Do the same for SDL_Net and then hit ok to close the window.
Further down the list you'll see another list called "Library Directories", this time you need to copy and paste the "Lib" folder directories of both SDL and SDL_Net into the libraries window then hit ok. So far so good, now on the right panel of your project settings you'll see something called "Linker", click this and then open up the "Additional Dependencies" list like you did with the include and library lists. Remove the references to "zlib.lib", "libpng.lib" and "curses.lib" then hit ok, this will remove the dependencies for the screenshot and debugging systems; you can add this back later if your willing to compile libpng and zlib yourself since Dosbox doesn't come with them, probably due to licensing or something and what's worse is some dependency developers don't even provide binaries or libraries so you can avoid compiling manually.
To finalise the removal of all external dependencies you'll need to open the "config.h" file located under "Source Files/visualc" and make sure both "C_DEBUG" and "C_SSHOT" are set to zero next to them. If you compile the code you should be left with one last error informing you that it can not find "afxres.h" which for some reason the express addition of visual studio doesn't come packaged with, to fix this last error double click on the error about the missing file and it will open the "winres.rc" file showing the include statement trying to find the missing header file, replace that line with this code section:
Ok with any luck you should have a compiled version of Dosbox, just make sure that when you place the exe outside of the IDE's compile folder to make sure you put both "SDL.dll" and "SDL_net.dll" which you can find inside the dependencies lib folder under x86 with it, otherwise it will crash. You should take note when you run the program that there's a reference to the config file that allows you to change Dosbox's settings written on the console that's unique for this SVN Build located at "C:\Users\Your Name\AppData\Local\DOSBox\dosbox-SVN.conf" for Windows 7 but write down where it says for your computer so you can change the settings later.
Alrighty, now that we can run Dosbox from its source code we can begin to implement some upgrades for the VGA linear scaling system. First things first we must create a new definition for our new scaler type; under "Source Files/gui" you will find a header file called "render_scalers.h", open it and scroll down to the bottom. You should see this
Add this line just after them at whatever scale you desire:
In this case I'll be adding a 4x linear scaler. Now Open the file "render.cpp" under the gui folder and scroll down to line 291, you should see this:
Append your scaler as an additional else if line like this:
Scroll down to line 600 and add this:
Ok, now open up "render_templates.h" in the gui folder, then scroll down to line 241. Add this after the Normal3x's definition:
Alright, now we need to declare our scaler; open up "render_scalers.cpp" under gui and scroll down to line 242. Here you can see the definitions for the linear scalers, append this code after the definition of "ScaleNormal3x":
Ok, now inside "render_simple.h" in the gui folder which in my case seems to be excluded for some reason. You can find it inside the SVN directory's gui folder manually, just drag and drop it into your IDE editor; feel free to add it to your "Source Files/gui" folder so you can always access it later. Now you can scroll down to line 68 and append this:
This after line 79:
This after line 97:
Finally this after line 109:
To use your new scaler as an available option, you can open up "dosbox.cpp" and go to line 389 where you can add this:
Now compile the code and you'll be able to specify the "Normal4x" setting inside the Dosbox.conf file and your game should render larger than the 3x multiplier. If you would like the config file to show your scaler as an available option in the comments you'll need to delete the old config file first as this change will only effect the config when it's created by default; when one hasn't been found in the AppData directory.
And that's it! I hope this wasn't too much of a headache for people and that you enjoyed the tutorial. Feel free to explore what the changes do and see if you can work out how to add even more scalers to your code :)
Thanks for reading,
Ashton.
I was just checking up on the status of a program called Dosbox to see how the development is going and started reading the forum, I noticed someone asking if additional linear scales could be added to the rendering context configuration. I actually did this myself when I needed the game to fit nicely on a 2560x1600 screen in window mode by modifying and recompiling the source code. So since I've done it before I decided I should write a nice "quickish" tutorial on how to do this for those who are curious or even have the same problem like I once had. Please note that this is only going to add additional ScaleNormal's; 2x, 3x, etc which doesn't include TV, RGB, Scan, HQ, Sai, Super, Advanced Mame or Interp. Also for those who are more familiar with programming and are comfortable with working out dependencies in your favourite IDE etc feel free to skip the steps and head straight to the code change section :)
Additionally someone has recently compiled a patch using this tutorial to add support for 4x, 5x and 6x which you can find at the DosBox Development Forum here: link :)
Please note that at the point of which I wrote this tutorial, Dosbox v0.74 was the latest revision so I can't promise this tutorial will still be accurate with additional future Dosbox updates and changes to the VGA scaler code. If this is the case then I will take a look at the changes and if possible, I'll make a new tutorial in the future :)
The first step is to obtain the source code, you can either download the latest stable build from here or you could download a subversion aggregation program to obtain the latest up to date version of the code, the one I use is called Tortoise SVN which you can download from here. Once you have that you can download the latest SVN repository of Dosbox by copying and pasting this link into your subversion's checkout process:
https://dosbox.svn.sourceforge.net/svnroot/dosbox/dosbox/trunk
The third step is to load the project into your editor, for those using visual studio they have provided an .sln project file that you can open in the editor, you can find this in "SVNFolder\dosbox\trunk\visualc_net". You may need to convert the project file to 2010 due to the project being built from an older visual studio version but the code will still work fine in 2010 after you convert it; Visual Studio will provide a window that will take you through the conversion process while also giving the option to backup the code in case the conversion fails.
The fourth step will be getting the code to compile without build errors; for the purposes of the tutorial and to make things easier I'll be omitting the screenshot ability as well as the debugging system of Dosbox so the code will compile with less hassle. First things first, create a folder for placing everything in; well need to download some dependencies for the Dosbox rendering context and networking subsystem. First you'll need to download SDL from here, at the bottom of the page where it says development libraries click on the appropriate file for your IDE and download it to your new folder. Second you'll need to download SDL_Net from here where it says binaries; download the appropriate developer package for your operating system, they'll contain "devel" in their names and download it to your new folder as well.
Extract both packages to their own folder and then decide where you'd like your global dependencies to exist for future projects like "C:\API Dependencies" or something like that so you have a nice place to put everything. Create two folders inside; one called SDL and the other SDL_Net, once you've done that open the SDL folder you extracted and drag and drop the include and lib folders to your new SDL API Dependencies folder. Then do the same for SDL_Net from your extraction folder to the dependencies SDL_Net folder.
Ok time to modify the Dosbox project settings so it knows where these files are and allow it to compile happily. Make sure you have the project open in Visual Studio 2010, you can optionally set the project to either debug mode or release mode; release being more efficient and result in a smaller exe file but remember that all these settings you are about to change will have to be done again for debug. Please note that release mode will take longer to compile due to additional code optimizations but the program will run a lot smoother as a result, after choosing that you can either hit Alt+F7 or go up to the top menu under "Project" and click on "Dosbox Properties" which will open the project settings dialogue. Click on "VC++ Directories", then click on "Include Directories" and an arrow will appear to the right side of the text area, click that and then click edit (I have no idea why the interface is like this so bare with it). After you do that you'll see a small window open up called "Include Directories", go back to your API Dependencies folder and locate the include folder for SDL and copy the directories path and then go back to the "Include Directories" window, double click on the white space or click the new path button and paste your SDL directory into it. Do the same for SDL_Net and then hit ok to close the window.
Further down the list you'll see another list called "Library Directories", this time you need to copy and paste the "Lib" folder directories of both SDL and SDL_Net into the libraries window then hit ok. So far so good, now on the right panel of your project settings you'll see something called "Linker", click this and then open up the "Additional Dependencies" list like you did with the include and library lists. Remove the references to "zlib.lib", "libpng.lib" and "curses.lib" then hit ok, this will remove the dependencies for the screenshot and debugging systems; you can add this back later if your willing to compile libpng and zlib yourself since Dosbox doesn't come with them, probably due to licensing or something and what's worse is some dependency developers don't even provide binaries or libraries so you can avoid compiling manually.
To finalise the removal of all external dependencies you'll need to open the "config.h" file located under "Source Files/visualc" and make sure both "C_DEBUG" and "C_SSHOT" are set to zero next to them. If you compile the code you should be left with one last error informing you that it can not find "afxres.h" which for some reason the express addition of visual studio doesn't come packaged with, to fix this last error double click on the error about the missing file and it will open the "winres.rc" file showing the include statement trying to find the missing header file, replace that line with this code section:
#include <Windows.h>
Ok with any luck you should have a compiled version of Dosbox, just make sure that when you place the exe outside of the IDE's compile folder to make sure you put both "SDL.dll" and "SDL_net.dll" which you can find inside the dependencies lib folder under x86 with it, otherwise it will crash. You should take note when you run the program that there's a reference to the config file that allows you to change Dosbox's settings written on the console that's unique for this SVN Build located at "C:\Users\Your Name\AppData\Local\DOSBox\dosbox-SVN.conf" for Windows 7 but write down where it says for your computer so you can change the settings later.
Code Change Section
Alrighty, now that we can run Dosbox from its source code we can begin to implement some upgrades for the VGA linear scaling system. First things first we must create a new definition for our new scaler type; under "Source Files/gui" you will find a header file called "render_scalers.h", open it and scroll down to the bottom. You should see this
extern ScalerSimpleBlock_t ScaleNormal2x;
extern ScalerSimpleBlock_t ScaleNormal3x;
Add this line just after them at whatever scale you desire:
extern ScalerSimpleBlock_t ScaleNormal4x;
In this case I'll be adding a 4x linear scaler. Now Open the file "render.cpp" under the gui folder and scroll down to line 291, you should see this:
if ( render.scale.size == 2 )
simpleBlock = &ScaleNormal2x
simpleBlock = &ScaleNormal2x
else if ( render.scale.size == 3 )
simpleBlock = &ScaleNormal3x;
simpleBlock = &ScaleNormal3x;
else
simpleBlock = &ScaleNormal1x;
Append your scaler as an additional else if line like this:
else if ( render.scale.size == 4 )
simpleBlock = &ScaleNormal4x;
simpleBlock = &ScaleNormal4x;
Scroll down to line 600 and add this:
else if (scaler == "normal4x") { render.scale.op = scalerOpNormal;render.scale.size = 4; }
Ok, now open up "render_templates.h" in the gui folder, then scroll down to line 241. Add this after the Normal3x's definition:
#define SCALERNAME Normal4x
#define SCALERWIDTH 4
#define SCALERHEIGHT 4
#define SCALERFUNC \
line0[0] = P; \
line0[1] = P; \
line0[2] = P; \
line0[3] = P; \
line1[0] = P; \
line1[1] = P; \
line1[2] = P; \
line1[3] = P; \
line2[0] = P; \
line2[1] = P; \
line2[2] = P; \
line2[3] = P; \
line3[0] = P; \
line3[1] = P; \
line3[2] = P; \
line3[3] = P;
#include "render_simple.h"
#undef SCALERNAME
#undef SCALERWIDTH
#undef SCALERHEIGHT
#undef SCALERFUNC
Alright, now we need to declare our scaler; open up "render_scalers.cpp" under gui and scroll down to line 242. Here you can see the definitions for the linear scalers, append this code after the definition of "ScaleNormal3x":
ScalerSimpleBlock_t ScaleNormal4x = {
"Normal4x",
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
4,4,{
{ Normal4x_8_8_L, Normal4x_8_15_L , Normal4x_8_16_L , Normal4x_8_32_L },
{ 0, Normal4x_15_15_L, Normal4x_15_16_L, Normal4x_15_32_L},
{ 0, Normal4x_16_15_L, Normal4x_16_16_L, Normal4x_16_32_L},
{ 0, Normal4x_32_15_L, Normal4x_32_16_L, Normal4x_32_32_L},
{ Normal4x_8_8_L, Normal4x_9_15_L , Normal4x_9_16_L , Normal4x_9_32_L }
},{
{ Normal4x_8_8_R, Normal4x_8_15_R , Normal4x_8_16_R , Normal4x_8_32_R },
{ 0, Normal4x_15_15_R, Normal4x_15_16_R, Normal4x_15_32_R},
{ 0, Normal4x_16_15_R, Normal4x_16_16_R, Normal4x_16_32_R},
{ 0, Normal4x_32_15_R, Normal4x_32_16_R, Normal4x_32_32_R},
{ Normal4x_8_8_R, Normal4x_9_15_R , Normal4x_9_16_R , Normal4x_9_32_R }
}};
"Normal4x",
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
4,4,{
{ Normal4x_8_8_L, Normal4x_8_15_L , Normal4x_8_16_L , Normal4x_8_32_L },
{ 0, Normal4x_15_15_L, Normal4x_15_16_L, Normal4x_15_32_L},
{ 0, Normal4x_16_15_L, Normal4x_16_16_L, Normal4x_16_32_L},
{ 0, Normal4x_32_15_L, Normal4x_32_16_L, Normal4x_32_32_L},
{ Normal4x_8_8_L, Normal4x_9_15_L , Normal4x_9_16_L , Normal4x_9_32_L }
},{
{ Normal4x_8_8_R, Normal4x_8_15_R , Normal4x_8_16_R , Normal4x_8_32_R },
{ 0, Normal4x_15_15_R, Normal4x_15_16_R, Normal4x_15_32_R},
{ 0, Normal4x_16_15_R, Normal4x_16_16_R, Normal4x_16_32_R},
{ 0, Normal4x_32_15_R, Normal4x_32_16_R, Normal4x_32_32_R},
{ Normal4x_8_8_R, Normal4x_9_15_R , Normal4x_9_16_R , Normal4x_9_32_R }
}};
Ok, now inside "render_simple.h" in the gui folder which in my case seems to be excluded for some reason. You can find it inside the SVN directory's gui folder manually, just drag and drop it into your IDE editor; feel free to add it to your "Source Files/gui" folder so you can always access it later. Now you can scroll down to line 68 and append this:
#if (SCALERHEIGHT > 3)
PTYPE *line3 = WC[2];
#endif
PTYPE *line3 = WC[2];
#endif
This after line 79:
#if (SCALERHEIGHT > 3)
PTYPE *line3 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 3);
#endif
PTYPE *line3 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 3);
#endif
This after line 97:
#if (SCALERHEIGHT > 3)
line3 += SCALERWIDTH;
#endif
line3 += SCALERWIDTH;
#endif
Finally this after line 109:
#if (SCALERHEIGHT > 3)
BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch*3,WC[2], copyLen );
#endif
BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch*3,WC[2], copyLen );
#endif
To use your new scaler as an available option, you can open up "dosbox.cpp" and go to line 389 where you can add this:
const char *scalers[] = {
"none", "normal2x", "normal3x", "normal4x"
Now compile the code and you'll be able to specify the "Normal4x" setting inside the Dosbox.conf file and your game should render larger than the 3x multiplier. If you would like the config file to show your scaler as an available option in the comments you'll need to delete the old config file first as this change will only effect the config when it's created by default; when one hasn't been found in the AppData directory.
And that's it! I hope this wasn't too much of a headache for people and that you enjoyed the tutorial. Feel free to explore what the changes do and see if you can work out how to add even more scalers to your code :)
Thanks for reading,
Ashton.
Subscribe to:
Posts (Atom)



















