You will need to first get a protocol sheet for the device in question (or technical manual), this will describe how to communicate with the device.
Then, you need to create a new Device Template describing the device, and its capabilities.
For simple devices, you can simply write the code in Ruby, using the built in editor in the web admin. These devices are called Generic Serial Devices (GSD), and you can read all about them by searching for those two terms GSD and Generic Serial Device on the wiki.
For more complex devices, you can write the code in C++, and use the "Developing a DCE Device" page as a guide for filling out the device templates, and setting up an environment for C++.
Look at other GSD devices to see how they work (one example is the Panasonic IP Camera template), and as always there is plenty of help here on the forums or on IRC, and others here have written GSD devices who can definitely help as well.