Three anionic metal-organic frameworks (MOFs) {[Zn 3 (BTEC) 2 (H 2 O)(4-BCBPY)]·(H 2 O)} n (1-3) (BTEC 4- = 1,2,4,5-benzenetetracarboxylic acid anion, 4-BCBPY 2+ = 1,1'-bis(4-cyanobenzyl)-4,4'-bipyridinium dication) were synthesized in the reaction of 1,2,4,5-benzenetetracarboxylic acid with different metal salts such as ZnNO 3 , ZnCl 2 , and ZnSO 4 , under solvothermal conditions in the presence of 1,1'-bis(4-cyanobenzyl)-4,4'-bipyridinium chloride. Single crystal X-ray diffraction analysis shows that compounds 1, 2 and 3 have MOF structures based on binuclear metal building units, which are connected by two protonated BTEC 4- ligands and three zinc ions, and the viologen cation 4-BCBPY 2+ is located in the channel to achieve charge balance. Compounds 1, 2 and 3 have good photosensitivity, respond to sunlight, UV light and blue ray, and turn blue. The D-A distance and π-π stacking distance of the discolored samples (1P, 2P and 3P) changed. In addition, the three compounds showed visible color changes to ammonia vapor, rapidly changing from white to blue. At the same time, the three compounds exhibited fluorescence quenching to ammonia vapor and Cr 2 O 7 2- . It is further proved that compounds 1, 2 and 3 are fluorescent sensors with a low detection limit (for Cr 2 O 7 2- : 10 -5 M) and high sensitivity for ammonia vapor and Cr 2 O 7 2- . It was found that photochromic behavior, ammonia sensing properties can be tuned by the nature of metal salts., Competing Interests: There are no conflicts to declare., (This journal is © The Royal Society of Chemistry.)