Hacker News new | past | comments | ask | show | jobs | submit login
Analog TV Station on ESP8266 (github.com/cnlohr)
365 points by dvfjsdhgfv on Dec 7, 2020 | hide | past | favorite | 73 comments



You all might also enjoy analog TV encoding/decoding in your browser: https://substack.net/tv

based on these repositories: https://github.com/substack/glsl-ntsc-video - modulate and demodulate an ntsc video signal in a shader

https://github.com/substack/ntsc-video-simulator - real-time ntsc television simulator

https://github.com/substack/analog-tv-simulation - the demo itself


Substack! Now that's a name I haven't heard in a long time.


This guy is great -- the livestream VR coding stuff is pure hacking fun, and it's all so painfully wholesome. Highly recommended.


This comment made my day.



Ha, I will give this a try. My current setup: I have a Browni portable TV [0] from the 1960ies in my home office (20 EUR on Ebay 13 years ago, still working perfectly), hooked on a composite to coaxial adapter, hooked on a HDMI to composite adapter, hooked on an old Chromecast. Even the audio works perfectly. But using the build-in antenna of the Browni would be even better.

[0] https://www.radiomuseum.org/r/cbc_browni_transistor_tv_space...


The standard ham radio cry of "think of the spectrum" applies here. It's great as a demo but please don't intend to use it for anything serious, this is likely outputting harmonics into areas of the RF spectrum that people care about.


Slightly related anecdote:

I have a raspi zero whose only job is to set its clock frequency to 104.1 MHz and modulate it with Daft Punk’s Daftendirekt every morning for a clock radio that I picked out of the trash.

Well below the 5 mW power limit but it comes through clear in the same room.

Edit: for the first week I was broadcasting over the local NPR station. There were likely people on commutes nearby getting interference from me, so I switched to dead space.


I am hesitating to ask, but would you mind sharing the code?


I wrote nothing. Be warned: setting the transmit frequency below 100 MHz will result in the raspi locking up.

https://github.com/markondej/fm_transmitter


I was wondering about this with the OP. I wonder what the power level is?


Outputting a TV signal isn’t inherently a problem, surely? Every VCR and 1980s home computer has a circuit that does the same thing. Would only be an issue if you run it through an amp and antenna, rather than just running a wire to a TV, right?


Those sources are likely shielded and clean.

A transmitter like this will radiate harmonics, and that's the major concern. It is not just a TV signal.

All that said, this is nice work. Analog signals are a lot of fun.

NTSC going away makes me sad. I have abused it to great results many times over the years.


But doesn’t that concern about unshielded dirty signals apply to basically any use of a GPIO pin on a dev board?


Yes and no. Depends on the frequencies, whether the pin is driving a load, and intended to radiate.


Probably not at a power level which really matters?


Waves can propagate in very unpredictable ways and create unintended consequences. It's better be safe than sorry is very applicable here.

Even a ~1W radio can go a long way, even in a city. So, yes, think of the spectrum.


1W is a fairly massive amount of power though, a typical small DIY project will output a couple of mW. So unless you very explicitly start amplifying it after your oscillator there most likely will not be too much power radiating out unless you hook it up to another stage or a directed antenna (which gives you a passive way of boosting the radiated power by concentrating the output on a more narrow angle).


Yep, you're right. However, since Walkie-Talkies' power is around that level, I thought it'd be a good example to build upon.

Regardless of the power level, thinking about spectrum and trying not to create harmful interference is important IMHO. I live in a place where listening FM in stereo mode is impossible due to interference and radio transmissions around me. Even Wi-Fi cannot penetrate beyond next room.

We've looked how spectrum looked here with a listen-only SDR. It wasn't pretty. My friends' exact words were "Dude, that's not what I see at home. This is some serious traffic."


WSPR managed to transmit data at 150,000 Km/W [0], so yeah, unfiltered transmissions are a pain in the ass for the rest no matter the power.

http://wsprnet.org/drupal/node/5089


Radio waves travel for long. I remember getting local AM radio tunes 100 km away from the border of my province where in theory the radio is being set for.


Broadcast AM radio stations here use hundreds of kW of output power.

This is a bit bashed GPIO pin on a 3.3V microcontroller that has a max current rating of 12mA per pin. Even if that piece of wire used as an antenna here were capable of loading the pin up to its max output, it'd be something around 0.004W - and in reality it'll likely be an order of magnitude or two lower than that. That's at least 8 orders of magnitude less power, and even allowing for the inverse square radiation power pattern, this this is only gonna be detectable at single digit meters in all likelihood.

