Code Monkey home page Code Monkey logo

arduino-mdb-uart's Introduction

Русская версия описания находится ниже

UPDATE 11 Oct 2023: source public release

Arduino-MDB-UART

Atmega1284 PLC (or Arduino Mega, or any other ATmega chip with 2 UARTs) acts as man-in-the-middle between MDB peripheral and master PC (VMC) serial port. It off-loads MDB bus polling and converting data between 9-bit MDB and 8-bit RS232 tasks from VMC, effectively delivers data by using hardware interrupts and provides conformity for required timing restrictions (see MDB datasheet for details). Command received from master PC (VMC) via serial port (RXD1 on AtMega1284), then sent to MDB serial port (TXD0) with 9-bit format.

Compiled_firmware folder contains ready-to-burn firmware images in hex format, for both "Through-hole ATmega1284" and "new rev2a" versions, see instructions inside. Docs folder contains manuals for operating device with firmware included.

HOW CAN I USE IT?

It's for connecting PC or other computer with "usual" 8-bit COM port ("Master", "VMC") to MDB devices (slaves such as coin charger, bill validator etc...), to control these devices and receive messages from them. It's NOT for emulating coin charger or something like it (for these purposes you'll need another adapter). It's NOT for MDB sniffing, schematics will differ too, due MDB lines are optoisolated current loops. See user manual for actual supported device list.

Get Started

It will be simple to repeat, all components are available and cheap (see parts_list.txt). "Sprint Layout 6.0" software required to view and edit PCB design file "mdb-rs232.lay6".

IMPORTANT:

  • LED mounting height 14mm;
  • DO NOT use device without radiator.

Repository contains enclosure files for 3D printing (for single-side board adapter only).

Burning firmware into adapter's MCU:

This section was added after I sent out dozens of similar responses to requests for assistance via email. It looks like a lot of new people have come to hardware development due to the fucking covid pandemic. OK here's a quick guide on how to start the device after assembly.

So, we need to do three operations: flash the hex file of the main program, flash the eep file with the adapter settings, and set the correct fuses values. The firmware is compiled with the expectation that the chip clocked from an external crystal at 16 MHz, so if the fuses values are incorrect, the chip will not be able to work at best due to incorrect timing, at worst the chip will be impossible to flash using any serial method for the same reason.

Prerequisities:

For the firmware upload, you will need:

*imho, only 2 will be enough, when you're not as extremely dumb as dude on picture below.

For the programmer to work, you need a driver (not for all OS), you can download it on the device developer's website https://www.fischl.de/usbasp/

  1. Connect the adapter and the programmer with 6 wires. Look for the pinout of the ICSP10 connectors in Google, for the adapter it is located in the component designation file (for the double-sided version) or on the board.

  2. Set the correct fuse values, for example, for Atmega644P they will be as follows:

Find the required values for atmega1284 yourself in the datasheet or numerous calculators on the Internet.

You can also set fuse values using the Arduino IDE: select the desired chip, frequency and clock source, programmer and / or port, and click "Burn Bootloader" in the same menu.

  1. Select the desired hex firmware file and eep settings file, and flash them in the same order (Programm button).

Check the result:

As a result, after a successful firmware upload and the absence of assembly and manufacturing defects, you will have a working device. It will look like this: in the absence of a connected peripheral device (coin acceptor, bill acceptor), the MDB Tx indicator blinks, when power is applied, and the VMC UART in 9600-8-N-1 mode outputs the firmware version and that's it. When connecting supported devices (see the manual), the MDB Rx indicator should blink - this is the answers from them to the adapter, and information about the connected devices will appear in the VMC UART output.

If the behavior differs from the one described - either it is incorrectly assembled or it is incorrectly programmed, nobody's advice will help here, read again and do everything carefully, checking each step.

Live demo with ICT A7\V7 bill validator and Currenza C2 Blue coin changer:

Video

Assembled enclosure (render, more in Enclosure folder) Собранный корпус (рендер, остальные в том же каталоге)

PCB design included is one-sided FR4 70x80mm (render) Внешний вид печатной платы 70х80мм (рендер)

PCB rev2a complete package included (render, double-side, RTM)

rev2a finished device photo:

Credits

Inspired by MDB-Sniffer project https://github.com/MarginallyClever/MDB-Sniffer

========================End of English version==========================

Конвертер MDB-UART на базе Arduino

Микроконтроллер Atmega1284 или любой другой (например плата Arduino Mega на основе ATmega2560), имеющий два аппаратных UART на борту, может использоваться как конвертер между обычным компьютером или другим устройством с обычным RS-232 портом, и периферийными устройствами, работающими по протоколу MDB. Он разгружает управляющий компьютер от задач, связанных с опросом шины MDB и конвертированием между 9 и 8 битным форматом, обеспечивает соответствие временным ограничениям протокола и эффективно использует аппаратные прерывания. Обмен данными с управляющих компьютером осуществляется через UART1, с шиной MDB через UART0.

Каталог Compiled_firmware содержит готовые к прошивке образы в офрмате Intel hex, для обеих аппаратных версий адаптера (на базе ATmega1284 и ATmega644PA). Каталог Docs содержит инструкции по работе с прошитым устройством.

Зачем нужен этот девайс?

Чтобы управлять устройствами приема наличных и исполнительными устройствами, входящими в состав киосков самообслуживания (торговых автоматов), по протоколу MDB. Девайс НЕ ПРЕДНАЗНАЧЕН для эмуляции вышеперечисленных устройств, для этого нужен другой адаптер. См. инструкцию для уточнения актуального списка поддерживаемых устройств.

Приступаем

Это не очень трудно, компоненты дешевы и доступны (список компонентов в файле parts_list.txt, магазин запчастей с доставкой http://www.chipdip.ru). Обычно получается дешевле 20 долларов (без корпуса). Файл дизайна печатной платы "mdb-rs232.lay6" для просмотра требует ПО "Sprint Layout 6.0"

ВАЖНО:

  • Высота установки светодиодов 14мм;
  • Без радиатора на регуляторе напряжения использовать не рекомендуется.

Для двухстороннего варианта платы (rev2a) есть архив с полным комплектом технологической документации, для заказа изготовления в стороннем сервисе.

Репозиторий содержит файлы для заказа или самостоятельной печати корпуса устройства (для варианта с односторонней платой) на 3D принтере (каталог "Enclosure").

Рендеры корпуса и печатных плат в английской версии выше.

arduino-mdb-uart's People

Contributors

perdidor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-mdb-uart's Issues

Enabling bill acceptor

Hi @perdidor , thanks for your work and for making this project available.

I was able to get the 1280p talking to a bill acceptor:

image

But I am unable to initialize it, I have been reading the MDB protocol specs but it is a hard read.

Can you please post an example of what I need to type in the SEND box to enable the acceptor?

Min controller flash memory size

Hello,

What is minimum memory requirement for that setup? Used controller seemingly have 128kB flash memory.

Even that project is a low cost one. I am trying to figure a solution for a lower cost requirement project. Thinking of reducing memory on controller to get down its price. I read software uart is not suggested where timing is important.

Thanks & regards,
Ertan

How to make connections?

Hello,

Thanks for sharing your work. It is indeed valuable. I am trying to make MDB-RS232 communication. I have not worked with MDB protocol or vending machines before. Now, I must learn how to do that. I am still waiting vending machine parts to be delivered myself for my internal testings. I do not know what brand and model of a machine I need to work, yet.

My very much newbie questions are:
1- Do I need arduino to use your card? I cannot be sure by looking at information available. I cannot see clearly from the video. However, github name implies this is for arduino and there are some arduino codes, too.
2- I do not see any code for atmega1284 itself. Some people said to me "it is a programmable one. I need to have my code and upload that on that chip itself." I want to say that I am no electronic or electrician at all. I just want to be clarify that chip itself need to be programmed or not.
3- So far, I could not find any AtMEGA1284P-PU chip in my region. I can buy ATMEGA1284P-AU chip. Is that "AU" suffix chip can be used for that project?

Thanks & regards,
Ertan

PCB rev2a - project file

Is it possible to add PCB rev2a project file? I have problem with gerber files. I tried to upload files to the factory but a lot of paths have shortcuts in their system.

Where can I found source for serial1 library?

Hello!

/home/.../Arduino-MDB-UART/MDB_UART_Master/MDB_UART_Master.ino: In function 'void EXT_UART_Setup()':
MDB_UART_Master:75:3: error: 'Serial1' was not declared in this scope
Serial1.begin(9600);

I need source Code for Serial1 class. Where can i found it?

ESP8266 /Wemos. Probably I need other lib than for arduino.

Many thanks,

Bestregards,

achest

Whats the purpose of "MDB_Master.pdf" ?

I checked your pcb folder and saw the MDB_Master schematic. Only with a MAX232. Is this schematic for a simple RS232-MDB Converter cable?

I ask because I want to program my coin acceptor with the manufacturer software (called wheasy) and via the MDB connection. So I need a simple and dump converter circuit that converts my RS232 from PC to 9Bit MDB. Its a EM 800.13 v5 "Münzprüfer" from wh berlin.

Test Program

Hello, I cant' Runn The Test Programm.
How can i run it ?

Communication via USB

Is it possible to avoid the DB9 part using Serial1 to communicate with the mdb device and Serial0 (usb serial) to com with PC?

End of public work notice

The device is currently a simple UART level converter with minimal functions for processing incoming data from MDB. Despite this, the device is quite stable and can be used (and successfully used) as part of several dozen vending machines, where access to the extended functionality of devices supported by the bus is not required, frequent firmware upgrades and no contactless payments are not practiced. The MDBLib top-level library (current public version) supports devices like CoinChanger and BillValidator.
The implementation of FTL functionality and cashless payments requires significant changes to the controller's firmware code, because these modes of operation imply the presence of state-machine onboard for organizing real-time uninterruptible information exchange between the VMC, the cashless device and the converter. You will also need to refine the top-level library to support new adapter features.
In addition to software development, PCB rework will be required to ensure more stable operation and reduce the cost of the assembled board to 10USD max.
Planned time required on the development is more than 150 hours of my personal time, which I simply do not have when it comes to a hobby.
Considering all the above, the work on the current public project is terminated. Bugs will be fixed as they are found (as available time).
Work on advanced functionality (FTL, Cashless operations, support for NACK \ RET etc.) is already underway in private mode. For obvious reasons, the result of this work will not be public. Contact for any questions [email protected]

Cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.