Feed aggregator

Fixing strange characters printing on Epson receipt printers

Geek Zone - Thu, 08/21/2014 - 5:56am

Back in 2012, in my never-ending quest to geek up Tuihana Cafe, I threw together a Windows based app that takes SMS messages and prints them out on our kitchen receipt printer (read about it here).  It allows our customers to make an order on their way to the cafe, without having to stand around and wait for the coffee to be made.

All was right in the world� or so I thought.

Late last year I decided to learn ESC/POS and print directly to the receipt printer, rather than continue cheating by using the Epson .Net OPOS drivers.  This introduced a very annoying bug:

For some reason, the receipt printer or my program was adding in random characters (such as the speech marks before Printed, and the bracket before Sender) and dropping characters (like the O from the word One).  My staff were clever enough to decipher these messages, however this wasn�t completely bulletproof � an order came through for 1x flat white, but the system printed out 21x flat white.  It was then I new that I had to fix this once and for all.

For the last month I�ve been working on a fix, and it wasn�t until today that I stumbled across a blog post with the solution.

BinaryWriter has a method .Write() which takes a string as the input parameter.  Instead of just appending this to the internal buffer, it also (not helpfully) prepends the length of the string in the first byte.

From the blog post:

Now that I think about it, this makes perfect sense: strings in the .NET framework are typically not thought of as being null-terminated, they�ve got a length, and in order for theBinaryReader�s Read(string) method to work, it�ll need to be able to know the length of the string to determine how many bytes to read.

In my case, I was writing data to an Epson TM-T88III receipt printer, and given the structure of the commands that the printer expects, it doesn�t need or want the length of the string in this way. Because I didn�t read the MSDN documentation closely, I was left scratching my head as to why weird characters were showing up or characters were being omitted in my output.

The solution? Replace .write(�Test�) with .write(Encoding.ASCII.GetBytes(�Test�))

The new receipts all fixed up and looking purdy:

Hopefully this helps someone out from weeks of frustration and programmer rage.

NZ Tech Podcast 193: A visit to Ford Research, Samsung Galaxy Alpha, Tesla’s unlimited warranty

Geek Zone - Wed, 08/20/2014 - 6:07am
This episode we focus on the Moto 360, Samsung Galaxy Alpha, HTC One W8, Tesla's 8-year unlimited KM warranty and why we'll soon need lots of 3D printed organs. And we visit Ford's Asia Pacific Research and Development centre to see their latest tec... (more in the full post)

Going to Microsoft TechEd New Zealand 2014–who else is joining me?

Geek Zone - Sun, 08/17/2014 - 6:45pm

I got the confirmation I will be attending the TechEd as a Microsoft guest (same as in previous years) with other media presence.

In the meantime, I have just finished working on something with Intergen for their stand - you folks probably remember in previous years there were racing cars and the stand was quite popular.

This year, working with Microsoft Xbox and Activision there will be Guitar Hero competition - prizes include daily JB Hi-Fi voucher and a Xbox One with Kinect at the end of the competition. More information here: Intergen Guitar Hero Geek competition at TechEd.

NZ Tech Podcast 192: China cracks down on online rumours, Sony 4K/UHD TV iPhone 6, Renaissance to liquidate

Geek Zone - Wed, 08/13/2014 - 6:11am
This episode - China's crackdown on online rumours, the predicted iPhone launch in September, Sony UHD/4K TVs, Lenovo's IBM acquisition, video streaming options for NZ, Microsoft Cortana and Windows 9, Nokia Lumia 930, Telecom becomes Spark and more... (more in the full post)

NZ Tech Podcast 190: NZ’s Electron rocket, the selfie toaster, Skinny’s HTC Desire 310, Microsoft China raided

Geek Zone - Wed, 07/30/2014 - 7:30am
Paul visits Rocket Lab and discusses the Electron rocket with founder Peter Beck. Also discussed the low cost HTC Desire 310 launched by Skinny Mobile, the selfie toaster, a police raid on Microsoft China and further insights with the LG's G3 hero p... (more in the full post)

NZ Tech Podcast 189: LG G3 hands on, Vector fibre network grows, China’s $15 wearable, 60-million iPhone 6 handsets in production?

Geek Zone - Sun, 07/27/2014 - 11:46pm
Key topics this week include our hands on experience with LG's upcoming G3 handset along with discussion about Vector's fibre network expansion, China's $15 waterproof fitness monitor and sleep monitor and Samsung Galaxy Tab S and its 4G LTE variant... (more in the full post)

Debugging, old school

Geek Zone - Thu, 07/24/2014 - 11:25pm
This user complained of intermittent crashes and failure to boot.
Externally it looked ok.
Not too much dust.

After opening noticed little black streaks all over the place.
Identified as cockrock feces.

Sure enough I spotted some live ones chilling out on the ram.

I wonder how manymore I will find toasted in the power supply.

NZ Tech Podcast 188: TV spectrum goes 4G, Wheedle death, Gather, Wireless charging, LG G Watch

Geek Zone - Thu, 07/17/2014 - 6:45pm
This week we discuss the sale of Sir Peter Maire's Fusion Electronics to Garmin, the death of Trademe competitor Wheedle, Auckland's Gather event, wireless charging, Vodafone and Telecom's battle for 4G supremacy and more on the LG G Watch. This NZ ... (more in the full post)

NZ Tech Podcast: Roaming, Taking off with tech, Hands on with Android Wear device LG G Watch

Geek Zone - Sat, 07/12/2014 - 7:27pm
We discuss Google's wearable Android Wear including a hands on look at the upcoming LG G Watch (which happens to arrive part way through the episode). Also on the agenda - 2degrees new Australian roaming, another investment for Telecom, Unisys' new ... (more in the full post)

NZ Tech Podcast: Google IO, 2degrees 4G LTE launch, Govts $65m towards the Hawaiki undersea cable

Geek Zone - Tue, 07/01/2014 - 1:00pm
On this week's NZ Tech Podcast we discuss 2degrees 4G LTE launch and their customers desire for fixed internet, the highlights of Google's IO Conference, the Govt's $65 towards Hawaiki, Microsoft OneDrive vs Google Drive, CallPlus unlimited business... (more in the full post)

Mobility Scooter eCarts conversion

Geek Zone - Mon, 06/30/2014 - 2:58am
After seeing how cheap mobility scooters were going for I decided to try and turn one into a little electric cart for the 'kids'.
Mechanically they would be worlds better than the plastic kids ride on toys you can get.

eg
https://toyshouse.co.nz/?cms_do=sale&sale_do=sale_show_one_product&product_id=2037


I wanted a 4 wheel model, 3 just wasn't going to cut it.

Picked up one for $100 ish.


Cosmetically it was a little rough.
Frame OK.
Batteries were dead.
Controller had a fault.
Motor OK.
Tyres OK.

The important bits were ok.
Frame, Motor, Tyres.

Due to the age of the system, there was not many troubleshooting documents to be found on the interweb.

I also wanted to run it at 36V, which the stock controller would not be happy with.
Going diy you do loose some of the nice built in features of the controller, unless you buy another with those features.
-Over current protection.
-Regenerative braking.
-Speed regulation
-lots of others
Something with these features is about us$230 landed
http://kellycontroller.com/brushed-motor-control.php
KDZ48201

The controller was stripped down to see what was inside.


12 years old? Look's like new :)

H-Bridge Mosfets were rated to 60V. P60NE0
There were 2 Driver ICs. ir2104
We will be able to reuse this part of the controller.

The drivers make it much safer on the hobbyist since you can't short the battery by setting the wrong Mosfets on.

There was a voltage regulator onboard (7805) but I could not easily figure out how to turn it on.
And didn't want to risk breaking anything else on the board in case I want to use it later on.

Cut the signal traces to the H-Bridge drivers.
Supply control signals and whola.
Working motor controller.


Bits used
-12v Regulator
LM317, might bump it up to 15v.
Or change for a DC-DC to maximise efficiency.
-Arduino ProMini v2 (Clone, m168)
-Pedals from a computer steering wheel racing set.
-Battery will be a Lithium Polymer (LiPo) pack from Hobbyking.
us$116 landed for a 33.3v(9s) 5.8Ah
Top speed should be 15-20kp/h
At low speed for the kids we should get 30-45 mins runtime.

Currently the program on the Arduino is pretty simple.
Push accelerator pedal to go.
Let go to coast.
Push brake to stop.

To potentially add
-Reverse.
Pretty simple in code.
Just need to add a switch.
-Boost button.
Low speed with a 10 second full speed boost available every few minutes.
Make racing interesting.
-Adjustable max speed.
So multiple carts can be set to the same max speed.
During a race it will be driver skill that determines the winner.


Other people have put petrol motors in theirs.
I stayed with electric to keep the noise/maintenance/risk down.
A friend is helping with the metalwork/fabrication side.

Can do a more detailed write up if 3+ GZ members are interested. :)