This _is_ a bad idea, spectrum noise and interference wise, but it's unlikely to have enough power at either its intended transmit frequency any of its nasty harmonics to make it outside the rooms it's in. You probably might not want to take this to hospital with you, or on that camping trip near the radio telescope, but I wouldn't think twice about firing this up in my home workshop...


Consider also how much electronics around us which leaks harmonics all over the place without any modifications.


Similar project with ESP32 for Composite Video [by bitluni]: https://www.youtube.com/watch?v=5t1_XNc3vNw


Bitluni and CNLohr are two of my favorite hardware hackers to watch on streams/videos. They both have such creative ideas and intense passion for getting the ideas working no matter how many walls they hit. Lots of fun to follow along even if it’s way beyond my understanding half the time.


Great work! This reminds me of a book I read over 40 years ago: https://www.amazon.com/Cheap-Video-Cookbook-Donald-Lancaster...

Apparently Don has made the above book available on his site: https://www.tinaja.com/ebooks/cvcb1.pdf


Wow this is hacking in the most literal sense: using something in a way it was not designed for. Even avoiding nyquist problems by abusing some mirror effects if I understood that correctly.


Similarly, a favorite ESP8266 hack of mine is this Apple I emulator that includes wireless PAL output:

https://github.com/hrvach/espple


Thanks for the link! Interesting project. Is there a source for the emulator part? There are only binaries here: https://github.com/hrvach/espple/tree/master/software


Yes, entire project is open source - check https://github.com/hrvach/espple/tree/master/user


I remember a similar hack from 1999 posted on the venerable Slashdot on broadcasting FM radio using a memory bus as the carrier....

Ah, here we go, thanks to the Wayback Machine: https://web.archive.org/web/20010419225940/http://jya.com/te...


I suggest doing something useful: Tiny emergency transmitter at Marine VHF16. This is voice-only channel, so maybe it should just repeat prerecorded message at every hour. Rescue services can pinpoint the source, so nothing fancy needed. Activating this transmitter would be illegal, but me myself prefer life in prison to death.


47 CFR § 97.403: Safety of life and protection of property.

> No provision of these rules prevents the use by an amateur station of any means of radiocommunication at its disposal to provide essential communication needs in connection with the immediate safety of human life and immediate protection of property when normal communication systems are not available.


I'm sure there must be something that covers it, but I'm not sure it that.

That seems to only apply to amateur stations, which 47 CFR defines as stations in an amateur service. I.e., ham radio stations.

I've got a ham radio license, so it would cover me if I transmitted outside of the ham bands, or exceeded power limits, or used an unauthorized modulation method to try to help save lives and protect property, but for someone without a ham license I think we'd have to look elsewhere for legal cover.


I think some guy in Oregon ended in prison because he activated the EPIRB dozens of times -- for broken fingernails and other such emergencies.


I can't really imagine this having any advantages over a PLB which are fairly inexpensive and already built to be waterproof and impact resistant. PLBs are monitored from orbit by COSPAS-SARSAT and modern versions have active location reporting which nearly guarantees fairly rapid reception and location fix. Satellite monitoring of aviation guard (121.5) has been officially ended by COSPAS-SARSAT and I'm not sure it ever monitored marine radio. Radiolocation of VHF 16 can be done but is going to be substantially more time consuming and less accurate than a COSPAS-SARSAT report - accuracy requires having nearby vessels properly equipped or sending an aircraft.


They are not inexpensive. In Finland you need a Radio Operator Licence and pay some 20€ annually and also you have to pay for reprogramming the special "National ID". And thus this mostly useless device costs 400€: https://www.marnela.com/product/1304-01261

Some 40 years ago I made 2 Mhz emergency Morse transmitter from RCA Cosmac, because I planned to spend a summer on Antarctis. It worked quite well with long ass wire antenna. But they do not monitor that frequency anymore and nobody understands morse.


Looks very cool, but it’s been almost a decade since I’ve last had an analog TV. Do people still have them around?


Even new systems have them, probably because the radio on the chip is something SDR-ish; also, there is equipment that still transmits analog signal, just not over the air (think CCTV et al.).

So yeah, the receivers are still shipped, just ~nobody tunes into their ranges anymore.


They don’t come with antennas though (and houses don’t have them anymore), so the majority of devices are unable to tune to anything. In my country everything has moved to digital and the spectrum sold for mobile use.


I'm receiving DVB-T2 off the same wiring and antenna that was used for DVB-T, and analog before that. shrug Different part of the world, perhaps?

https://en.wikipedia.org/wiki/Belling-Lee_connector


If you have something that generates the signal, and something that receives it, the antenna is just a wire between those two (of course, you better power them off the same source).


Indoor antennas can be bought for like $15 here in the US


The US is sparse. In Europe you are like in a tin of sardines and most people live in flats. I can't get dvbt over the air where I live because of:

