Laundry circuit control with card reader/database

Greetings! This is my first post I welcome you to correct me on anything I may be in error so I may be a better contributor.

I want to convert my coin operated laundry room into mag stripe controlled. The appt complex it family owned and much of the complex is out of date on technology. My goal is to remove the existing coin operators and control the 110/220 v circuit of the machines to a certain time limit(say 60 min).

In theory I had invisioned making a switchboard of outlets the arduino would control. Coupled with a push button grid of all the machines in the room and a magnetic card reader I would be able to issue cards to the tenants and they would swipe their card near the door, using available credits for their card, be able to select a machine to provide power.

(History of me)
I'm relatively new to programming and microcontrollers. Majoring in mech engineering I have got a bit on introduction and loved it. Got the arduino starter kit and completed it for learning purposes with this platform vs the dragonboard.

I searched the forum for similar projects as well as google and instructables. (Instructables had the "plugduino" which I liked and thought would be efficient). With that in mind, I had some questions/comments I hoped could be answered/confirmed and all suggestions as 2 heads better than 1, 4 better than 2, etc so thank you for your input in advance!

  1. A relay will be the best option for controlling the circuit. What is the limit to the number of plugs I could control? Is there a certain rated relay I will be required to use? (I know this sounds like a stupid question but Ive always struggled with electricity, currently even trying to get an electrolysis bath to work to clean parts for my 65 jeep)

  2. A database will need to hold all of the appt numbers and card stripe linked to them to add/removed credits as necessary when used? I've never done this before and hoped for suggestions or platforms to use that would be best or suggested reading to learn more(I'm doing my best but again looking for advice more experienced than I)

  3. Currently only planned far enough for this operation but haven't decided the best way to credit the accounts. Was thinking cash but trying to make it autonomous(as much as possible anyway). What would be the best way to accomplish this?

Thank you all for your input!

Nrs05:

  1. A relay will be the best option for controlling the circuit.

Yes.

What is the limit to the number of plugs I could control?

Depends on the Arduino board you use. How many do you need to control?

Is there a certain rated relay I will be required to use? (I know this sounds like a stupid question but Ive always struggled with electricity, currently even trying to get an electrolysis bath to work to clean parts for my 65 jeep)

Yes. One with contacts capable of switching the power requirements of the machine.

  1. A database will need to hold all of the appt numbers and card stripe linked to them to add/removed credits as necessary when used? I've never done this before and hoped for suggestions or platforms to use that would be best or suggested reading to learn more(I'm doing my best but again looking for advice more experienced than I)

How many cards/accounts will you need?

I would start by dissecting one of the coin op boxes to see how it controls the machine. Don't reinvent that wheel if you don't have to. Laundry driers take a lot of power, so choosing adequate parts to switch that power is crucial. If this has been done for you, take advantage of that.

Nrs05:
I'm relatively new to programming and microcontrollers. Majoring in mech engineering I have got a bit on introduction and loved it.

Don't be in a hurry to build your dream project. Do some basic stuff first. You really don't want to be on the hook for a non-operational laundry room, and barely enough skills to troubleshoot it. Completely your call when it's go-time, just be confident that you've tested it, tried to break it, did everything wrong, and pretend you have no idea what you're doing. Get friends to try it too. If they don't immediately understand how it works, go back to the drawing board. Users can be really dumb. Don't underestimate their ability to foul up the entire thing. Make sure you leave the prototype running for a while, non-stop, before you try to implement it for real. Not all bugs show up right away.

Nrs05:
What is the limit to the number of plugs I could control? Is there a certain rated relay I will be required to use? (I know this sounds like a stupid question but Ive always struggled with electricity

In theory, there is no limit. But you will run into a ceiling sooner or later. You could use a master/slave relationship, where the reader sends authorization code to a slave box at a machine. The master can then forget all about the slave, and let it manage its own run timer and all that. Look into i2c if this sounds good to you. Downside is that it requires an Arduino at each machine. (You can build your own standalones for cheap though.) Upside is that it requires very little intelligence for the master, and the number of machines it can control is limited to how many i2c addresses you can fit in memory.

Another option is having no intelligence at the machine, just a relay controlled by the master. In this case, I would use signal wires to each machine, and a transistor to switch the relay (or whatever mechanical switch), rather than trying to bring that coil drive current back to the master. This gives you a level of isolation against faults, and reduces the load over the long-haul cables. You can use I/O expanders (shift registers) to expand the number of output pins toward infinity. Again, you'll be limited by what you can keep track of -- which is more of a concern if you're also keeping tabs on how long each machine runs for.

Make sure you get advice on the switching part. Pictures and diagrams help. Run it by the forum here at the very least. Remember, you're dealing with high voltage, high current, and public occupants. Bad combo to screw up.

Nrs05:
A database will need to hold all of the appt numbers and card stripe linked to them to add/removed credits as necessary when used? I've never done this before and hoped for suggestions or platforms to use that would be best or suggested reading to learn more

Ever used MySQL? How about apache, PHP, or perl? Having an actual database somewhere is a good way to do this, and you could run it from a Raspberry Pi or something lightweight like that. You don't have tons of storage space on an Arduino, and updating a flash or EEPROM database is a project unto itself.

Thank you all for the help! Many great ideas!

I was concerned about dryers as they use 220 so was going to plan to use equipment rated around 20-25% above whatever I'm dealing with on the high end.

That's excellent advice to not go too far too soon. As long as I attempt to account for all errors and make sure everyone is safe I believe I'm going to learn a great deal from this project and not injure anyone, especially with help from you guys on where I may be erring so thanks again.

I currently have an Uno to learn everything on. It appears as though a mega may be beneficial in the long run for this project. When I referring the the number of plugs to use however, I meant how many can a relay control. If I were to control 4 different power sources, they would each need their own signal from the Uno to relay/ transistor combination, and then to the circuit. Is this correct?

I imagine there to be around 50 appt so a database no larger than 100 would be plenty for duplicate cards and lost ones to cycle through.

There were a couple terms used... I2c, shift registers, etc I'm unfamiliar with so thank you! I will learn about these and see if I can't make them work for my purposes. I'm also taking several courses on "coursers.org" that deal with circuits and databases and believe these terms may have been mentioned so it's only time! Thanks again!

It's a common misconception to think an Uno is insufficient, and that a project will require a Mega. That is often not true. They both run at the same CPU clock frequency, and are based on the same fundamental core, so processing power is equal.

Memory can be an issue, since the Uno (ATmega328P) only has 2KB RAM, but when you need more than 2KB, it's probably good to stop and consider if your approach can be optimized. Often it can, with little impact on usability. Cross that bridge when you come to it.

Then there's I/O... Yes, the Mega has a lot of pins. That "shift register" thing I mentioned can help here. A shift register uses a serial interface (which means it requires, for example, only a clock pin, a data pin, and a latch pin) and, in turn, gives you any number of individually-controlled input or output pins. A very common setup is 8 inputs or outputs, essentially giving you 5 pins back. The bonus is that you can stack these things up, so you can use the same three serial interface pins to address 8, 16, 24, 32, or more I/Os.

i2c is a serial bus that uses a master/slave topology. The master device (usually the microcontroller) sends an address out on a serial bus, followed by a command. Any slave device that is programmed to respond to that address will receive the command and act accordingly. Every device (that needs to be individually addressable) has its own unique address, but all devices share the same data pins, so you can put as many devices on the bus as you want -- up to some limit based on how much of an electrical load each device places on the bus.

RS-485 is similar (shared bus with common data pins for all devices), except it's meant to be run over longer distances (hundreds of feet, instead of within a few feet or on the same PCB) and doesn't define the master/slave relationship -- all devices are technically peers, and it's up to you to define the communications protocol you will use to interface them.

SPI is another common one. It's similar to i2c in that it's meant for local communication between parts, but uses a point-to-point topology with one master and one slave device that speak directly to each other, rather than a shared bus. You can, however, share the data and clock lines between devices as long as each device has its own "Chip Select" pin that specifically tells it to ignore or respond to input. SPI is very common for shift registers due to its simple and expandable method of data transfer. The target IC can be a "dumb" device, while i2c requires a higher level of sophistication to communicate.

Each of these is covered in great depth on any number of blogs, websites, and tutorials.

One trap that newcomers often fall into is that they want to hook up a dozen sensors and peripherals to an Arduino, run out of pins, and assume the Mega will give them some breathing room. Well, sometimes... but not always. Microcontrollers are limited by design. They're very basic computers. When you find yourself providing a user interface (LCDs and buttons), reading lots of sensors, controlling lots of outputs, and trying to tack on things like Ethernet, WiFi, or Bluetooth, you might question whether you're trying to turn a 20MHz CPU with 2KB RAM into a single-board computer. :wink: With clever design and a little bit of compromise, you can do extraordinary things with a single microcontroller, but it's also easy to expect unrealistic things of them. Your application seems perfect for a microcontroller, so no worries there, but watch out for that tendency to over-design things at first.

Nrs05:
I currently have an Uno to learn everything on. It appears as though a mega may be beneficial in the long run for this project. When I referring the the number of plugs to use however, I meant how many can a relay control.

That depends on how much current (Amps) the equipment needs and the contact rating of the relays.

If I were to control 4 different power sources, they would each need their own signal from the Uno to relay/ transistor combination, and then to the circuit. Is this correct?

There are ways to control 4 relays with just two pins but, yes you'll need 4 pins for safety's sake.

I imagine there to be around 50 appt so a database no larger than 100 would be plenty for duplicate cards and lost ones to cycle through.

How much data do you need to hold on each account? Just the card number and the remaining credit or more. If more then you'll need to store it on an SD card or similar.