Dead RCA TV

I found a dead RCA RLDED5832A-B on kijiji for 20$. Figured 20$ was a decent gamble on a 32″ TV. I got it home and confirmed that it was indeed dead. When I plugged it in the LED was red on the front but nothing happened when the power button was pressed. I popped off the cover to have a look and nothing was obviously burned. I applied power to the back light to see if there might be any dead leds or bad connections but it lit up fine.

The main board for this TV is numbered TP.MS3393.P81. In this TV it does everything, it’s the power supply, controller, backlight driver. The only other board in there is the tcon board for the panel. After some reading around about MSD3393 based controller boards there was talk about corrupted/failed EEPROM, and it matched my situation, it seemed like everything should be working but it just wasn’t being told to turn on.

I desoldered the memory chip from the board and soldered it with fly wires to a raspberry pi A+ that kicks around my bench. Using the flashrom program it was easy to dump the contents of the eeprom out to a file for a look. The fact that I was able to dump the contents seemed to go against the theory that this chip had gone bad, but who knows.

IMG_20170224_2121302017-03-16 09.09.44

I ordered a set of 10 EEPROM chips from ebay for about 5$ (PN W25Q16BVSSIG) and waited about a month. When they arrived I loaded one up with a eeprom bin from a different TV with a similar mainboard, specifically with the same processor, and soldering it down on the board. Semi-success!! The TV lit up and booted, and after struggling through Spanish controls, I was able to get an HDMI signal from my Pi on screen. With the still disassembled panel propped up on my bench it looked like I had a new TV! It was at this point I noticed that the RCA logo on the frame of the TV had somehow turned itself upside down… shit… so had everything else… so the TV that my eeprom file originated from was likely almost identical to mine except for one key detail, the panel was installed 180 degrees to mine.

I was tempted to just deal with this. Maybe install the TV on a wall mount and just suppress my gradually building rage at the upside down RCA logo staring back at me. But this wouldn’t do…. I had searched all over the internet for a BIN file for this specific TV, and despite finding several roms for very similar TVs (there’s a surprisingly large online community of people that like dismantling TVs and dumping their memory contents, go figure) I couldn’t find mine. I did have the rom that I was able to pull from my “bad” chip initially though, and when I compared it to some of the ones from online it looked sort of similar. So I figured why not take a chance just burning the same rom back to a new chip and see if it worked. Well, that resulted in full success!

IMG_20170428_074904

I don’t know why that worked, all I can think is that something went wrong with the chip that stopped it from working at the full speeds the mainboard ran at,  but the relatively slow speed I read it at was ok.  Anyhow, now I have a working 32″ TV I need to find a use for…
And if anyone needs a rom file for a RLDED5832A-B you can find one at this link

Advertisements

Stepper Gauge

VID_20170316_082442-2

Today seemed like a good day for cleaning out junk drawers, and I’m proud to say I successfully completed half that job!  While looking through the heaps of crap I absolutely need, I came across a questionable stepper motor driver and stepper motor. Odds are the reason I had it is because it doesn’t work, but of course I’m not going to throw it out without testing, and with a three year old repeatedly asking “what’s that?” it seemed like I had no choice but to hook it up and start screwing around.

2017-03-16 09.02.372017-03-16 09.02.19

The stepper driver is a pretty standard type, it takes two input signals, one tells it which way and the other says how many. Steps that is. So where do I get these signals? I have a raspberry pi that floats around my bench that I can make use of when I need some GPIO. Ignore the rainbow of other wires going to the right in the photo, they’re from another project that I can’t disconnect because I’m totally going to finish it someday. The only ones that matter here are the three wires going southbound. Those three wires are STEP, DIR, and GND.

2017-03-16 09.04.28

The only thing left was motor power. If you’re looking for something to add to your test bench at home, go to ebay and pick up one of these XL6009 step up DC-DC converters and stick a couple 2.1mm barrel connectors on each end. (pick up a couple 10 packs of 2.1mm barrel connectors too while you’re there.) So handy. It turns any wall wart you have kicking around into an adjustable voltage source. I used mine to boost from my 12v adapter to the 24vdc that this motor requires.

2017-03-16 09.03.53

Here’s the whole package assembled. Nothing to it really.

2017-03-16 09.09.44

The other only thing left was to hack up some software. Toggling the outputs manually proved that the drive and the motor worked. I can move the motor. But then what? Steppers are so easy, all you need to do in order to make them move is turn that STEP line  on and off a bunch of times and the motor will move 0.1 degree that same bunch of times, so the code is kind of boring. The fun had to come from what numbers to send. The pi was connected to the same wifi that my thermostat/gaslogger/powelogger was on, so I had plenty of numbers to choose from. Using my socket for realtime power monitoring  seemed like the most logical choice, so the code below was the result. It polls the power consumption every two seconds and moves the stepper 1 step per watt. I threw a little cardboard pointer on it to make it easier to see the movement.

2017-03-16 18.19.10

Then I added a cardboard backing to make it even more gauge like….. This is the gif from before my assistant helped out with some decorations. Aww yeah, that’s some awesome, shoddy ass gauge at work.

VID_20170315_185341-2

I was really entertained by this bout of screwing around, it made for a fun afternoon. More entertained than my kid it seems….something about having to turn on the microwave, or wait for the furnace to start before seeing anything happen wasn’t compatible with her attention span I guess. Maybe I’ll hook a joystick up to it or something for a bit more instant gratification, or I’ll just cut up more cardboard for drawing on…yeah, probably the cardboard thing.

It is worth noting that you can make up something like this really damn cheap these days. On ebay, an equivalent stepper driver can be had for around 2$, stepper motors anywhere from 5$ to 20$ depending on how much you need to move. Stick a 5$ esp8266 based controller on there and you can have a wifi connected stepper, or steppers, somewhere in your house doing…. I dunno… something!?

The python code is pretty simple, but it’s available here if you’re interested

Power Logger

With a design along the same lines as the Gas Sensor Logger, I made up a power consumption monitor for the house.
I installed 4 clamp on current transformers in my panel, one on each of the 230v legs coming in, and two that can be clamped on any circuits of interest. With the transformers and an arduino wired up pretty much exactly as described at this link I was able to load up a sketch that would provide a accumulated total of power consumed.

 

The arduino is connected to one of the USB ports on the raspberry pi that’s running my Thermostat Project, which means I was able to write an additional daemon that could poll the arduino for power measurements and log them to the same mysql database that all of my environmental data gets logged to. With that data being logged I’m able to make some pretty graphs to display power consumption.

The code for both the arduino and the raspberry pi side of things is on github at https://github.com/rhasbury/GasSensorLogger. I might break it into its own repo at some point but for the moment the two are so similar they can hang out in the same place.

I found that having the graph for reviewing the days consumption was cool, but for finding out what the different items in the house draw I really wanted to have a gauge with a needle, so one addition to the power logger that isn’t in the gas logger is a tcp socket that is made available for requesting realtime (down to ~2 sec) power measurements. If you send a “get_powers” string to port 50008 on the pi it’ll send you back a json string like so:

{“onetwentywatts”: 676.87, “clamp1watts”: 97.17, “clamp2watts”: 12.43, “twofortywatts”: 226.56, “totalwatts”: 903.43}

So with the help of a php script and some borrowed d3 code I got something rough put together. These are hosted on that same thermostat pi, so these graphs and gauges are available to any device connected to the lan. It’s nice to have this graph on my phone while I’m wandering around trying to figure out what’s burning so much power!!$!$$

The code for the graphs and gauges are in the github repo as well, under the rpi/http folder.

 

 

Motorcycle Temp/Information Display Unit

A while back I built up a temperature monitoring project for my motorcycle. The idea was to add a small LCD screen somewhere on the bike that would display cylinder head temperature to help give an idea if anything was amiss. It worked ok, but proved too bulky to really mount anywhere, was too hard to read in sunlight, and was ultimately too ugly to really make use of. Since then I’ve been gradually accumulating parts to create version 2.0. It’s not installed yet but its starting to resemble something that could be installed:

2016-10-21-09-43-01

To break down whats in that photo, in the aluminium box at the top there is

  • Raspberry pi Zero
  • DC-DC Step down power supply to take 12v down to 5Vdc for the Pi

Attached to the box via the black connectors, from left to right:

When its installed, that aluminium box will be hidden somewhere on the frame of the bike and the various sensors will be installed in appropriate locations so they can see or feel what they’re supposed to.

Enough stuff has been swapped out that it’s an entirely different project from the last one. The Netduino has been replaced with a Raspberry Pi zero. The difference this makes is pretty enormous. Before, the board I had built could read temperatures and write them to a screen. With the new board I can read temperatures and write them to a screen, save them to a MySQL database, host an http server that can plot the saved data, host a WiFi access point so I can connect with my phone and view that data, and all this in addition to GPS data or any other data I like. It’s really staggering the processing power you can get for under 20$ these days.

The old 6100 LCD has been replaced with a tiny (and I mean tiny) I2C OLED module that I’ve put in a plastic enclosure that is small enough to be cleanly zip tied to my handle bar. A thought that occurred somewhat late was that it would be nice to have multiple display modes (readout mode, graph mode, clock mode, etc) however I hadn’t planned in any way to switch between modes. The 4 conductor I2C wire going into the LCD box didn’t have any spare wires for a GPIO, and I wasn’t going to run any more, and I didn’t like the idea of trying to find a place on the bike for a single mode change button all by itself. Turns out I2C really is a great thing, because I was able to squeeze a tiny ADS1115 module and a button into this matchbox sized enclosure, and that gave me the ability to add a button without running any additional wires. Sweet!oled_pic

With the GPS and the Mysql database on board it makes for some really interesting data mapping potential. I have yet to make a fully automated version of this, but with with some manual steps I’ve been able to make use of output files and the tools at http://www.gpsvisualizer.com/ to draw gps tracks colourised by temperature data. In time I’m hoping to build this into a one click view. tempmap

At the moment it can only be viewed once I get back home and the bike connects up with the home wifi, but with some configuring it may also be possible to have it connect to my phone as an internet hotspot and view it while out and about.

The Accelerometer/Gyro module and the LED ring are both items that got added without really knowing why. The LED ring seemed like it could make a neat light up gauge, but I’m not sure where to mount it, or what to display. Something to mull over for the winter I suppose.

With winter coming this whole thing won’t likely be installed on the bike any time soon, potentially it never will because I have a feeling the ignition noise generated by my old Kawi will wreak havoc on all of these sensitive 3.3v data lines, but it’s been an endless supply of learning and entertainment putting the thing together.

Code for the project is up at https://github.com/rhasbury/MotorcycleMU At the time of writing this code is functional but oh so ugly… It grew out of an old application I hacked together quickly for saving sensor data to MySQL , and there’s alot of stuff in it that needs to be cleaned out. But it’s up for anyone that wants to have a look. Who knows, there might be something useful to you in there.

Red River Thermostat 2.0

I’ve made enough changes to the thermostat project that I figured it was worth an update. Firstly, I changed the way the web interface interacts with the thermostat daemon. Previously the web interface was hosted on a http server that was built into the webiopi package. This worked ok but it limited things like php scripting and methods for connecting to the database. Now, all of the web stuff is hosted on a separate lighthttpd daemon and it fetches information about the sensors and the state of the thermostat via a socket to the running thermostat daemon. PHP scripts on the http server take care of connecting to either the daemon or the mysql database and pass information to the javascript in a sensible way which makes things…….simpler(?)  It’s easier for me to know what’s going on anyhow, and it’s forcing me to learn alot more about javascript, PHP, and web app development

With the more capable http server I was able to incorporate some more interesting visualizations for the temperature display (gauges came from here).

Screenshot from 2016-04-23 07:05:11

 

The reasoning behind creating the socket based communications with the thermostat was that it would make creating new control applications simpler. In the long run I might make an android app that’ll be a bit snappier than the web interface. A kodi plugin is another possibility, to allow me to see/change the thermostat from our media pc. Both of these are made easier by having a socket based connection that spits out easy JSON blobs for processing. Here’s an example of what comes from a request for sensor parameters:

{“LocalSensors”:
{ “Living Room”: { “humidity”: 0, “i2c_address”: “0x77”, “pressure”: 97281.0, “read_successful”: true, “temperature”: 29.4544021645641, “type”: “bmp”, “webiopi_name”: “bmp0” } },
“RemoteSensors”:
{ “Bedroom”: { “humidity”: 0, “ip”: “192.168.0.103”, “pressure”: 0, “read_successful”: true, “temperature”: 29.46, “type”: “tmp”, “webiopi_name”: “bmp0” } },
“webiopi”: 1 }

Here’s an example page showing environmental data for the past few days. The outdoor temp looks a little crazy because the sensor catches some sun in the middle of the day. You can see the inclusion of the Time v Gases in the bottom right graph, that’s data being logged from the gas sensor board, which turns out is pretty boring. I guess that’s a good thing though…

Graph_Frame

Below is a run time graph for the equipment being controlled. Should give an idea of my energy consumption once the database get’s more filled out.

Runtime_graph

The next thing I’m planning to add is an electricity monitoring page. I ordered some cheap clip on current transformers that I can stick in the panel to read current draw, they can be used to log  our power consumption to the same db, and hopefully can be used to work towards getting our outrageous hydro bills down…

Code is up as always at https://github.com/rhasbury/Thermproject

 

 

 

 

Gas Sensors

Since I’m addicted to cheap ebay electronics, I had to pickup an assortment of these MQ Gas sensor modules. I got an MQ-5, 9, and 135. I initially thought that these would all measure different levels of different types of gasses, but after more reading and experimenting it seems like they all seem to measure the same gasses just with different sensitivities. So my board with three of them on it might be overkill but they’re so cheap!

Anyhow, I made use of an arduino nano to serve as a USB ADC. The super basic sketch running on it simply waits on the serial port for “get_aX” command and returns the value read from X analog input as an integer. The connections to these things are dead simple, just provide VCC and GND and then connect the A0 pins to the Ain pins of the arduino. The only catch I found was that they draw about 100-200mA each, which means that if you feed them and the arduino from the USB 5V it can be too much for the USB port. I’m planning on plugging mine into a raspberry pi that doesn’t have much to spare, so I feed the Vcc of the sensors from a separate 5V supply.

IMG_20160401_130922

 

The idea is to hook this up to the Raspberry Pi in my basement, that’s already operating as my thermostat/data logger, and have it start logging what it sees….I’m not sure what that’ll be, but I’m curious to see if it can detect any leakage from the water heater or furnace exhaust. After I get some bulk data I might be able to even set it up with an email notification for higher than normal levels of CO or natural gas detected, not that it’ll ever be a replacement for the real CO alarms that’re installed throughout the house.

It works pretty well so far. Tested on the bench it could definitely detect the gases coming off a little butane torch. We’ll see what it shows after spending a week in the basement, I don’t expect to see many gas leaks but it might be able to tell me when it’s time to change the litter box…

GasPlot

It’ll connect up to my thermostat project board via USB. A small python application will be running on the Pi to pull the values off the arduino and log them to the mysql database. Code’s up at https://github.com/rhasbury/GasSensorLogger for anyone interested

Red River Thermostat

This is a project that I’ve been slow to post about because it’s been hard to decide when to call it complete enough, I may not be there yet but something’s gotta be posted.

Our house is heated and cooled with forced air, it’s either on or it’s off, and the thermostat was mounted in the living room that we’re not always in. This means that during the night, when we have our bedroom door closed and are evidently acting like food fueled space heaters, the temperature climbs to uncomfortable levels and the thermostat at the other side of the house is unaware of that. During the day, when the sun warmed up the living room through our large window, the thermostat thought all was perfectly fine while the kids in my wife’s daycare downstairs are getting very chilly.

So what I needed was a way to control the thermostat based on the temperature in different locations at different times of the day. Since I have raspberry pi’s scattered around the house for various other purposes it made sense to make them do dual duty as temperature sensors. The diagram below gives a rough idea of the system layout.

Thermostat.png

The temperature sensors are a mix but all I2C. HTU21D, BMP085, and TMP102s are all compatible. Here’s a picture of the Main Thermostat Pi. The I2C connections tie into the terminal strip on the top left. The two sensors on this one are at the ends of about 10′ of cable. I’m likely breaking some rules when it comes to I2C there, but I don’t seem to have any communication errors so I’m not gonna think to hard about it. One thing to note is that these 5v relays can’t get their power from the RPi header, they pull enough current that it’s a problem (sd corruption and brownout issues), so they need to be fed from the power supply directly.

IMG_20160214_205512

The thermostat status and settings are accessible via a web interface hosted on the same pi. It’s so nice to be able to call this up on my phone and bump up the heat without getting out of bed 🙂

ThermoWebinterface

As it is now, the program is built around the Webiopi package, which takes care of the IO management as well as the web interface. As things progress, I’m moving away from webiopi http hosting and gradually building up a standalone html/javascript interface that can do some fancier graphs and visualizations. All of the temperature data that’s being monitored is also being logged in a mysql database. As of today it’s been running for just about 10 months. The only big hiccups I’ve had are with some unique exceptions not being dealt with properly, and the SD card filling up at one point because I was logging about 4000 times more data then was really necessary.

The code is up at https://github.com/rhasbury/Thermproject if anyone’s interested, but at the moment (Feb 15, 2016) what’s checked in doesn’t actually match what’s running, and likely doesn’t even work. It’s in the middle of a large rewrite that changes the way the UI interfaces with the controller. So stay tuned for an update when version 0.2.0 appears.

 

 

Raspberry Pi B with Camera Module and Motion

I was struggling to find a step by step process for getting the camera module + motion up and running on the pi with recent instructions due to broken links and missing repositories so I figured I’d write up what worked for me as of

Dec 23, 2015

This is using a raspberry pi B, 2015-11-21-raspbian-jessie-lite, and an ethernet connection to the internet.

I initially set mine up using the camera module and a usb wifi module but those two together seem to draw more current than the board can supply, which caused brown outs and a corrupted sd card.

To the steps:

As with most things, start with

sudo apt-get update

sudo apt-get upgrade

 Reboot

sudo reboot

Install video dependencies (this was the hard part to find lately)

sudo apt-get install -y libjpeg-dev libavformat56 libavformat-dev libavcodec56 libavcodec-dev libavutil54 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev

Install motion and its dependencies

sudo apt-get install motion

Update Oct 29, 2016: The newer versions of motion available for raspberry pi now have mmal support built in so the instructions struck through below should no longer be necessary. 

From your home directory download this prebuild version of the motion application

wget https://www.dropbox.com/s/6ruqgv1h65zufr6/motion-mmal-lowflyerUK-20151114.tar.gz -O motion-mmal-lowflyerUK-20151114.tar.gz

Unpack it

tar -zxvf motion-mmal-lowflyerUK-20151114.tar.gz

Copy the unpacked version of motion over the stock one

sudo cp ./motion /usr/bin/motion

Copy the unpacked motion-mmalcam-both.conf to /etc/motion.conf

sudo cp ./motion-mmalcam-both.conf /etc/motion.conf

Run raspi-config and enable the camera, and any other pi options you like

sudo raspi-config

Reboot again

sudo reboot

Test it

motion

If the application seems to be running ok then at this point you should be able to browse to http://:8081 and see a live view of your camera.

If that’s working, and you’d prefer motion to start on boot, edit the file at /etc/default/motion, and change start_motion_daemon=yes

The bulk of this information was harvested from this forum thread, thanks to all the guys on that thread for their explainations. Hopefully this consolidation of info will help some people.

Here’s a link to the current motion github https://github.com/Motion-Project/motion

 

 

Sign Time

Needed a sign for our home daycare to put out front that looked a little more permanent. We had a plastic printed version on a set of plastic stilts but it was kind of cheesy looking and I think it looked too much like a realtor sign, so over the Aug long weekend I put one together. 

Here’s the final product planted out front. 

IMG_20140805_121457(1)

It was a simple build. Made use of some 1″x10″ pine boards. Used the router to cut 1/4″ channels along the side rails. These fit the sign as well as the tenons on the ends of the cross rails. 

IMG_20140802_213748

Here are all the bits after staining. I used Minwax 233 “English Chestnut” for the stain, and followed that up with three coats of Helmsman Spar Varnish. 

IMG_20140802_223634

The varnish really shined up well, here’s hoping it does well against our Canadian weather. 

IMG_20140804_155828

Sensory Board the Prequel

This is a board I made up for the kids in my wife’s daycare. It features alot of the stuff kids are typically being told not to play with like light switches, buttons, knobs, wheels, and those spring door stoppers that even I like to play with every now and then. In fact, if the whole board was spring stoppers I think the kids would have been just as happy. The switches turn on a few high intensity LEDs that are mounted behind a set of trailer reflectors. Button 1 turns on a small PC fan mounted behind some hardware cloth. Button 2 turns on an electro magnet in the center of the board which picks up the piece of chain dangling in front, although that part isn’t as easy to use as I hoped it would be. The black holes on the left top and bottom of the board are openings to a piece of 3″ ABS pipe that’s big enough for a tennis ball to roll through. The little wooden knob is pressed onto the shaft of a stepper motor which is connected to another LED under the third reflector. There’s no external power there, the stepper just works as enough of a generator that when it’s spun it lights up.

IMG_20140618_191140

 

It’s a little more rough ‘n ready than the more recent one I made, but it does the job. The kids seem to love it.