1) Everyone got fiber tv so the old communitary antenna has been taken down from the roof

2) My building is surrounded by taller ones blocking the signal for a tiny 40DB indoors antenna


Analog TVs have been indispensable for the marginalised, under-represented children living in remote areas to receive education during this pandemic lockdown.

As the availability of Internet, Devices capable of receiving online courses has been taken for granted, many who are not privileged not only missed education for several months now but also lost communication with their schools.

I've been thinking about inexpensive compute capable device capable of receiving analog TV via SDR and also communication through LoRAWAN[1] to address this. Now I'll also explore ESP8266's ability to receive analog TV signals.

[1]https://needgap.com/problems/149-remote-education-for-underp... (Disclaimer: it's my problem validation platform).


New TVs still have analog tv decoding from what I've seen. It's the same frequencies as digital tv, and if they have a composite video input, it's the same process, so not very much extra to support it.

There may only be a few OTA broadcasters left on analog in the US, but I don't know how far the digital transition went in developing markets. I'd bet there's some rural cable systems still running analog as well.



The navigation in the in-laws car has an analog TV tuner (along with a minidisc player), I could actually use this


NTSC, not PAL or SECAM.


Shouldn't be too hard to adapt though; certainly PAL isn't that different from NTSC.


"turn a DEC 10 into an fm transmitter" to play digital music (which was on a DECUS tape IIRC)


Could a similar thing be done for FM transmitting? I've seen it be possible on the RPi GPIO, just not the ESP yet:

https://github.com/miegl/PiFmAdv


Google esp fm radio transmitter


cnlohr does a lot of cool RF stuff - he has a Youtube channel well worth a follow!


Would this work on a Raspberry Pi? It also has a GPIO3 interface.

https://pinout.xyz/pinout/pin5_gpio3


GPIO 3 means "The third pin with General Purpose I/O functionality" - a generic pin that can be used for custom protocols. In the case of ESP8266, the pin is also used for I2S SD (data pin of the I2S bus), and this is what is actually used, because the I2S implementation in ESP8266 can work at 80MHz.

I don't seem to find the specifications of the I2S in Raspberry Pis, all I can find is in the range of kHz. So probably it cannot be done.


Thank you for the explanation. I'm really out of my depth when it comes to hardware.


Not sure about frequencies nor NTSC but I've transmitted from Ohio to New Zealand with no amplifier (once) using WSPRRYPI and there is also https://github.com/F5OEO/rpitx


So when he says "channel 3", what is meant by this? Is it a particular frequency? (I'm not an American)


I would guess it's VHF channel 3, which is from 60-66MHz, with the NTSC video carrier (Luma) on 61.25MHz, audio on 65.75MHz, and the Chroma carrier some nasty number about 3.58MHz above the Luma carrier.

In my country, VHF TV transmissions started going out in the 60s when colour came in, and were fully turned off in the 80s.

Modern DTV runs over UHF channels (replacing the previous analog transmissions between 2009 and 2012)


Channel 3 (or 4) was also commonly the channel used by various peripherals like VCRs and composite adapters.

I have fond memories of tuning the TV to channel 3 to play Nintendo as a kid. This would make for an interesting retro gaming experience.

I wonder if it is easily adapted to use coax cable instead of an antenna.


Europe used UHF channel 36 instead! Memories :)


I don't know much about transmission, but would a modified version of this work for PAL TVs? I guess you'd modify the frequency but what to?


PAL generally runs on an 8MHz channel, and encodes colour in an entirely different way (each alternate line is reversed, meaning that small errors cancel out - where in NTSC you had a "Tint" control to adjust to any errors).


PAL also requires considerably more accurate and consistent color information. NTSC displays will usually take almost anything close and display it.

See the Apple 2 video circuit for a great example of that.


Hence "Never Twice the Same Colour"


With high persistence phosphors, PAL is nice. The higher frequency color makes a notable difference.

50hz was often just a bit slow for me. PAL 60 is where it was truly at, IMHO.

Both formats have nice abuse potential, and exploiting it on early computers, and later on, microcontrollers, is a lot of fun.


Yes, the analog channels each had specific fixed frequencies.


Highly recommend the channel. His journey of reversing the Valve Lighthouse is also fun.


Is it possible to use a wire connected to a gpio pin as a receiving antenna?


I wonder if this hardware can be used to exploit know DVB vulnerabilities.


For a moment I thought he was running an analog TV _receiver_ on ESP8266, but this is so much cooler!

For anyone looking for the TL;DR:

> This is basically a 1-bit dithering DAC, operating at a frequency below the nyquist, trying to encode luma and color at the same time


How neat, actually hacker news :) Definitely upvoted.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: